Set the shipping cost depending on the address from the user. Paypal REST API

Firstly, I am not 100% sure that this is the right place for this question. Therefore, if this does not allow me to know, I will delete this question here.

I use the PAYPAL REST API to allow the user to select a product and pay for it.

I am looking for an option to set the cost of delivery by country (delivery address). For example, if shipping to Israel is $ 3; if shipping outside of Israel is $ 5

But I do not want him to enter his delivery address on my site.

In Paypal, a user can have several saved delivery addresses. I would like to change the shipping fee based on his chosen predefined shipping address.

Can this be done?

I looked at the Paypal API, and I saw the ability to send the mailing address and fees to the Paypal REST API, but again I do not want it to enter the delivery address on my website.

+4
source share
1 answer

Since you do not know exactly where the customer will ship the goods, you will receive a shipping address from PayPal after the customer has accepted the payment. The REST API will return your payment details, including the delivery address.

Take this shipping address and determine the shipping amount. Show it to the client on the confirmation page on your site and when the client agrees with this amount, run the / execute command and include a new object with the delivery amount. Then you complete the payment with the new amount with the correct delivery in the country.

+3

Source: https://habr.com/ru/post/1539212/


All Articles