Paypal REST API订阅集成错误
我正在尝试使用以下文档通过PayPalRESTAPI集成Paypal订阅 (基本整合) 步骤1(自动化成功) 步骤2(成功创建产品) 步骤3(成功创建计划) 步骤4(创建订阅失败)Paypal REST API订阅集成错误,paypal,Paypal,我正在尝试使用以下文档通过PayPalRESTAPI集成Paypal订阅 (基本整合) 步骤1(自动化成功) 步骤2(成功创建产品) 步骤3(成功创建计划) 步骤4(创建订阅失败) 它看起来像是通过JavaScript SDK中的智能支付按钮工作的。但是通过RESTAPI curl -v -k -X POST https://api.sandbox.paypal.com/v1/billing/subscriptions \ -H "Accept: application/json&
它看起来像是通过JavaScript SDK中的智能支付按钮工作的。但是通过RESTAPI
curl -v -k -X POST https://api.sandbox.paypal.com/v1/billing/subscriptions \
-H "Accept: application/json" \
-H "Authorization: Bearer Access-Token" \
-H "PayPal-Request-Id: SUBSCRIPTION-21092020-001" \
-H "Prefer: return=representation" \
-H "Content-Type: application/json" \
-d '{
"plan_id": "P-4ML8771254154362WXNWU5BC",
"start_time": "2020-11-01T00:00:00Z",
"quantity": "20",
"shipping_amount": {
"currency_code": "USD",
"value": "10.00"
},
"subscriber": {
"name": {
"given_name": "John",
"surname": "Doe"
},
"email_address": "customer@example.com",
"shipping_address": {
"name": {
"full_name": "John Doe"
},
"address": {
"address_line_1": "2211 N First Street",
"address_line_2": "Building 17",
"admin_area_2": "San Jose",
"admin_area_1": "CA",
"postal_code": "95131",
"country_code": "US"
}
}
},
"application_context": {
"brand_name": "example",
"locale": "en-US",
"shipping_preference": "SET_PROVIDED_ADDRESS",
"user_action": "SUBSCRIBE_NOW",
"payment_method": {
"payer_selected": "PAYPAL",
"payee_preferred": "IMMEDIATE_PAYMENT_REQUIRED"
},
"return_url": "https://example.com/returnUrl",
"cancel_url": "https://example.com/cancelUrl"
}
}'
我明白了
我尝试了所有可能的方法,但我不知道如何调试这个问题,也不知道创建订阅请求中缺少了什么。谢谢大家! 请尝试将PayPal请求Id作为唯一Id传递(PayPal服务器将其存储为唯一Id),它应该可以工作 欲了解更多详情,请点击链接
让我知道是否解决了相同的问题,我甚至复制粘贴了API文档中的代码。但是没有运气
{"name":"INVALID_REQUEST","message":"Request is not well-formed, syntactically incorrect, or violates schema.","debug_id":"ec6f365217c37","details":[{"field":"/name","location":"body","issue":"MISSING_REQUIRED_PARAMETER","description":"A required field is missing."},{"field":"/payment_preferences","location":"body","issue":"MISSING_REQUIRED_PARAMETER","description":"A required field is missing."},{"field":"/billing_cycles","location":"body","issue":"MISSING_REQUIRED_PARAMETER","description":"A required field is missing."},{"field":"/product_id","location":"body","issue":"MISSING_REQUIRED_PARAMETER","description":"A required field is missing."}],"links":[{"href":"https://developer.paypal.com/docs/api/v1/billing/subscriptions#INVALID_REQUEST","rel":"information_link","method":"GET"}]}