Friday, April 8, 2011

Use Channel Advisor Order PHP API with Magento


In my previous blog I mentioned about Channel Advisor API. You can read that blog here. In this blog we will see how to use Channel Advisor Order service to get order details from Channel Advisor. This service is useful when you want to import orders from Channel Advisor to your own CMS or ERP. In my case I was working with Magento - Channel Advisor synchronization. So the requirement was to get order from Channel Advisor and add order to Magento.

Following is the code to create soap client for order service.

$client = new SoapClient("");

$headersData = array('DeveloperKey' => $developerKey, 'Password' => $password);

$head = new SoapHeader("","APICredentials",$headersData);


To get necessary order details, we need to set order criteria. Following is the example of order criteria.

$OrderCriteria = array(
               'OrderCreationFilterBeginTimeGMT'=> $date1,
               'OrderCreationFilterEndTimeGMT'=> $date2,
               'StatusUpdateFilterBeginTimeGMT' => $date1,
               'StatusUpdateFilterEndTimeGMT' => $date2,
               'DetailLevel' => 'Complete',
               'ExportState' => 'NotExported',
               'OrderStateFilter' => 'Active',
               'PaymentStatusFilter' => 'Cleared',
               'CheckoutStatusFilter'  => 'Completed',
               'ShippingStatusFilter'  =>'Shipped',

Here date1 and date2 variable specify date range for orders. After this call function of API to get order data.

$arrData = array(

You will get API response in $result. If there is only one order matching criteria then it will return order object else it will return order object array if more than one order is matching criteria.


  1. Very nice working. Please Also mention here to install the latest SOAP 1.3. So it working fine.

    Initially when I use it. It won't work then I try to use nusoap. But there is still some issue related to the order criteria. Then I search in google here I found that it might be issues of soap version. Then I update my soap to 1.3 and use this code. And Bang Bang, It work in first attempt.

    Thanks :)

  2. Can we get test client account. I think i would have to register developer account in client account