问题
First, i don't 100% sure that this is the right place for this question. So if it is not let me know i will remove this question for here.
I am using PAYPAL REST API to allow user select a product and pay for it.
I am looking for an option to set a shipping fee by user's country (shipping address). For example if shipping to Israel fee is 3$ If shipping outside Israel fee is 5$
But i don't want him to input his shipping address in my website.
In Paypal, user can have several saved shipping address. I would like to change the shipping fee based on his selected pre-defined shipping address.
Can this be done?
I have looked in the Paypal API and I saw the option of sending shipping address and fee to Paypal REST API, but again i don't want him to input the shipping address in my website.
回答1:
As you do not know for sure where the customer is going to ship the item, you obtain the shipping address from PayPal after the customer has authorized the payment. The REST API will return the payment details to you, including the shipping address.
Take that shipping address and have your system determine the shipping amount. Display this to the customer on a confirmation page on your site and when the customer agrees to the amount, run the /execute command, and include a new amount object with the shipping amount. You will then complete the payment with the new total with the correct country shipping.
来源:https://stackoverflow.com/questions/23464542/set-shipping-fee-based-on-users-shipping-address-paypal-rest-api