Applying Taxes with Payments REST API

jshelto
New Community Member

When creating a payment with the Payments REST API, if you do not pass a shipping address, it is possible for the customer to update their shipping address in the paypal pop-up window before completing their payment. If they do this, how can I execute a callback to my server to update the amount in taxes that they should be charged based on their updated shipping address? Ideally, they complete their purchase in the pop-up window without having to be redirected to a review page on my site.

Login to Me Too
1 REPLY 1

MTS_Andre
Moderator
Moderator

Hi, in REST you first create the payment and then you need to call the execute method to execute it. In between you can call the

GET /v1/payments/payment/payment_id

to get the payment details and if the address is changed then you have 2 options:

 

1) before to call POST /v1/payments/payment/payment_id/execute call PATCH /v1/payments/payment/payment_id to amend the tax value.

 

2) when you call POST /v1/payments/payment/payment_id/execute, pass the "transaction" object with an amended tax value

 

References:

Get details: https://developer.paypal.com/docs/api/payments/#payment_get

Update PATCH : https://developer.paypal.com/docs/api/payments/#payment_update

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.