简体   繁体   中英

PayPal - update shipping information after SetExpressCheckout

The following is a question related to the PayPal API. I am using PayPal Express Checkout, I am using this with .NET.

With our software, there are two different ways that a user can checkout using PayPal. The one is that they select it as a payment option from the checkout page. If they get there this way, they will have already entered their shipping information and selected their shipping method, and all of that (shipping information, shipping total, shipping discounts) is passed into PayPal via the SetExpressCheckout function. They are then redirected to an on-site confirmation page where they click a button to confirm their payment (which calls DoExpressCheckoutPayment) with the amount being paid. This all works, but this page also gives the user the ability to change their preferred shipping method before hitting confirm. Changing the shipping method changes the shipping total and may also affect the shipping discount and tax total. I cannot find a way to actually update this information in PayPal before confirming the order (via DoExpressCheckoutPayment). In this case, I am passing an amount into this function that is different from the order total originally given via SetExpressCheckout.

The other way that a customer can checkout is that he can click the PayPal checkout button on the cart page. If the user checks out in this way, he will not even select a shipping method until he reaches the confirmation page, so the initial SetExpressCheckout call will not be sent the shipping total and discounts at all. Aside from that, everything is the same in this case as in the first one. It updates the shipping method and totals in our software, and it sends the final amount back to PayPal.

First of all, I was wondering if there actually is any way to update shipping total, shipping discounts, tax total, etc. after SetExpressCheckout has already been called. I don't see these values being passed into DoExpressCheckoutPayment, nor do I see another method to update. If that is not possible, is it sufficient to just pass in a different payment amount than the total sent via SetExpressCheckout, or will that cause problems? Or is there a better way to do this that I am not thinking of?

You are fine. ExpressCheckout is designed to get the buyer's approval (and assess the buyer's ability to pay) based on an approximate cart of goods sent at SetEC time, then return the buyer to the seller's website and potentially alter the cart (such as expedited shipping or upselling for additional purchases) before DoEC is called. This should all work. You just send a different final amount in the DoEC call.

There are a couple of things to be aware of:

  • if the total varies significantly there is more chance of the payment being refused at DoEC time. Eg the buyer may test out OK for $80, but if you then call DoEC with $300 PayPal may require that the buyer return to PayPal to address their ability to pay (eg change or add funding sources). Generally within 20% you should be safe. PayPal has specific return codes that indicate that you should send the buyer back to them (via another redirect) to correct issues/re-do funding source selection & approval.

  • if you told PayPal one shipping address but actually ship the goods somewhere else you will probably not be eligible for Seller Protection. Certainly if the modified address is new to that PayPal account that's something PayPal would factor into in their risk assessment, so not providing that info would invalidate PayPal's guarantees.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM