我正在尝试使用此终结点取消订单并退款:
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调用只是取消了这个订单,但没有继续退款?
谢谢!
你有错误的参考。根据您的参考,取消帖子应该是:
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的Refund api显示的POST主体与您提供的略有不同。您不需要在refund_line_item中提供任何价格信息。
您是否验证了退款中的parent_id是sale
或capture
交易以及网关类型是否匹配。