Developer API – Code Samples

Post order status updates

The following PHP sample code posts order status updates to ChannelUnity, useful if you want to mark an order as shipped via a 3rd party system. The username and password must match your ChannelUnity account, and you shouldn’t hardcode these variables into your script.

If you don’t know your API key, you can use the ValidateUser API call, alternatively contact our support team.

$merchantName = "yourMerchantName";
$username = "yourUserName";
$password = "yourPassword";
$apiKey = "yourAPIKey";

// Details about the order being shipped
$subscriptionID = '1001';
$orderID = '485771022';
$carrier = 'Royal Mail';
$shipmentMethod = 'First Class';
$trackingNumber = 'GB000000444000';
$shipmentDate = date('c');
// ----
$session = curl_init();

$auth = base64_encode($username . ":" . hash('sha256', $password));
$xml = "<?xml version=\"1.0\" ?>
$xml = urlencode($xml);

curl_setopt($session, CURLOPT_URL, "");
curl_setopt($session, CURLOPT_POST, TRUE);
curl_setopt($session, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($session, CURLOPT_VERBOSE, TRUE);
curl_setopt($session, CURLOPT_POSTFIELDS, array('message' => $xml));
curl_setopt($session, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($session, CURLOPT_POSTREDIR, 7);

$result = curl_exec($session);


echo $result . "\n";
If you want to sell on marketplaces but don't yet have an online store, Synchromatic is the solution for you.
More Details