Shopify 退款 API: refund_line_items.line_item 不能为空
Shopify refund API: refund_line_items.line_item can't be blank
我正在 Postman 中测试 Shopify API 并且 运行 这个请求:
https://shopify.dev/docs/admin-api/rest/reference/orders/refund#calculate-2021-01
https://{{api_key}}:{{api_password}}@{{store_name}}.myshopify.com/admin/api/{{api_version}}/orders/{{order_id}}/refunds/calculate.json
用这个 body:
"refund": {
"shipping": {
"full_refund": false
},
"refund_line_items": [
{
"line_item_id": 5843458293926,
"quantity": 1,
"restock_type": "no_restock"
}
]
}
}
我收到这个错误:
{
"errors": {
"refund_line_items.line_item": [
"can't be blank"
]
}
}
我检查了我在请求中使用的所有变量是否正确,并且“line_item_id”与订单中的项目匹配。
您正在为请求中的端点提供所需的一切。它返回的错误有点误导。 “不能为空”表示您错过了一个参数,而实际上您提供的值确实存在问题。
行项目 ID 很容易与 Shopify 使用的各种其他 ID(例如产品或变体)混淆。您需要使用订单中的行项目 ID。这些 ID 对于每个订单的每个行项目都是唯一的,与产品相关的 ID 不同。
我正在 Postman 中测试 Shopify API 并且 运行 这个请求:
https://shopify.dev/docs/admin-api/rest/reference/orders/refund#calculate-2021-01
https://{{api_key}}:{{api_password}}@{{store_name}}.myshopify.com/admin/api/{{api_version}}/orders/{{order_id}}/refunds/calculate.json
用这个 body:
"refund": {
"shipping": {
"full_refund": false
},
"refund_line_items": [
{
"line_item_id": 5843458293926,
"quantity": 1,
"restock_type": "no_restock"
}
]
}
}
我收到这个错误:
{
"errors": {
"refund_line_items.line_item": [
"can't be blank"
]
}
}
我检查了我在请求中使用的所有变量是否正确,并且“line_item_id”与订单中的项目匹配。
您正在为请求中的端点提供所需的一切。它返回的错误有点误导。 “不能为空”表示您错过了一个参数,而实际上您提供的值确实存在问题。
行项目 ID 很容易与 Shopify 使用的各种其他 ID(例如产品或变体)混淆。您需要使用订单中的行项目 ID。这些 ID 对于每个订单的每个行项目都是唯一的,与产品相关的 ID 不同。