我正在尝试使用此端点取消订单并退款:
https://help.shopify.com/en/api/reference/orders/order#cancel
具有以下有效负载:
{"refund": {
"shipping": {"full_refund": true},
"refund_line_items": [{
"quantity": 1,
"line_item_id": 2032498606169,
"price": "39.90",
"subtotal": "39.90",
"total_tax": "6.37",
"discounted_total_price": "39.90",
"total_cart_discount_amount": "0.00",
"location_id": null,
"restock_type": "no_restock",
"discounted_price": "39.90"
}],
"transactions": [{
"amount": "39.90",
"maximum_refundable": "39.90",
"kind": "refund",
"parent_id": 1147873263705,
"currency": "EUR",
"order_id": 922997620825,
"gateway": "amazon_payments"
}],
"notify": true
}}
该订单只有一篇文章,所以我基本上是在退还该订单的全部款项。
但是,此REST API调用返回成功,但是当我检查订单页面时,我确实看到该订单已取消,但是根本没有退款。
并且订单状态显示“已取消”,“已支付”,“未完成”。所以我最终不得不手动退款。
为什么我的REST通话只是取消此订单,而不继续退款?
谢谢!
答案 0 :(得分:1)
您的参考文献有误。根据您的参考,取消帖子应为:
POST /admin/api/2019-04/orders/#{order_id}/cancel.json {} // post an empty object -- not null
https://help.shopify.com/en/api/reference/orders/refund#create处的退款API显示的POST正文与您提供的POST正文略有不同。您在自己的return_line_item中不需要任何价格信息。
您是否已确认退款中的parent_id是sale
或capture
交易,且网关类型匹配。