For an online business, requirements of customers to cancel a shipment can come up frequently because customers can change their minds just after they complete their purchase at your online stores. In these cases, if the carrier supports cancellations and shipment is still not dispatched to a carrier, you are entirely possible to cancel the shipment for your customers.
Canceling the shipments depends mostly on the carrier. In reality, some of them restrict or limit cancellations after booking. For instance, to cancel the shipment with UPS, you are required to wait 24 hours after the shipment is booked. It is worth noting that when a shipment is canceled, the cancellation cannot be kept. Hence, recreating the order is the only recourse.