即使计划设置了quantity_supported,PayPal API也会返回SUBSCRIPTION_CANNOT_HAVE_QUANTITY

使用PayPal当前的API,我创建了一个简单的产品:

{
"id" : "A-001",
"name": "A Service",
"description": "Video streaming service",
"type": "SERVICE",
"category": "SOFTWARE"
}

我还创建了一个按数量分层的计划

{
"product_id" : "A-001",
"name": "Default Plan",
"description": "Plan with regular and trial payment definitions.",
"quantity_supported" : true,
"billing_cycles": [
    {
      "frequency": {
        "interval_unit": "MONTH",
        "interval_count": 1
      },
      "tenure_type": "TRIAL",
      "sequence": 1,
      "total_cycles": 1
    },
    {
      "frequency": {
        "interval_unit": "MONTH",
        "interval_count": 1
      },
      "tenure_type": "REGULAR",
      "sequence": 2,
      "total_cycles": 12,
      "pricing_scheme": {
        "pricing_model" : "TIERED",
        "version" : 1,
        "tiers": [{
                    "starting_quantity": 1,
                    "ending_quantity": 499,
                    "amount": { "currency_code":"USD", "value":0.55}
                },
                {
                    "starting_quantity": 500,
                    "ending_quantity": 999,
                    "amount": { "currency_code":"USD", "value":0.5}
                },
                {
                    "starting_quantity": 1000,
                    "ending_quantity": 2499,
                    "amount": { "currency_code":"USD", "value":0.46}
                },
                {
                    "starting_quantity": 2500,
                    "amount": { "currency_code":"USD", "value":0.37}
                }
            ]
      }
    }
  ],
  "payment_preferences": {
    "auto_bill_outstanding": true,
    "setup_fee": {
      "value": "10",
      "currency_code": "USD"
    },
    "setup_fee_failure_action": "CONTINUE",
    "payment_failure_threshold": 3
  },
  "taxes": {
    "percentage": "10",
    "inclusive": false
  }
}

现在,我尝试创建对计划的订阅:

{
"plan_id": "P-16786052YT8021220MAMUCDY",
"start_time": "2021-03-01T00:00:00Z",
"quantity": "20",
"shipping_amount": {
"currency_code": "USD",
"value": "0.00"
},
"subscriber": {
  "name": {
  "given_name": "John",
  "surname": "Doe"
},
"email_address": "[email protected]",
"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": "walmart",
"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"
}

}

但是我得到了一个错误响应:

{
"name": "UNPROCESSABLE_ENTITY",
"message": "The requested action could not be performed, semantically incorrect, or failed business validation.",
"debug_id": "658174d246c0b",
"details": [
    {
        "issue": "SUBSCRIPTION_CANNOT_HAVE_QUANTITY",
        "description": "Subscription can't have quantity as the plan does not support quantity."
    }
],
"links": [
    {
        "href": "https://developer.paypal.com/docs/api/v1/billing/subscriptions#UNPROCESSABLE_ENTITY",
        "rel": "information_link",
        "method": "GET"
    }
]

}

当我的计划清楚地指出"quantity_supported" : true,时,为什么我会得到这个错误?

转载请注明出处:http://www.0591kyj.com/article/20230526/2545483.html