Cancel Order Status Function

The function to cancel an order is CancelOrder.

Heads up! You can only cancel an order in the PENDING status.
An error will be returned if you try to cancel an order after it has printed.

Request

creds (type: array)
Credentials must be passed in the order data to authenticate (see authentication for more details)
  • Credentials.partnerCode (type: string)
    Your unique partner key as assigned by ZenPrint
  • Credentials.apiKey (type: string)
    Your unique API key as assigned by ZenPrint
partnerOrderId (type: int)
Your order number

Response

Order data will be returned with:
LineItem.currentState (type: array)
The current status of the line item. Can include:
  • PENDING - The order is received and waiting to be printed
  • PRINTED - The order has been printed
  • BINNING - This item has been completed as is awaiting other line items before shipping
  • PACK SLIP CREATED - The order is complete and awaiting packaging to be shipped
  • PACKAGED - The order has been packaged and is awaiting final shipping
  • SHIPPED - The order has been shipped
  • HOLD - The order is on hold due to an issue
  • CANCELLED - The order has been cancelled
OrderData.errors.message (type: string)
Any errors in the submission will be returned here

Sample Code (PHP)

<?php * Cancel an Order *
										
//showing all errors
error_reporting(E_ALL);
ini_set('display_errors', '1');

$client = new soapclient('http://orderapi.zenprint.com/orderapi/?WSDL', array('cache_wsdl' => WSDL_CACHE_NONE));
$credentials = array("partnerCode"=>"REPLACE_WITH_PARTNER_CODE", "apiKey" =>"REPLACE_WITH_API_KEY");
$orderID = 12345; // replace with the order number you'd like to cancel

$orderStatus = $client->CancelOrder(array(
        "creds" => $credentials,
        "partnerOrderId" => $orderID
))->CancelOrderResult;

//var_dump($orderStatus);
if (is_array($orderStatus->orderLineItems->LineItem)){
	echo "Current Order Status: ".$orderStatus->orderLineItems->LineItem[0]->currentState;
} else {
echo "Current Order Status: ".$orderStatus->orderLineItems->LineItem->currentState;
}
?>
Application: ZenPrintApp [Run Tests, View Tests]
Framework: CFWheels 1.4.4
Active Environment: Development
Host Name: utpspro2
CFML Engine: Adobe ColdFusion 9,0,1,274733
Default Data Source: Zenprint
Database Adapter: SQLServer
URL Rewriting: On
URL Obfuscation: Off
Plugins: None
Controller: Main
Action: ApiCancelOrder
Parameters: None
Execution Time: 31ms (view ~31ms, action ~31ms)
Help Links: Documentation, Mailing List, Issue Tracker