0

Please let me know how I can cancel order through the Flipkart seller API.

I have tried this but it gives me error:

$url  = "https://api.flipkart.net/sellers/v2/orders/cancel";
$curl = curl_init(); 

$json = '{
  "orderItems": [
    {
      "orderItemId": "225561595849261000",
      "reason": "not_enough_inventory"
    }
  ]
}';
curl_setopt($curl, CURLOPT_URL,$url);

curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $json);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type:application/json',
'Authorization:Bearer xxxxxxxx',
''
));
$result = curl_exec($curl);
$ee = curl_getinfo($curl);
echo "<pre>";
//print_r($ee);
curl_close($curl);

$result = json_decode($result,true);
 print_r($result);

output: Array ( [errors] => Array ( [0] => Array ( [type] => ERROR [code] => DEPENDENT_SYSTEM_CALL_FAILED [message] => A call to dependent system failed. Please retry after some time [params] => Array ( )

            )

    )

)

Please help me to cancel order.

Thanks in Advance!!

1 Answers1

1

You can try the below API to cancel the order on Flipkart.

https://seller.flipkart.com/api-docs/order-api-docs/OMAPIRef.html#post-v3-shipments-cancel

{
  "shipments": [
    {
      "shipmentId": "shipmentId",
      "reason": "not_enough_inventory", // There are other option as well
      "locationId": "locationId",
      "cancellationGroupIds": ["cancellationGroupId"]
    }
  ]
}
Deepak Samria
  • 135
  • 1
  • 5