使用PayPal订阅API收费

时间:2019-11-16 08:25:45

标签: paypal subscription paypal-subscriptions tax

作为欧盟卖家,我需要根据客户所在国家/地区的税率和规则收取税款。这意味着在创建订阅时,我需要指定税率(百分比或金额)或具有覆盖订阅价格的功能。使用Stripe时,只需在创建订阅时在tax_percent旁边指定plan_id

到目前为止,我无法使用PayPal Subscriptions API及其smart buttons来执行相同操作。创建计划时可以设置税率,但我需要能够设置每个订阅的税率。

示例智能按钮JS代码:

paypal.Buttons({
  createSubscription: function(data, actions) {
    return actions.subscription.create({
      'plan_id': 'P-2UF78835G6983425GLSM44MA',
      // I'd like to be able to set tax rate here somehow
    });
  }
}).render('#paypal-button-container');

也没有运气直接使用Subscriptions API设置税收:

curl -v -k -X POST https://api.sandbox.paypal.com/v1/billing/subscriptions \
   -H "Accept: application/json" \
   -H "Authorization: Bearer Access-Token" \
   -H "Content-Type: application/json" \
   -d '{
      "plan_id": "P-2UF78835G6983425GLSM44MA",
      "application_context": {
        "brand_name": "example",
        "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是否“忘记”实施税率等基本内容,因此使他们的新订阅API无法用于增值税MOSS方案?

4 个答案:

答案 0 :(得分:1)

最近我发现这是可能的。不确定这是最近添加的东西还是一直有这个选项。

在创建订阅时,您可以覆盖计划并内联设置税收百分比。

curl -v -k -X POST https://api.sandbox.paypal.com/v1/billing/subscriptions \
   -H "Accept: application/json" \
   -H "Authorization: Bearer Access-Token" \
   -H "Content-Type: application/json" \
   -d '{
        "plan_id": "#PLANID",
        ...
        "plan": {
            "taxes": {
                "percentage": "19",
                "inclusive": false
            }
        }
    }'

答案 1 :(得分:1)

您可以将税收覆盖添加到计划节点,如下所示

    <script>

      paypal.Buttons({
        createSubscription: function(data, actions) {
          return actions.subscription.create({
            'plan_id': 'YOUR_PLAN_ID_HERE', // Creates the subscription
            
            'plan': {
               'taxes': {
                   'percentage': '2.9',
                   'inclusive': false
               }}


          });
        },
        onApprove: function(data, actions) {
          alert('You have successfully created subscription ' + data.subscriptionID); // Optional message given to subscriber
        }
      }).render('#paypal-button-container'); // Renders the PayPal button
    </script>

答案 2 :(得分:0)

这是一个古老的话题,仍然不可能。 PayPal不支持订阅税。您可以为您的订阅定价,使其包含增值税。在将用户重定向到付款之前,提及价格已包含增值税。

我强烈建议您不要自己执行税收规则。最好让第三方API处理正确的计算。

答案 3 :(得分:0)

税收似乎包含在计划实体中。

https://developer.paypal.com/docs/subscriptions/full-integration/plan-management/#show-plan-details

curl -v -X GET https://api-m.sandbox.paypal.com/v1/billing/plans/P-2UF78835G6983425GLSM44MA \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <Access-Token>
{
      "id": "P-2UF78835G6983425GLSM44MA",
      "product_id": "PROD-6XB24663H4094933M",
      "name": "Basic Plan",
      "status": "ACTIVE",
      "description": "Basic plan",
      "billing_cycles": [
        {
          "frequency": {
            "interval_unit": "MONTH",
            "interval_count": 1
          },
          "tenure_type": "TRIAL",
          "sequence": 1,
          "total_cycles": 1
        },
        {
          "pricing_scheme": {
            "fixed_price": {
              "currency_code": "USD",
              "value": "10.0"
            }
          },
          "frequency": {
            "interval_unit": "MONTH",
            "interval_count": 1
          },
          "tenure_type": "REGULAR",
          "sequence": 2,
          "total_cycles": 12
        }
      ],
      "payment_preferences": {
        "auto_bill_outstanding": true,
        "setup_fee": {
          "currency_code": "USD",
          "value": "10.0"
        },
        "setup_fee_failure_action": "CONTINUE",
        "payment_failure_threshold": 3
      },
----------------------------------------
      "taxes": {
        "percentage": "10.0",
        "inclusive": false
      },
----------------------------------------
      "quantity_supported": false,
      "create_time": "2020-02-26T07:01:04Z",
      "update_time": "2020-02-26T07:01:04Z",
      "links": [
        {
          "href": "https://api-m.sandbox.paypal.com/v1/billing/plans/P-2UF78835G6983425GLSM44MA",
          "rel": "self",
          "method": "GET"
        },
        {
          "href": "https://api-m.sandbox.paypal.com/v1/billing/plans/P-2UF78835G6983425GLSM44MA",
          "rel": "edit",
          "method": "PATCH"
        },
        {
          "href": "https://api-m.sandbox.paypal.com/v1/billing/plans/P-2UF78835G6983425GLSM44MA/deactivate",
          "rel": "self",
          "method": "POST"
      }
    ]
  }