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

问题描述 投票:0回答:1

请告诉我如何通过 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);

输出:数组 ( [错误] => 数组 ( [0] => 数组 ( [类型] => 错误 [代码] => DEPENDENT_SYSTEM_CALL_FAILED [消息] => 对从属系统的调用失败。请稍后重试 [参数] => 数组 ( )

            )

    )

请帮我取消订单。

提前致谢!

curl flipkart-api
1个回答
1
投票

您可以尝试使用以下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"]
    }
  ]
}
© www.soinside.com 2019 - 2024. All rights reserved.