我正在尝试使用以下请求创建结算方案。 (它是有效的JSON)并且我已经检查了请求并且基于PayPal上给出的示例请求似乎是正确的(无论如何,我已经尝试使用股票示例并且它不会工作。
POST https://api.sandbox.paypal.com/v1/payments/billing-plans HTTP/1.1
Content-Type: application/json
Authorization: Bearer A015Ocv2vKmHg2NY2PNSbGEIN5jWHsZFKr.63kJzvtNaeII
Host: api.sandbox.paypal.com
Content-Length: 775
Expect: 100-continue
{
"name": "Membership Fee",
"description": "Monthly Fee with Trial Month",
"type": "INFINITE",
"payment_definitions": [
{
"name": "Plan",
"type": "REGULAR",
"frequency": "MONTH",
"frequency_interval": "1",
"amount": {
"value": "15",
"currency": "GBP"
},
"cycles": "12"
},
{
"name": "First Month Free Trial",
"type": "TRIAL",
"frequency": "MONTH",
"frequency_interval": "1",
"amount": {
"value": "0.01",
"currency": "GBP"
},
"cycles": "1"
}
],
"merchant_preferences": {
"setup_fee": {
"value": "0",
"currency": "GBP"
},
"return_url": "http://app.URLREMOVED.co.uk/complete",
"cancel_url": "http://app.URLREMOVED.co.uk/cancel",
"auto_bill_amount": "YES",
"initial_fail_amount_action": "CONTINUE",
"max_fail_attempts": "12"
}
}
我得到的回应:
HTTP/1.1 400 Bad Request
Server: Apache-Coyote/1.1
PROXY_SERVER_INFO: host=slcsbjava4.slc.paypal.com;threadId=35463
Paypal-Debug-Id: 8437249fdc6d1
SERVER_INFO: paymentsplatformserv:v1.payments.billing- plans&CalThreadId=127&TopLevelTxnStartTime=147d9bc0282&Host=slcsbjm3.slc.paypal.com&pid=25126
Content-Language: *
Date: Fri, 15 Aug 2014 12:54:42 GMT
Connection: close
Content-Type: application/json
Content-Length: 213
Connection: close
{"name":"MALFORMED_REQUEST","message":"Incoming JSON request does not map to API request","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#MALFORMED_REQUEST","debug_id":"8437249fdc6d1"}
据我所知,请求是正确的,我正在验证,我有正确的网址,有人发现问题所在吗?
答案 0 :(得分:0)
您有autobill_amount
,它应该是auto_bill_amount
。您还有initial_amount_fail_action
,它应该是initial_fail_amount_action
。
答案 1 :(得分:0)
是的,我的错误是没有将周期设置为0,因为这是一个持续的付款,直到有人取消它,它应该是0而不是12。
所以,更正了请求(哪个有效)
{
"name": "Membership Fee",
"description": "Monthly Fee with Trial Month",
"type": "infinite",
"payment_definitions": [
{
"name": "Free Trial",
"type": "REGULAR",
"frequency": "MONTH",
"frequency_interval": "1",
"amount": {
"value": "15",
"currency": "GBP"
},
"cycles": "0"
},
{
"name": "First Month Free Trial",
"type": "TRIAL",
"frequency": "MONTH",
"frequency_interval": "1",
"amount": {
"value": "0.01",
"currency": "GBP"
},
"cycles": "1"
}
],
"merchant_preferences": {
"setup_fee": {
"value": "1",
"currency": "GBP"
},
"return_url": "http://app.URLREMOVED.co.uk/complete",
"cancel_url": "http://app.URLREMOVED.co.uk/cancel",
"auto_bill_amount": "YES",
"initial_fail_amount_action": "CONTINUE",
"max_fail_attempts": "0"
}
}