Search code examples
paypalpaypal-rest-sdk

Calculating sales tax for digital goods with REST SDK


I'm trying to update our website to use the new PayPal v2 API, and have struck a problem handling local sales tax.

We sell digital goods only, so I want to set the shipping_preference to NO_SHIPPING. But when I do that, we no longer get a callback to onShippingAddressChange to tell us the user's country, so we have no way to know whether to add sales tax on or not.

What's the recommended process for handling this situation?


Solution

  • Optionally have the payer select a starting country near or above the PayPal button, or base it on their IP.

    When onApprove is triggered, you can get the order's payer country before doing the capture and do a patch API call ("update order") if necessary.


    To show a new total to the payer before capture, you can add an additional order review step. Either set the user_action to CONTINUE in the API, or specify &commit=false when loading the JS SDK.

    The last button at PayPal will change from "Pay Now" (default for JS SDK integrations) to "Continue to Review Order".

    Correspondingly, when onApprove is triggered, rather than immediately doing the capture first show the revised total to the payer with something for them to confirm the payment that they captures the order.