6

In our paypal integrated website,We have used Paypal buttons with a fixed amount such as $5 button. Now we need to add sales tax to the paypal. right now we are planning to calculate sales tax from our own logic and we need to set this calculated amount for the paypal purchase. that means different amount will come for different users based on the location. How can we set this dynamic amount in payPal instead of fixed rate payPal button? Also can we show the split up in the paypal check out page like Product amount,Sales tax amount, total amount etc if we are going with our custom logic for sales tax calculation?

Note: we know there is a separate sales tax calculation in paypal based on the tax rate added in the stripe account. We are not planning to add this feature becuase we have to update the tax rate periodically in the stripe account.

Roshil K
  • 2,583
  • 28
  • 38

1 Answers1

0

The answer depends on your PayPal integration. If you integrate the latest Standard Checkout (recommended), you will be creating two backend routes on your server that call the /v2/checkout/orders API (one to create the order, one to capture it after approval and receive the success/failure response)

If you show the PayPal buttons as early in your flow as possible (recommended), the payer will not have to waste time manually entering their address into your site, since it can be selected from pre-filled information at PayPal, and this reduction of checkout friction increases sales so it's a very good thing.

But then, if you need to use that address to calculate a new shipping/tax total, there are two possible methods:

  • Add a review step after approval and before capture, which calculates the new amounts and shows them to the payer awaiting final confirmation on your site (and maybe even allow selection of different shipping methods). Since there will be a review step, in order creation set payment_source.paypal.user_action:"CONTINUE" to change the text of the last button at PayPal accordingly. After confirmation, you use the Update Order patch operation to set new totals before capture. If you do business in Europe, PSD2 rules can cause PayPal to return a PAYER_ACOUNT_REQUIRED API response, indicating the payer needs to go back to PayPal to give another approval for a higher total to be captured.

  • The alternative method is to implement an onShippingChange callback function]4 to do the patch while the PayPal window is still open, thus saving some steps. However, the disadvantage of adding this callback is that the black "Debit or Credit Card" button will no longer expand inline card forms within your site, but rather open a window checkout (same as the yellow PayPal button).

Preston PHX
  • 27,642
  • 4
  • 24
  • 44