Charge tax using PayPal Subscriptions API
Asked Answered
H

4

6

As an EU based seller I need to charge tax based on customer country tax rates and rules. That means that when I create subscription I need to specify either tax rate (percentage or amount) or have the ability to override subscription price. When using Stripe one just needs to specify tax_percent beside plan_id when creating subscription.

So far I wasn't able to do the same using PayPal Subscriptions API and their smart buttons. Tax rate can be set when creating plan but I need to be able to set tax percentage per subscription.

Sample smart button JS code:

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');

No luck setting up tax directly using Subscriptions API either:

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"
      }
    }'

Am I missing something, thinking about this incorrectly or did PayPal "forgot" to implement basic thing like tax rate and therefore make their new subscriptions API unusable for VAT MOSS scenarios?

Hambletonian answered 16/11, 2019 at 8:25 Comment(0)
U
5

You can add the tax override to the plan node as shown below

    <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>
Unbeliever answered 23/7, 2021 at 16:37 Comment(1)
Thats the correct answer. And if you wish to do it on your back-end you should use the same "plan" object on your "create subscription method to override the plan details (developer.paypal.com/docs/api/subscriptions/v1/…)Veranda
W
1

It's an old topic and still not possible. PayPal doesn't support taxes with subscriptions. You can price your subscription so it has the VAT included in it. Mention that the price includes VAT before a user is redirected to payment.

I highly recommend not to implement the tax rules yourself. Better let a 3rd party API handle correct calculations.

Winfredwinfrey answered 26/11, 2019 at 9:26 Comment(3)
According to PayPal's release notes this new Subscription API was added in April '19. Not sure if this would classify it as old. Marking product price as VAT included could work but then I'd need to use some average tax rate and potentially lose money for countries whose tax rate is greater.Hambletonian
@LukaPeharda Ok, should have been clearer: It's an old topic that PayPal doesn't bother with VAT. It has been the case for their existing APIs. The solutions I linked offer geolocated VAT calculations, so you don't have to use any average. An arbitrary tax would be extremely weird from a customer's perspective.Winfredwinfrey
In the past people could set a price for each subscription, it was dynamic. Now PayPal forces you to make a product catalog, so you can not add tax into the price anymore. They are unprofessional to a point where I am wondering how they can survive as payment provider. They are probably the only payment provider worldwide that doesn't handle or support taxesMuslim
H
1

Recently I found out that this is possible. Not sure if this is something added fairly recently or was this option there all along.

While creating a subscription you can override a plan and set the tax percentage inline.

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
            }
        }
    }'
Hambletonian answered 25/2, 2021 at 6:7 Comment(2)
this is correct answer. unfortunately there is no word about it in Subscription APIUvular
But this functionality still not available when your customers wants to revise a subscription for quantity or other change. the tax will be reset to plan default and you will receive OVERRIDES_ON_SAME_PLAN_NOT_ALLOWED error from console.Chan
A
0

Taxes seem to be included in the Plan entity.

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"
      }
    ]
  }
Audiovisual answered 21/12, 2020 at 7:44 Comment(1)
They are. But in order for me to handle different tax rates across EU countries I'd have to create numerous plans each with its own different tax amount. And then subscribe user to the plan with a correct tax rate. Whereas in Stripe (for example) you can subscribe user to a plan (price) and then define tax rate so one plan can have many tax rates.Hambletonian

© 2022 - 2024 — McMap. All rights reserved.