Reputation: 501
I am working on an application which supports three languages - English, German a French. There is used Stripe for payments and it is used in a way we have our custom checkout screen. The language of UI is set automatically by browser preferences...
The good thing is that when there is some validation error coming from Stripe elements on frontend it is automatically in the language according to browser preferences.
The bad thing is that when I make a request from backend to Stripe API and there is some error it is always in English. So I need to check all possible error codes and manually assign them a description in proper language (locale can be different in every request from frontend) and then I can send it to the frontend.
The question is - is there any way how to send a request to Stripe API + locale as the option? In order to get an error message in the proper language...
Upvotes: 3
Views: 3040
Reputation: 1146
The Stripe API Errors aren't localized to a language (other than English). If you want to localize those, you'd need to intercept them, parse them, and return something else (in the appropriate language). There are actually projects out there that can help you with this though--
https://github.com/ekosz/stripe-i18n
Upvotes: 3