Skip to Content
Docs

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.

ParameterTypeRequiredDescription
titlestringNoThe sheet's title. Default: "Payment".
closestringNoWhat screen readers read for the close button. Default: "Close".
payWithstringNoAbove the list of methods. Default: "Pay with".
cardstringNoThe card's row in the list of methods. Default: "Card".
orSeparatorstringNoBetween the Apple Pay or Google Pay button and the other methods. Default: "or".
methodNamesRecord<string, string>NoRow 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.

ParameterTypeRequiredDescription
cardInformationstringNoAbove the card form. Default: "Card information".
cardNumberstringNoThe card number input's label (read by VoiceOver on iOS and shown as the floating label on Android). Default: "Card number".
expirystringNoThe expiration date input's label. Default: "Expiry date".
cvcstringNoThe CVV input's label. Default: "CVV".
namestringNoThe name input's label. Default: "Name on card".
numberPlaceholderstringNoThe card number input's placeholder. Default: "Card number" on iOS, "1234 1234 1234 1234" on Android.
expiryPlaceholderstringNoThe expiration date input's placeholder. Default: "MM / YY".
cvcPlaceholderstringNoThe CVV input's placeholder. Default: "CVV" on iOS, "123" on Android.
namePlaceholderstringNoThe name input's placeholder. Default: "Name on card" on iOS, none on Android.
requiredstringNoUnder a required field that's still empty when the customer taps Pay. Default: "Required".
numberInvalidstringNoUnder an invalid card number. Default: "Card number is invalid".
expiryInvalidstringNoUnder an invalid expiration date. Default: "Expiry date is invalid".
cvcInvalidstringNoUnder an invalid CVV. Default: "CVV must be 3 or 4 digits".
saveCardstringNoThe save-card choice. Default: "Save card for future use".
saveCardAtMerchantstringNoThe 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.

ParameterTypeRequiredDescription
paystringNoWhen the session has no amount or currency. Default: "Pay".
payAmountstringNoWhen the session has an amount and a currency. Default: "Pay {amount}".
addPaymentMethodstringNoIn a setup session. Default: "Add your payment method".
usePaymentMethodstringNoFor a saved method, and for any method in a payout session. Default: "Use payment method".
acceptedCardsstringNoWhat 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.

ParameterTypeRequiredDescription
declinedstringNoA decline the customer can try again after. Default: "Your payment method has been declined."
maxAttemptsstringNoA decline on the session's last attempt. Default: "You have reached the maximum number of payment attempts."
sessionExpiredstringNoThe session expired. Default: "The session has expired and payment can no longer be made."
sessionEndedstringNoThe session was already completed, or the payment ended. Default: "This payment can no longer be completed."
amountChangedstringNoThe 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."
networkstringNoA network error. Default: "Check your connection and try again."
genericstringNoAny 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.

ParameterTypeRequiredDescription
savedPaymentMethodsstringNoAbove the customer's saved methods, in a setup session. Default: "Saved payment methods".
defaultBadgestringNoMarks the customer's default saved method. Default: "Default".
savedCardstringNoA saved card without a known brand. Default: "Card".
bankAccountstringNoA saved bank account without a bank name. Default: "Bank account".
expiresstringNoUnder a saved card. Default: "Expires {date}".
editstringNoThe button that starts removing saved methods (Android only, since iOS uses the system Edit button). Default: "Edit".
donestringNoThe button that stops removing saved methods (Android only). Default: "Done".
removeTitlestringNoAsks to confirm a removal. Default: "Remove {method}?".
removestringNoConfirms the removal. Default: "Remove".
cancelstringNoKeeps the method. Default: "Cancel".
payoutTitlestringNoThe sheet's title in a payout session, instead of title. Default: "Payout method".
getPaidWithstringNoAbove 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

Was this page helpful?