Changing Shipping Address on Order Confirmation Step in PayPal Express Checkout - paypal

I am using the Express Checkout API to accept payments for my online store. The payment flow is as follows:
1) User adds Item to Cart
2) User proceeds to PayPal
3) User enters or selects existing shipping address, confirms, and is redirected to order confirmation step
4) Order Details such as Shipping Address are retrieved from PayPal using GetExpressCheckoutDetails.
5) On the order confirmation step (prior to DoExpressCheckoutPayment), user has the option to change the shipping address returned by PayPal. If user changes the shipping address, I need to recalculate the shipping cost to this new address, and submit the new shipping cost, as well as the new address back to PayPal
6) I am attempting to do this as part of the DoExpressCheckoutPayment payment call, using PAYMENTREQUEST_0_SHIPTONAME etc, but the shipping address within the transaction details does not change. (Likely because these are deprecated) Instead, the address chosen or entered on PayPal remains.
How can I submit a new shipping address to PayPal without having the user re-enter the transaction funnel from the beginning?

The shipping parameters in DECP are not deprecated. The documentation is a little bit misleading. It's the old version of those parameters, prior to when they added the ability to do parallel payments to EC, that are deprecated.
So, for example, SHIPTONAME is deprecated. Instead, you should now use PAYMENTREQUEST_n_SHIPTONAME like you have.
That said, whatever you send in the DECP request should be carried over to PayPal and end up being what is used for the payment's shipping address. In fact, if you don't include an address in DECP it shouldn't end up as part of the payment details in my experience.
If you want to provide a sample of the API requests during a checkout I'll be happy to take a look and see if I can figure out where you're going wrong.

Related

PayPal Address_Override not working

I'm testing a PayPal integration on the sandbox using cmd=_express-checkout
(https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&useraction=commit&=token=..)
The store I'm working on calcs shipping costs from delivery address before initialising the PayPal transaction, so we need to display the shipping address as entered on our client's site and not the default address held by PayPal for the buyer.
I've tried sending address_override=1 along with the address parameters specified here (https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/) but the [Ship To] displayed is still that of the test account default address.
address_override=1
useraction=commit
token=XXXX
address1=XXXX
city=XXXX
state=CA
country=US
zip=XXXXX
first_name=XXX
last_name=XXX
Am I missing something obvious or should I be doing it differently?
Thanks.
Looks like you have set NOSHIPPING=0.
Please change your request and set NOSHIPPING=2
NOSHIPPING
Determines whether PayPal displays shipping address fields on the PayPal pages. For digital goods, this field is required, and you must set it to 1. Value is:
0 — PayPal displays the shipping address on the PayPal pages.
1 — PayPal does not display shipping address fields and removes shipping information from the transaction.
2 — If you do not pass the shipping address, PayPal obtains it from the buyer's account profile.
Another one thing is for Express checkout integration you need to refer the documentation in here:
https://developer.paypal.com/docs/classic/api/merchant/SetExpressCheckout_API_Operation_NVP/
The link that you have provided earlier is for paypal payment standard integration.
This will requires us to pull the log.
Kindly create an MTS ticket at our Technical Portal (https://www.paypal-techsupport.com/) and provide the EC token for further checking.

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

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.

the functionality to update the paypal shipping address?

During express checkout via Paypal a shipping address is established and then the user comes back to the checkout page in , if they then change their shipping address that is not being updated back to Paypal. How can the new shipping address can be configured in PayPal by changing shipping address from billing page??
When the user comes back to your site you have that option of displaying a final review page. It sounds like you're doing that and allowing the user to make changes to the shipping address at this point. In order to pass that shipping address into the final payment you just need to make sure that address gets included in the DoExpressCheckoutPayment request.

How do I prevent the user to change the shipping address? Or instant update callback for Payflow Pro Express Checkout

I'm using Payflowlink Pro Express Checkout
Flow:
User select items on merchant site.
User clicks buy and fill shipping address.
Server get rates from USPS and FedEx for selected items.
User selects desired postal service with defined rate.
Server calls paypal to setup transaction with selected shipping rate.
User on paypal where he or she able to change shipping address, but shipping rate is already calculated for address what he inputted on merchant site.
I've found a solution of my problem only for classic API (Instant update callback), but not for Payflow Pro Express Checkout
Like a part of solution, user'll be warned about this situation on merchant site, but.. How do I prevent the PP user to change the shipping address or tell me please if it is possible to use instant update callback for Payflow Pro Express Checkout?
Try using the ADDROVERIDE variable with a value of 1. Doing that tells PayPal to use the shipping address you provided and not the address the buyer has set in their PayPal account.
The ADDROVERIDE and the shipping variables are available in the Express Checkout for Payflow Pro guide.
Sorry, I wanted to add this as a comment to the above, but my reputation is < 50
For some reason I couldn't get NOSHIPPING=1 and ADDROVERIDE=1 to prevent paypal asking for the shipping address; It may be due to me not supplying the address to PayPal in the first place.
However, 'no_shipping=1' does prevents PayPal asking the user for the shipping address (for me at least)
I think there may be two different solutions based on certain scenarios, so if one is not working try the other.

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.