All it takes is a phone call to cancel an excursion and get a refund. If within 48 hours of sailing it is given as a refundable OBC, else it goes back to the method of payment used.
Generally 30 minutes prior to sailaway, though the captain may set an earlier time. If at a tender port the last tender is usually an hour before sailaway.