我在PayPal的Sandbox/API V2上遇到了一个奇怪的问题。
创建具有AUTHORIZE
意图的订单后(预授权(。我将用户带到APPROVE URL,在选择支付方式后,PayPal说它将把我重定向回我的redirect_URL,但它只是重新加载支付选择屏幕。
我不知道怎么了。。。。这是我直接传递给API的内容:
curl -v -X POST https://api.sandbox.paypal.com/v2/checkout/orders
-H "Content-Type: application/json"
-H "Authorization: Bearer <my-access-token>"
-d '{
"intent":"AUTHORIZE",
"description":"Description goes here",
"soft_descriptor":"Descriptor",
"purchase_units":[
{
"amount":{
"currency_code":"CAD",
"value":"351.75"
}
}
],
"order_application_context":{
"return_url":"redacted_for_privacy",
"cancel_url":"redacted_for_privacy"
}
}
当PayPal返回CREATED
响应时,该呼叫显然正在工作。我已经遍历了返回的HAEOAS链接,并将用户重定向到批准URL。。。然后问题开始了。。。
API的回应是:
{
"id": "8KF74291SN313461D",
"intent": "AUTHORIZE",
"status": "CREATED",
"purchase_units": [
{
"reference_id": "default",
"amount": {
"currency_code": "CAD",
"value": "351.75"
},
"payee": {
"email_address": "sb-iuaiy3198427@business.example.com",
"merchant_id": "DXYXG2JAU3SQQ"
}
}
],
"create_time": "2020-09-15T05:13:59Z",
"links": [
{
"href": "https://api.sandbox.paypal.com/v2/checkout/orders/8KF74291SN313461D",
"rel": "self",
"method": "GET"
},
{
"href": "https://www.sandbox.paypal.com/checkoutnow?token=8KF74291SN313461D",
"rel": "approve",
"method": "GET"
},
{
"href": "https://api.sandbox.paypal.com/v2/checkout/orders/8KF74291SN313461D",
"rel": "update",
"method": "PATCH"
},
{
"href": "https://api.sandbox.paypal.com/v2/checkout/orders/8KF74291SN313461D/authorize",
"rel": "authorize",
"method": "POST"
}
]
}
问题是他们令人困惑的API文档。
应将API调用中的order_application_context
更改为:application_context