【问题标题】:Create Billing Plan is erroring with Malformed_Request创建计费计划因 Malformed_Request 出错
【发布时间】:2014-10-09 05:18:44
【问题描述】:

我正在尝试根据以下请求创建计费计划。 (它是有效的 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"}

据我所知,请求是正确的,我正在验证,我有正确的 URL,有人发现问题是什么吗?

【问题讨论】:

    标签: c# rest paypal-subscriptions recurring-billing


    【解决方案1】:

    是的,没有将周期设置为 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"
    }
    }
    

    【讨论】:

      【解决方案2】:

      你有autobill_amount,它应该是auto_bill_amount。你也有initial_amount_fail_action,它应该是initial_fail_amount_action

      【讨论】:

      • 修复了这个问题,而且 initial_amount_fail_action 也是错误的,所以也更正了,但是仍然失败
      猜你喜欢
      • 1970-01-01
      • 2017-02-07
      • 2021-03-15
      • 2019-03-18
      • 2020-08-10
      • 2016-10-04
      • 2021-04-07
      • 2018-12-01
      • 1970-01-01
      相关资源
      最近更新 更多