Sometimes an e-commerce system will mark an order as shipped outside of the ShippingEasy system. Therefore an API call is required to remove this order from ShippingEasy so that it is not double-shipped.

First create a new cancellation object with your store's API key and the e-commerce order identifier used to create the order in ShippingEasy:

<?php
$cancellation = new ShippingEasy_Cancellation("d8821dde1d32f408def40b77273d5c11", "ABC123");

Then simply call create to execute the remote call:

<?php
$cancellation->create();

If successful the call will return a JSON hash with the ShippingEasy order ID, as well as the external order identifier originally supplied in your call.

{ "order" => { "id" => "27654", "external_order_identifier" => "ABC123" } }

Possible Exceptions

ShippingEasy_AuthenticationError

Your credentials could not be authenticated.

ShippingEasy_InvalidRequestError

The cancellation could not complete for one or more of the following reasons:

  • The order could not be found.
  • The order has already been marked as shipped in the ShippingEasy system and cannot be cancelled.

The exception will contain a message that indicates which of these conditions failed.