Add localization to Flow for mobile
Beta
Last updated: April 23, 2025
By default, the language displayed on Flow is derived from the locale set in the payment-session
request.
Alternatively, you can use the locale
configuration option to manually set the language in the configuration. For example:
1val configuration = CheckoutComponentConfiguration(2context = context,3paymentSession = paymentSession,4publicKey = publicKey,5environment = environment,6locale = Locale.En7)
The following left-to-right (LTR) and right-to-left (RTL) languages are supported:
Language | Android locale | Language type |
---|---|---|
Arabic |
|
|
Chinese (China) |
|
|
Chinese (Hong Kong) |
|
|
Chinese (Taiwan) |
|
|
Danish |
|
|
Dutch (Netherlands) |
|
|
English (United Kingdom) |
|
|
Filipino |
|
|
Finnish |
|
|
French |
|
|
German |
|
|
Greek |
|
|
Hindi |
|
|
Indonesian |
|
|
Italian |
|
|
Japanese |
|
|
Malay |
|
|
Norwegian Bokmål |
|
|
Portuguese |
|
|
Spanish |
|
|
Swedish |
|
|
Thai |
|
|
Vietnamese |
|
|
You can customize the default text translation for a specific language by providing your own strings.
- Create a
translations
object and specify thelocale
for which you want to provide custom translations. Within the locale object, include the translation keys you want to customize, along with their values. For example:
1val translations = mapOf(2Locale.En to mapOf(3ComponentTranslationKey.FormRequired to "Please provide this field",4ComponentTranslationKey.PayButtonPay to "Pay Now",5ComponentTranslationKey.PaymentDeclinedTryAgain to "Payment failed, please try again",6)7)
- Pass the
translations
object when you create the instance ofconfiguration
.
1val configuration = CheckoutComponentConfiguration(2context = context,3paymentSession = paymentSession,4publicKey = publicKey,5environment = environment,6translations =translations,7)
You can customize the following default text:
Translation key | Default text | Description |
---|---|---|
| Address line 1 | The label for the first line of the address. |
| Address line 2 | The label for the second line of the address. |
| Add billing address | The label for the button to add a billing address. |
| Town or City | The label for the city input field. |
| Country | The label for the country selection field. |
| Select Country | The title for the country selection screen. |
| Edit address | The button text for editing an existing address. |
| State or province | The label for the state/province input field. |
| ZIP or postal code | The label for the ZIP/postal code input field. |
| Card | The label for the card option. |
| Use shipping address as billing address | The label for the checkbox to use the shipping address as the billing address. |
| Cardholder name | The label for the cardholder name input. |
| Card number | The card number label for the card number input. |
| Card number is incomplete | The error message displayed when the card number is incomplete. |
|
| The error message displayed when the card number is from an unsupported card scheme. |
| Expiry date | The label for the card expiry date input. |
| Expiry date is in the past | The error message displayed when the card expiry date is invalid. |
| Expiry date is incomplete | The error message displayed when the card expiry date is incomplete. |
| MM | The message describing the format for the card expiry month input. |
| YY | The message describing the format for the card expiry year input. |
| Security code | The security code label for the card security code (CVV) input. |
| Security code is incomplete | The error message displayed when the security code (CVV) is incomplete. |
| CVV | The message describing the format for the card security code input. |
| Add address | The button text for adding an address. |
| Incorrect email format | The validation message when an email address is in an invalid format. |
| Exceeds {VALUE} character limit | The validation message when input exceeds the maximum character limit, where {VALUE} is replaced with the actual limit number. |
| First name | The label for the first name input field. |
| Insufficient characters | The validation message when input doesn't meet minimum character requirements. |
| Last name | The label for the last name input field. |
| No matches found | The message displayed when a search returns no results. |
| Optional | The label indicating that a field is not required. |
| This field is required | The validation message displayed when the customer leaves a required field blank. |
| Search | The placeholder text for search inputs. |
| Try searching with another term. | The suggestion shown when no search results are found. |
| Confirm | The label for the Confirm button. |
| Pay | The call to action displayed on the pay button. |
| Payment complete | The message displayed when the payment is completed. |
| Payment processing | The message displayed while the payment is processing. |
| Incorrect details – try again or use another payment method | The error message displayed when the customer provides invalid payment details. |
| Try another payment method | The error message displayed when the |
| Payment declined – try another payment method | The error message displayed when your integration is misconfigured for the chosen payment method. |
| Not enough funds – try another payment method | The error message displayed when the customer does not have sufficient funds to complete the transaction with their chosen payment method. |
| Payment declined – try again or use another payment method | The fallback message displayed when the chosen payment method declines the transaction. |
To add support for locales and languages not natively supported by Flow for mobile, provide the locale as an object of key-value pairs within the same translations
object you used for custom translations. For example, to add support for US English (en-US
):
1val translations = mapOf(2Locale.Customized(“en-US”) to mapOf(3ComponentTranslationKey.PayButtonPay to "Tap to Pay",4)5)67val configuration = CheckoutComponentConfiguration(8context = context,9paymentSession = paymentSession,10publicKey = publicKey,11environment = environment,12locale = Locale.Customized(“en-US”),13translations = translations14)
Information
If you are missing a translation for the locale you provide, Flow will attempt to fall back to the language of the specified locale. If the locale language is not supported, Flow will fall back to English.