Paypal: technique to obtain buyer's country for establishing postage prices without introducing extra steps - paypal

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:
Use their IP address. Not reliable - various types of proxies, VPNs, anonymizers etc.
Have the user select their country from a drop-down box before I redirect them to paypal
Force them to log in using Paypal's Identity service before calculating postage
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)
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.

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.

Related

What's the difference between PayPal buttons and PayPal Express Checkout?

What's the difference between PayPal buttons and PayPal Express Checkout?
The second one seems more complicated than the first one to integrate in a web site. When I should consider to use Express Checkout rather than Buttons? What are the advantages?
PayPal Standard buttons are indeed quick and easy, but they are limited. One of the biggest issues with it is with regard to Guest Checkout, which allows non-PayPal account holders to pay with a credit card without creating an account.
With Standard buttons this is browser cookie based, so if anybody has ever signed in to a PayPal account using the browser in use, then the cookie will trigger and assume that the user will be logging in to PayPal. This causes the guest checkout option to be less prominent, and buyers often miss it, which results in lost sales.
Express Checkout uses the APIs which gives you more flexibility, including the ability to force the Guest Checkout experience if you want to regardless of any browser cookies. This can lead to increased conversion rates.
Another thing to consider is that with Standard buttons there is no guarantee the user will make it back to your site. Even if you have Auto-Return enabled in the PayPal account there is a delay, and the user could simply close their browser before they are sent back to your site. With Express Checkout the user has to return to your site before the process can be completed, so this gives you the ability to tie more post-transaction processing procedures into your checkout flow.
Adding PayPal buttons to your website eliminates the need to enter your shipping address. You only verify the purchase details and confirm by the user and it gets supplied by PayPal but in case of Express checkout customer still need to supply their shipping address .
Also in case of express checkout you make API call initially to PayPal and in turn PayPal gives you token id for the payment you are going to make and you use the token(which is unique for every payment) to subsequently authorize and capture the amount from PayPal account once the customer confirms the payment after logging into PayPal account.

Am I allowed to fire DoExpressCheckoutPayment automatically for PayPal Express Checkout?

My client wants us to automatically return the user to PayPal during the Express Checkout process, effectively clicking the "confirm and pay" button at the review stage if the transaction price has not changed during the process.
I can do this, but I am wondering if it is against the PayPal terms of service as it seems to me that this could be used to trick the user into paying more than they are expecting.
I have searched on the PayPal site and had a Google, but found nothing saying it is against their terms. Does anyone else do this or know whether it's acceptable practise?
You mean that you want to change the amount in the DO Express API call against the amount that you specified in SET EXPRESS API call . Yes you can change the amount in the Do Express API call because most of the time Merchant needs the shipping address information from the buyer's PayPal account. And once they get the shipping address via the Get Express Checkout API call ,shipping fee is added to the authorized amount and then DO Express API is called .
That is just fine yes, and for those instances you should set useraction=commit in your redirect URL to PayPal. This will make the button on the PayPal review page say "Pay" instead of "Continue" so the user knows that is the final review. Then back on your site you can make the call to DECP and simply display the final receipt / thank you page when that's done.

Handling unknown shipping costs via PayPal Express nvp API

Can some confirm something for me; I've searched PayPal's docs and just can't find the answer.
If calling SetExpressCheckout with the parameter 'TOTALTYPE'= 'EstimatedTotal', how much headroom does PayPal allow for finalizing the transaction?
For example, someone carts an item that has a cost of $1. They click PayPal Express and get sent to PayPal to authorize an estimated amount of $1. Then they return to the merchant site and now that their address is known, the cart says shipping is +$20.
Is that acceptable? I'd really like to understand the groundrules on this, as I don't want to risk any authorization errors due to insufficient order amount when making the request.
Well, I have to answer my own question here. I called PayPal. The answer is "it's handled, don't worry about it". They would rather not publish the details on their proprietary algorithm because there are fraud tests, etc. going on -- but said it is a key design point for them and it is absolutely handled no worries.
If you are not passing a SHIPPINGAMT variable with the SetExpressCheckout call, then we will not display or "calculate" shipping on the PayPal page. When they are transferred to the PayPal page the customer is not authorizing the payment per se, rather they are selecting their payment method/funding source to be used when the DoExpressCheckout call is passed.
Only after the customer is transferred back to your page, and the final order total is known and passed via the DoExpressCheckout is the payment initiated. The difference between the total amount in the Set call and the Do call does not matter. Perhaps the agent with whom you were speaking with under the impression of an authorize/capture structure being in place. This will limit the final capture amount to the authorized amount +/- 20%.
Of course this is all turned on its head if you are passing the USERACTION=COMMIT variable which will "finalize" the payment on the PayPal page, while the DoExpress call is run transparently on your end. This will change the text on the button on the PayPal page to "Pay Now" instead of "Continue: You're almost done. You will confirm your payment on yourwebsitehere.com"
I hope this helps!

Paypal express checkout API collect billing info

Is it possible to collect user billing detail after successful payment how?
You can collect any information you want at any time, but you might be slightly limited based on PayPal features you're using.
For example, if you're using a standard payment button you could setup a form for them to fill out on your return page after they've completed. There is no guarantee they'll even make it to this page, though, and even if they do they may choose not to fill out your form. As such, it's generally recommended to collect any necessary data prior to sending the user over to PayPal for payment.
That said, one of the benefits of using PayPal for buyers is that they don't have to fill in forms and don't have to share billing information with you, so you might actually lose sales if you do that.
PayPal will send you an address via IPN (or GetExpressCheckoutDetails, for example) but they only consider that a shipping address. If I'm working with a system that requires both a billing and a shipping I usually just use that same address for both.

PayPal SetExpressCheckout vs. payment buttons

What is the benefit of calling PayPal API SetExpressCheckout method to get a payment link and forwarding a customer there instead of using payment buttons?
The PayPal buttons can be modified by the visitor's browser client. It is just basic HTML. All of the variables to place the order can be manipulated by the customer. For instance, it takes 3 seconds to change the order total from $900 to $1.
Using the API, you tell PayPal to create an incomplete transaction for a certain amount, with certain information, that can then be referenced/completed later and there is no way (short of expert hacking) to change the order. Instead of trusting the visitor's browser, PayPal trusts your server.