curl 如何使用Flipkart卖家API取消订单

pdsfdshx  于 2023-10-19  发布在  其他
关注(0)|答案(1)|浏览(91)

请告诉我如何通过Flipkart卖家API取消订单。
我试过了,但它给了我错误:

$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);

输出:Array([errors] => Array([0] => Array([type] => ERROR [code] => DEPENDENT_SYSTEM_CALL_FAILURE [message] =>对依赖系统的调用失败。请稍后重试[params] => Array()

)

    )


请帮我取消订单。
提前感谢!!

u5rb5r59

u5rb5r591#

您可以尝试以下API来取消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"]
    }
  ]
}

相关问题