Skip to content

Changing language after creating Stripe payment intent causes error #3653

@MichalMoravik

Description

@MichalMoravik

Describe the bug
Changing locale (switching language in the storefront) passed to createStripePaymentIntent after payment intent is generated causes this error:

Keys for idempotent requests can only be used with the same parameters they were first used with. Try using a key other than 'TDU7BNTV66K1MU65_5200' if you meant to execute a different request.

I think the issue could be: the idempotent key does not change but the language code does (here in the code) which I think causes this.

To Reproduce
Steps to reproduce the behavior:

  1. Make an order and go to checkout
  2. Run createStripePaymentIntent to get a new payment intent
  3. Switch storefront locale (in my case /sk/pokladna -> /en/checkout), which causes page to refresh and generate the paymentIntent once again, but this time with a different locale ?languageCode=${locale} passed in the URL
  4. Gets the error above

Expected behavior
I expect this to not error, similarly as when I get to the payment step, generate payment intent, and then refresh the page myself (without changing language) - it works just fine (as, I suspect, no metadata has changed). Or if I change the content of my order lines (but in this case the idempotency key changes, so no error) and then come back to the payment stage.

Environment (please complete the following information):

  • @vendure/core version: 3.2.4
  • Nodejs version: v22.14.0
  • Database (mysql/postgres etc): postgres 16

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions