Set shipping fee based on user's shipping address Paypal REST API

允我心安 提交于 2019-12-05 02:30:42

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!