Walmart MX Marketplace Acknowledge Order API Issue

458 Views Asked by At

I am working on Walmart integration to my own web application using PHP. When I tried to acknowledge my Mexico orders, I got an empty response. The data type of response is string with 0 length, error code 400. It looks like my credentials are good. Is "https://marketplace.walmartapis.com/v3/orders/{PurchaseOrderId}/acknowledge" a valid API url?

$url="https://marketplace.walmartapis.com/v3/orders/P108915403/acknowledge";
$ch      = curl_init();
$qos     = uniqid();
$options = array(
    CURLOPT_URL            => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT        => 60,
    CURLOPT_HEADER         => false,
    CURLOPT_POST           =>1,
    CURLOPT_HTTPHEADER     => array(
        "WM_SVC.NAME: Walmart Marketplace",
        "WM_QOS.CORRELATION_ID: $qos",
        "Authorization: Basic $authorization",
        "WM_SEC.ACCESS_TOKEN:$token",
        "Accept: application/json",
        "Content-Type: application/json",
        "WM_MARKET: mx",
    ),
);
curl_setopt_array($ch, $options);
$response = curl_exec($ch);
var_dump($response);

Code Snippet

2

There are 2 best solutions below

0
On BEST ANSWER

After putting it aside for a few months, today I picked it up and finally got it resolved luckily and got a 202 Accepted Response with empty content(Walmart's documentation says the response to a successful call contains the acknowledged order, but it actually contains nothing except for 202 Accepted code).

When I tried to acknowledge my Mexico orders, the response is actually not empty. The header contains error message: http code 400 Bad Request. I confirmed that it is due to wrong payload structure after testing. So "https://marketplace.walmartapis.com/v3/orders/{PurchaseOrderId}/acknowledge" is a valid API URL and is the same as US API. The difference between them is that MX site needs a well-structured payload through POST while US site does not(US API only needs an empty payload through POST).

The key point to a successful call is the structure of the payload. The structure should be like the samples in the documentation.

Pay attention to the details of the structure. Refer to the picture for the structure of payload here. The "orderLine" and "orderLineStatus" should be declared as ARRAY instead of single element. And this is the reason why I failed to call the acknowledge API before.

0
On

Looks like you are using an old API, which has been discontinued, the same has been communicated late December 2020.

We have improved our onboarding experience with following steps:  

  1. Create an account on Walmart IO platform - https://walmart.io by clicking on the user icon just before the search box.        

  2. Login to the account and accept "Terms of Use"

  3. Click on "Create Your Application" to create a new application and fill in appropriate details.        

  4. Use this tutorial to generate two sets of public/private keys - https://walmart.io/key-tutorial        * One set will be used for production.         * Other set will be used for stage.

  5. Upload both public keys using - https://walmart.io/key-upload?app_name=<your app name>      

  6. Consumer ID will be generated for both sets for prod and stage which can be seen on the dashboard - https://walmart.io/userdashboard 

  7. Click on "Request Access" for Checkout APIs at https://walmart.io/reference  and fill out the form. 

  8. Once the access is approved, documentation will be available for integrating with Commerce API through Walmart I/O.

  9. We will send out client secrets for stage and prod as soon as they’re ready.   Thanks, Firdos IOSupport