Change the drop-in's text
Replace any text the drop-in shows, for example to translate it, with placeholders for the merchant, the amount, a date, and a saved method.
All default strings in the drop-in are in English. Supply localized values from your app through the strings option of checkout.presentDropIn() to support other languages or match your wording. Pass only the keys you want to replace, and omitted keys keep their defaults.
Some texts take a placeholder that the drop-in replaces at runtime ({merchant} with merchantDisplayName, {amount} with the session's amount and currency, {date} with a saved card's expiration date as MM/YY, and {method} with a saved method's name).
const result = await checkout.presentDropIn({
strings: { title: 'Paiement', payAmount: 'Payer {amount}' },
})Parameters
Every text is an optional string, except methodNames. A default is the same on iOS and Android unless the table gives both.
The sheet
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. Default: "Payment". |
close | string | No | What screen readers read for the close button. Default: "Close". |
payWith | string | No | Above the list of methods. Default: "Pay with". |
card | string | No | The card's row in the list of methods. Default: "Card". |
orSeparator | string | No | Between the Apple Pay or Google Pay button and the other methods. Default: "or". |
methodNames | Record<string, string> | No | Row titles for alternative payment methods, by API type, for example { paypal: 'PayPal' }. A type you leave out shows the method's name as Pay.com.js shows it, or else the SDK's own name for it. |
The card form
These texts cover the card form's inputs, their errors, and the save-card choice.
| Parameter | Type | Required | Description |
|---|---|---|---|
cardInformation | string | No | Above the card form. Default: "Card information". |
cardNumber | string | No | The card number input's label (read by VoiceOver on iOS and shown as the floating label on Android). Default: "Card number". |
expiry | string | No | The expiration date input's label. Default: "Expiry date". |
cvc | string | No | The CVV input's label. Default: "CVV". |
name | string | No | The name input's label. Default: "Name on card". |
numberPlaceholder | string | No | The card number input's placeholder. Default: "Card number" on iOS, "1234 1234 1234 1234" on Android. |
expiryPlaceholder | string | No | The expiration date input's placeholder. Default: "MM / YY". |
cvcPlaceholder | string | No | The CVV input's placeholder. Default: "CVV" on iOS, "123" on Android. |
namePlaceholder | string | No | The name input's placeholder. Default: "Name on card" on iOS, none on Android. |
required | string | No | Under a required field that's still empty when the customer taps Pay. Default: "Required". |
numberInvalid | string | No | Under an invalid card number. Default: "Card number is invalid". |
expiryInvalid | string | No | Under an invalid expiration date. Default: "Expiry date is invalid". |
cvcInvalid | string | No | Under an invalid CVV. Default: "CVV must be 3 or 4 digits". |
saveCard | string | No | The save-card choice. Default: "Save card for future use". |
saveCardAtMerchant | string | No | The save-card choice when you pass merchantDisplayName. Default: "Save card for future use at {merchant}". |
The Pay button
These texts cover the Pay button and the card brands under it.
| Parameter | Type | Required | Description |
|---|---|---|---|
pay | string | No | When the session has no amount or currency. Default: "Pay". |
payAmount | string | No | When the session has an amount and a currency. Default: "Pay {amount}". |
addPaymentMethod | string | No | In a setup session. Default: "Add your payment method". |
usePaymentMethod | string | No | For a saved method, and for any method in a payout session. Default: "Use payment method". |
acceptedCards | string | No | What screen readers read before the card brands under the Pay button, as in "Accepted cards: Visa, Mastercard". Default: "Accepted cards". |
Error messages
The sheet shows these messages when a payment fails or the session can't be paid anymore.
| Parameter | Type | Required | Description |
|---|---|---|---|
declined | string | No | A decline the customer can try again after. Default: "Your payment method has been declined." |
maxAttempts | string | No | A decline on the session's last attempt. Default: "You have reached the maximum number of payment attempts." |
sessionExpired | string | No | The session expired. Default: "The session has expired and payment can no longer be made." |
sessionEnded | string | No | The session was already completed, or the payment ended. Default: "This payment can no longer be completed." |
amountChanged | string | No | 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 | A network error. Default: "Check your connection and try again." |
generic | string | No | Any other failure. Default: "Something went wrong. Please try again." |
Saved methods and payouts
These texts cover the customer's saved methods, removing them, and the title and list in a payout session.
| Parameter | Type | Required | Description |
|---|---|---|---|
savedPaymentMethods | string | No | Above the customer's saved methods, in a setup session. Default: "Saved payment methods". |
defaultBadge | string | No | Marks the customer's default saved method. Default: "Default". |
savedCard | string | No | A saved card without a known brand. Default: "Card". |
bankAccount | string | No | A saved bank account without a bank name. Default: "Bank account". |
expires | string | No | Under a saved card. Default: "Expires {date}". |
edit | string | No | The button that starts removing saved methods (Android only, since iOS uses the system Edit button). Default: "Edit". |
done | string | No | The button that stops removing saved methods (Android only). Default: "Done". |
removeTitle | string | No | Asks to confirm a removal. Default: "Remove {method}?". |
remove | string | No | Confirms the removal. Default: "Remove". |
cancel | string | No | Keeps the method. Default: "Cancel". |
payoutTitle | string | No | The sheet's title in a payout session, instead of title. Default: "Payout method". |
getPaidWith | string | No | Above the list of methods in a payout session, instead of payWith. Default: "Get paid with". |
Errors
presentDropIn() rejects with a TypeError before the sheet opens when a text value or a methodNames label isn't a string.
Example
const result = await checkout.presentDropIn({
merchantDisplayName: 'Ma Boutique',
strings: {
title: 'Paiement',
payWith: 'Payer avec',
card: 'Carte',
cardInformation: 'Informations de la carte',
numberPlaceholder: 'Numéro de carte',
expiryPlaceholder: 'MM / AA',
saveCardAtMerchant: 'Enregistrer la carte pour mes prochains achats chez {merchant}',
payAmount: 'Payer {amount}',
declined: 'Votre moyen de paiement a été refusé.',
generic: 'Une erreur est survenue. Veuillez réessayer.',
methodNames: { paypal: 'PayPal', ideal: 'iDEAL' },
},
})Next steps
- Style the drop-in: Change the sheet's colors and shapes.
- Present the drop-in: The sheet's other options.
- Let customers choose a payout method: The flow the payout texts belong to.