Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for EUR currency code before adding SEPA payment method type #3233

Merged
merged 1 commit into from
Oct 27, 2021

Conversation

brianyu28
Copy link
Contributor

Fixes #3232

Changes proposed in this Pull Request

Fixes a bug whereby using a saved card with UPE checkout results in a "We're not able to process this request" error.

The reason this bug happens is because as of #3164, we now add sepa_debit to the available UPE payment methods. This gets added to payment_method_types in the request to create and confirm a payment intention, but results in the following error from Stripe for any non-Euro payment:

The currency provided (usd) is invalid for one or more payment method types on this PaymentIntent. The payment method type sepa_debit only supports the following currencies: eur. Either correct the provided currency, or use a different PaymentIntent to accept this payment method type. (invalid_request_error)

This PR checks that the currency_code is eur before adding sepa_debit to the list of payment method types to avoid this error.

Testing instructions

  1. Enable UPE, set store currency to USD.
  2. Make a purchase using a saved card.
  3. Verify that the purchase completes successfully.

  • Added changelog entry (or does not apply)
  • Covered with tests (or have a good reason not to test in description ☝️)
  • Tested on mobile (or does not apply)

Post merge

Copy link
Contributor

@RadoslavGeorgiev RadoslavGeorgiev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good, and test well. Thank you, @brianyu28! 🎉 :shipit:

FWIW, I made the initial change while trying to enable purchases with a saved SEPA debit account. At the time I definitely didn't expect the observed behavior: Allowing an additional payment type to change the required currency.

This got me worried, so I tried other new PMs and scenarios:

  • Only credit cards and SEPA direct debit allow the payment method to be saved, and need to be considered here, which is done already.
  • All other payment methods (P24, iDeal, Sofort, giropay, and bancontact) cannot be saved during checkout or though the My Account page. This line cannot affect them either, because intents are used differently there.

Tested scenarios, in this order:

  • ✅ Simple purchase with a credit card (*4242)
  • ✅ Simple purchase with SEPA debit (AT AT611904300234573201)
  • ✅ Saved PM purchase with card (from above)
  • ✅ Saved PM purchase with SEPA debit (from aboce)
  • ✅ Purchase a free trial subscription with SEPA (saved account from above)
  • ✅ Renew subscription with SEPA (same subscription)
  • ✅ Add another SEPA payment method (again AT611904300234573201).
  • ✅ Add CC payment method with 3DS verification (*0446).
  • ✅ Purchase a normal subscription with the newly saved CC with 3DS verification.
  • ✅ Renew a normal subscription with the newly saved CC.
  • ✅ Perform a payment with one of the redirect methods, in this case Bancontact.

@thracefulton
Copy link

Hi there,

I've got a merchant in 4740622-zen who is sporadically seeing this error: Error: The PaymentMethod provided (sepa_debit) is not allowed for this PaymentIntent. Please attach a PaymentMethod of one of the following types: card. Alternatively, update the allowed payment_method_types for this PaymentIntent to include "sepa_debit".

Could this be related or should I be looking at another potential cause/issue?

@TheSashX
Copy link

Hi there,

I've got a merchant in 4740622-zen who is sporadically seeing this error: Error: The PaymentMethod provided (sepa_debit) is not allowed for this PaymentIntent. Please attach a PaymentMethod of one of the following types: card. Alternatively, update the allowed payment_method_types for this PaymentIntent to include "sepa_debit".

Could this be related or should I be looking at another potential cause/issue?

We have the same problem:
Error: The PaymentMethod provided (sepa_debit) is not allowed for this PaymentIntent. Please attach a PaymentMethod of one of the following types: card. Alternatively, update the allowed payment_method_types for this PaymentIntent to include "sepa_debit".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't checkout when using a saved card with UPE
4 participants