问题描述
我在PayPal的Sandbox / API V2中遇到了一个奇怪的问题。
创建具有let hrefVal = null
$('.edit_product').click(function () { hrefVal = $(this).data('href') })
意向的订单(预身份验证)之后。我将用户带到“批准” URL,并选择了PayPal付款方式说后,它会将我重定向回我的redirect_url,但只是重新加载了付款选择屏幕。
我不知道怎么了...。这就是我直接传递给API的内容:
AUTHORIZE
当PayPal返回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"
}
}
响应时,该呼叫显然正在工作。我遍历了返回的HATEOAS链接,并将用户重定向到了批准的URL……然后问题开始了……
API响应为:
CREATED
解决方法
问题是他们令人困惑的API文档。
order_application_context
应在API调用中更改为: application_context