Fix express checkout PayPal payments failing with "paypal not allowed for this PaymentIntent" - #8197
Merged
Merged
Conversation
Express checkout PayPal clicks created a paypal PaymentMethod but labelled it StripePaymentRequestButton, so payment-api built a card-only PaymentIntent and the payment failed. Check the PM type first so paypal is routed correctly from both the Payment Element and Express Checkout Element, and log unexpected PM types for diagnosability.
Contributor
Contributor
|
Size Change: 0 B Total Size: 1.91 MB ℹ️ View Unchanged
|
Contributor
Extract getStripePaymentMethod to a testable function and add comprehensive tests. Fix Express Checkout PayPal routing by checking PaymentMethod type before wallet type, ensuring PayPal payments are correctly routed through StripePaypal flow regardless of UI flow. Log unexpected PaymentMethod types and inconsistencies for diagnosability.
Member
|
The bug can be reproduced with the following steps:
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review issues remain, and the changes include relevant test coverage.
Pull request overview
Fixes one-time Stripe payment routing by classifying payments from the actual PaymentMethod, preventing PayPal payments from being treated as card payments.
Changes:
- Maps PayPal, Apple Pay, other wallets, and cards appropriately.
- Adds mismatch and unexpected-type logging.
- Adds unit coverage for payment-method mappings.
File summaries
| File | Description |
|---|---|
support-frontend/assets/pages/[countryGroupId]/components/oneTimeCheckoutComponent.tsx |
Uses Stripe PaymentMethod data for payment routing. |
support-frontend/assets/helpers/forms/paymentIntegrations/oneOffContributions.ts |
Implements payment-method classification and logging. |
support-frontend/assets/helpers/forms/paymentIntegrations/oneOffContributions.test.ts |
Tests wallet, PayPal, card, and unexpected payment types. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
tomrf1
approved these changes
Sep 18, 2026
tomrf1
left a comment
Member
There was a problem hiding this comment.
Looks good!
I tested in mobile in CODE - card, paypal + google pay are fine.
The test case for the bug (see other comment) now works fine
|
Seen on PROD (merged by @juabara 10 minutes and 4 seconds ago)
Sentry Release: support-client-side, support |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PaymentMethodwas sent to payment-api asStripePaymentRequestButton.PaymentMethodobject rather than React UI state.Root cause
The Payment Element and Express Checkout Element share the same Stripe
Elementsinstance. A user can select PayPal in the Payment Element and then interact with Google Pay in Express Checkout.In that state, Stripe can return a PayPal
PaymentMethodwhile the React state indicatesStripeExpressCheckoutElement. The previous code prioritised that UI state and labelled the PaymentMethod asStripePaymentRequestButton, causing payment-api to create a card-only PaymentIntent. Stripe then rejected the PayPal PaymentMethod:PR #8173 improved the PayPal detection for the Payment Element path, but its check remained after the Express Checkout branch and was therefore bypassed in this mixed state.
Changes
StripePaypalStripeApplePayStripePaymentRequestButtonStripeCheckout