Change the drop-in's text
Replace the texts the drop-in shows, to translate the sheet or to match your app's wording.
PayDropInStrings holds the texts displayed in the drop-in. All default strings are in English. Supply localized values from your app (for example, from your string resources) to support other languages, and pass them as the drop-in's strings.
Placeholders in braces, such as {amount} and {method}, are replaced where the defaults below show them. Card brand names aren't configured here, and the 3DS challenge screen's title comes from a string resource in pay-threeds.
val strings = PayDropInStrings(title = getString(R.string.checkout_title), pay = getString(R.string.checkout_pay))
val dropIn = PayDropIn(checkout, PayDropIn.Configuration(strings = strings))Parameters
The sheet and its methods
These texts cover the sheet's title, its close button, and the list of methods.
| Parameter | Type | Required | Description |
|---|---|---|---|
title | String | No | The sheet's title in a setup session. At checkout, the sheet has no title. It shows your merchantDisplayName and the total. Default: Payment. |
payoutTitle | String | No | The title in a payout session, instead of title. Default: Payout method. |
close | String | No | The close button's accessibility label. Default: Close. |
payWith | String | No | Above the methods. Default: Pay with. |
getPaidWith | String | No | Above the methods in a payout session, instead of payWith. Default: Get paid with. |
card | String | No | The card's row. Default: Card. |
orSeparator | String | No | Between the Google Pay button and the other methods. Default: or. |
methodNames | Map<String, String> | No | Row titles by payment method type, for example mapOf("ideal" to "iDEAL"). They come before the names the drop-in finds itself. Default: none. |
Without a name in methodNames, a row shows the method's name as Pay.com.js shows it. Without that, it shows the built-in name for paypal, ideal, sofort, bancontact, giropay, eps, klarna, blik, p24, przelewy24, trustly, sepa, multibanco, mbway, cashapp, and venmo. Other types show their type, with spaces for underscores and hyphens, and a capital first letter.
The card form
These texts cover the card fields, their errors, and the save-card switch.
| Parameter | Type | Required | Description |
|---|---|---|---|
cardInformation | String | No | Above the card fields. Default: Card information. |
cardNumber | String | No | The card number field's label. Default: Card number. |
expiry | String | No | The expiration date field's label. Default: Expiry date. |
cvc | String | No | The security code field's label. Default: CVV. |
name | String | No | The name field's label. Default: Name on card. |
numberPlaceholder | String | No | In the card number field, while it's focused and empty. Default: 1234 1234 1234 1234. |
expiryPlaceholder | String | No | In the expiration date field, while it's focused and empty. Default: MM / YY. |
cvcPlaceholder | String | No | In the security code field, while it's focused and empty. Default: 123. |
namePlaceholder | String | No | In the name field, while it's focused and empty. Default: empty, for none. |
numberInvalid | String | No | Under an invalid card number, and under an incomplete one after the customer taps the button. Default: Card number is invalid. |
expiryInvalid | String | No | Under an invalid expiration date, and under an incomplete one after the customer taps the button. Default: Expiry date is invalid. |
cvcInvalid | String | No | Under an invalid security code, and under an incomplete one after the customer taps the button, in the card form and under a saved card's CVV at checkout. Default: CVV must be 3 or 4 digits. |
required | String | No | Under an empty required field after the customer taps the button, and under an invalid name. Default: Required. |
saveCard | String | No | The save-card switch. Default: Save card for future use. |
saveCardAtMerchant | String | No | The save-card switch, instead of saveCard, when you set merchantDisplayName. Default: Save card for future use at {merchant}. |
The button
These texts cover the main button and the card brands under it.
| Parameter | Type | Required | Description |
|---|---|---|---|
payAmount | String | No | The button, when the session has an amount and a currency. {amount} is formatted for the device's locale, for example $10.00. Default: Pay {amount}. |
pay | String | No | The button, when the session has no amount. Default: Pay. |
addPaymentMethod | String | No | The button in a setup session. Default: Add your payment method. |
usePaymentMethod | String | No | The button while a saved method is selected, and always in a payout session. Default: Use payment method. |
acceptedCards | String | No | What TalkBack reads before the card brands under the button, as in "Accepted cards: Visa, Mastercard". Default: Accepted cards. |
Saved methods
These texts cover the saved methods and removing them.
| Parameter | Type | Required | Description |
|---|---|---|---|
savedPaymentMethods | String | No | Above the saved methods, in a setup session. Default: Saved payment methods. |
defaultBadge | String | No | Next to the customer's default method. Default: Default. |
savedCard | String | No | A saved card's title, when it has no brand. Default: Card. |
bankAccount | String | No | A saved bank account's title, when it has no bank name. Default: Bank account. |
expires | String | No | Under a saved card. {date} is its expiration date as MM/YY. Default: Expires {date}. |
edit | String | No | The button that lets the customer remove saved methods. Default: Edit. |
done | String | No | The same button, while they're removing. Default: Done. |
removeTitle | String | No | The question before a method is removed. {method} is its row's title. Default: Remove {method}?. |
remove | String | No | The answer that removes it, and each row's remove button. Default: Remove. |
cancel | String | No | The answer that keeps it. Default: Cancel. |
A saved method's row title is its card brand and last 4 digits (Visa •••• 4242), its bank name and last 4 digits, or its method's name and email.
Saved methods at checkout
These texts cover the carousel and the Payment methods page a returning customer sees at checkout.
| Parameter | Type | Required | Description |
|---|---|---|---|
change | String | No | The button under the carousel that opens Payment methods. Default: Change. |
changePaymentMethod | String | No | What TalkBack reads for that button. Default: Change payment method. |
paymentMethods | String | No | The title of the page that lists every saved method. Default: Payment methods. |
otherWaysToPay | String | No | The last group of Payment methods, and the title of the page it opens (containing the card form and the session's other methods). Default: Other ways to pay. |
back | String | No | What TalkBack reads for the pages' back button. Default: Back. |
cvcForCard | String | No | The label of a saved card's CVV field. {method} is the card, for example Visa •••• 4242. Default: CVV for {method}. |
endingIn | String | No | What TalkBack reads for a saved method, as in "Visa ending in 4242". {name} is the brand, and {last4} the last 4 digits. Default: {name} ending in {last4}. |
position | String | No | What TalkBack reads for a method's place in the carousel, as in "1 of 4". Default: {index} of {count}. |
removeMethod | String | No | What TalkBack reads for a row's delete button on Payment methods. {method} is the method as endingIn names it. Default: Remove {method}. |
Failure messages
The sheet shows these messages after a failed attempt.
| Parameter | Type | Required | Description |
|---|---|---|---|
declined | String | No | After a decline, when the customer can try again. Default: Your payment method has been declined. |
maxAttempts | String | No | After the session's last attempt was declined. Default: You have reached the maximum number of payment attempts. |
sessionExpired | String | No | When the session has expired. Default: The session has expired and payment can no longer be made. |
sessionEnded | String | No | When the session was paid, or its payment ended. Default: This payment can no longer be completed. |
amountChanged | String | No | When the session's total changed before the payment was charged. The button then shows the new total. Default: The total has changed. Check the new total, then pay again. |
network | String | No | When a request didn't reach Pay.com. Default: Check your connection and try again. |
generic | String | No | After any other failure. Default: Something went wrong. Please try again. |
Example
Take the texts from your app's string resources, so its translations apply:
fun Context.dropInStrings() = PayDropInStrings(
title = getString(R.string.checkout_title),
payWith = getString(R.string.checkout_pay_with),
card = getString(R.string.checkout_card),
cardInformation = getString(R.string.checkout_card_information),
cardNumber = getString(R.string.checkout_card_number),
expiry = getString(R.string.checkout_expiry),
cvc = getString(R.string.checkout_cvc),
name = getString(R.string.checkout_name),
required = getString(R.string.checkout_required),
numberInvalid = getString(R.string.checkout_number_invalid),
expiryInvalid = getString(R.string.checkout_expiry_invalid),
cvcInvalid = getString(R.string.checkout_cvc_invalid),
saveCardAtMerchant = getString(R.string.checkout_save_card_at), // For example "Karte bei {merchant} speichern"
pay = getString(R.string.checkout_pay),
payAmount = getString(R.string.checkout_pay_amount), // For example "{amount} bezahlen"
declined = getString(R.string.checkout_declined),
amountChanged = getString(R.string.checkout_amount_changed),
network = getString(R.string.checkout_network),
generic = getString(R.string.checkout_generic),
methodNames = mapOf("ideal" to "iDEAL"),
)
val dropIn = PayDropIn(checkout, PayDropIn.Configuration(merchantDisplayName = "My Shop", strings = dropInStrings()))Next steps
- Present the drop-in: The sheet's other options.
- Style the drop-in: Its colors, corners, and fonts.