Anonymous user can't finish checkout using PayPal Express Checkout, when shipping rates exist

Created on 21 May 2025, about 9 hours ago

Problem/Motivation

The moment an anonymous user wants to buy a product, he presses the EC Button on the Cart Layer, but at this stage, most order adjustments are not set yet (e.g. shipping rate). So the PayPal Modal will appear asking for to confirm the purchase of product A for amount x. But amount x does not include any adjustments. E.g. the shipping amount of y is missing. So we agree on amount x, but on the "complete purchase" step, the paypal transaction is now amount x + shipping amount y, which leads to an error being thrown, as PayPal would like to reconfirm the updated purchase, as they are not allowed to overcharge according to the "Overcapture requirements (PSD2)". The reconfirmation link is not shown to the user, only an error (that should be fixed in 🐛 Needs to redirect users on UNPROCESSABLE_ENTITY > PAYER_ACTION_REQUIRED - No checkout possible Active ).

Steps to reproduce

  1. An anonymous user buys a product through the express checkout cart button (we have no information on their address yet)
  2. He approves to pay the product costs via PayPal
  3. The user gets redirected to the shop. The shop now knows the address of the user (through by PayPal)
  4. The shop can now calculate the shipping rate based on the address given and patch the PayPal auction.
  5. When trying to finalize the purchase (capture the payment), PayPal returns a "PAYER_ACTION_REQUIRED" response containing a "payer-action" link, because the user approved the costs of the product only, not the costs of the product + shipping cost.
  6. The "payer-action" link redirects the user to PayPal, where he needs to reconfirm the new updated amount.

Proposed resolution

We should try to find a way to communicate between Drupal and PayPal, similar to how the stripe EC integration implemented in Stripe Express Checkout Element Integration Active does it:

Stripe (through AmazonPay for example) communicates back and forth with the server, so once AmazonPay has the address, they pass the address back to the server and the server can calculate the shipping rates based off the address given and send the available rates to stripe / amazon pay.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

PayPal EC

Created by

🇩🇪Germany Grevil

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024