Domanda

This is probably a stupid question, I think I'm having a mental block.

I want to use Paypal's express checkout for buyers to make purchases with as few steps as possible (also using Paypal's optional account feature). The problem is: for me to direct the user to paypal, I will need to have calculated shipping costs, which depends on the country they're in. Obviously I cannot know this unless I have been told one way or another. What are common solutions to this problem?

Ideas:

  1. Use their IP address. Not reliable - various types of proxies, VPNs, anonymizers etc.
  2. Have the user select their country from a drop-down box before I redirect them to paypal
  3. Force them to log in using Paypal's Identity service before calculating postage
  4. Use 1. or 2. and once payment is received, if country is different to expected,
    • Refund buyer the difference in postage cost or request an additional payment. (Hardly ideal)
  5. Similar to 4., instead of "Sale Payment Action for Express Checkout" Use 1. or 2. in conjunction with one of Paypal's delayed express checkout payment methods and if necessary reduce or increase the amount charged:
    • Authorization Payment Action for Express Checkout
    • Order Payment Action for Express Checkout

I'd like to know what solutions other developers have chosen - maybe I've missed an idea. As a consumer, I cannot remember seeing solutions to this.

È stato utile?

Soluzione

The general way people do this is simply to use GetExpressCheckoutDetails to obtain the buyer's shipping address, apply any shipping/tax as necessary, and display a final review page on your site that the user would confirm before calling DoExpressCheckoutPayment.

If you want to eliminate the additional review page (PayPal's and then your own) you can use the Instant Update API.

In this case you would include an additional parameter on the URL when you redirect to PayPal (useraction=commit) and this will change the button on the PayPal review page to say Pay instead of Continue.

Also in your SEC request you'll include the CALLBACK parameter and include a URL to your callback listener. PayPal's review page will POST the buyer's shipping address to this callback URL so that you can receive the data, calculate shipping and tax accordingly, and send a response of those options back to the PayPal review page. This will populate the PayPal review page's drop down menu for the shipping option and the user can choose accordingly.

This method allows you to utilize the PayPal review page entirely and finalize the payment there so that the only thing the user sees once they're returned to your site (after you call DECP) is a final thank you / receipt page.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top