Change the drop-in's text
Replace any text the drop-in shows, for example to translate the sheet or match your app's wording.
PayDropInStrings holds every text the drop-in displays. All default strings are in English. Supply localized values from your app to support other languages, and pass them as the configuration's strings. Placeholders in braces, such as {amount} and {method}, are replaced where they appear.
var strings = PayDropInStrings()
strings.title = String(localized: "Payment")
configuration.strings = stringsProperties
| Property | Default | Where it shows |
|---|---|---|
title | Payment | The sheet's title in a setup session. At checkout, the sheet has no title. It shows your merchantDisplayName and the total. |
close | Close | What VoiceOver reads for the close button. |
payWith | Pay with | Above the list of methods. |
card | Card | The card's row in the list. |
cardInformation | Card information | Above the card form. |
cardNumber, expiry, cvc, name | Card number, Expiry date, CVV, Name on card | What VoiceOver reads for each card input. |
numberPlaceholder, expiryPlaceholder, cvcPlaceholder, namePlaceholder | Card number, MM / YY, CVV, Name on card | The card inputs' placeholders. An empty namePlaceholder shows none. |
required | Required | Under an empty required field after the customer taps the Pay button, and under an invalid name. |
numberInvalid | Card number is invalid | Under an invalid card number, or an incomplete one after the customer taps the Pay button. |
expiryInvalid | Expiry date is invalid | Under an invalid or incomplete expiration date, in the same way. |
cvcInvalid | CVV must be 3 or 4 digits | Under an invalid or incomplete CVV, in the same way, and under a saved card's CVV at checkout. |
saveCard | Save card for future use | The save-card switch, when there's no merchantDisplayName. |
saveCardAtMerchant | Save card for future use at {merchant} | The save-card switch, with merchantDisplayName. |
pay | Pay | The Pay button, when the session has no amount. |
payAmount | Pay {amount} | The Pay button, with the session's amount formatted in its currency. |
addPaymentMethod | Add your payment method | The button in a setup session. |
usePaymentMethod | Use payment method | The button for a saved method, and for any method in a payout session. |
acceptedCards | Accepted cards | What VoiceOver reads before the card brands under the Pay button, as in "Accepted cards: Visa, Mastercard". |
declined | Your payment method has been declined. | After a decline the customer can retry. |
maxAttempts | You have reached the maximum number of payment attempts. | After the session's last attempt was declined. |
sessionExpired | The session has expired and payment can no longer be made. | When the session has expired. |
sessionEnded | This payment can no longer be completed. | When the session was already paid, or the payment ended. |
amountChanged | The total has changed. Check the new total, then pay again. | When the session's total changed before the payment was charged. The button then shows the new total. |
network | Check your connection and try again. | After a network failure. |
generic | Something went wrong. Please try again. | After any other failure. |
payoutTitle | Payout method | The sheet's title in a payout session. |
getPaidWith | Get paid with | Above the list of methods, in a payout session. |
savedPaymentMethods | Saved payment methods | Above the customer's saved methods. |
defaultBadge | Default | Marks the customer's default saved method. |
savedCard | Card | A saved card without a known brand. |
bankAccount | Bank account | A saved bank account without a bank name. |
expires | Expires {date} | Under a saved card. {date} is MM/YY. |
removeTitle | Remove {method}? | Confirming a removal. {method} is the row's title. |
remove | Remove | The confirmation's button, and what VoiceOver reads for a row's remove control. |
cancel | Cancel | The confirmation's cancel button. |
orSeparator | or | Between the Apple Pay button and the other methods. |
changePaymentMethod | Change payment method | At checkout, the button under a returning customer's carousel. |
paymentMethods | Payment methods | The title of the page that lists the customer's saved methods. |
otherWaysToPay | Other ways to pay | The last row of Payment methods, which opens the card form and the session's other methods. |
cvcForCard | CVV for {method} | Above a saved card's CVV field at checkout. {method} is the card's title, for example "Visa •••• 4242". |
cvcDigits | {count} digits | The placeholder of that field (3 digits, or 4 for American Express). |
paymentMethod, endingIn, position, saved | Payment method, {name} ending in {last4}, {index} of {count}, Saved | What VoiceOver reads for the carousel and the tiles, as in "Payment method, Visa ending in 4242, default, 1 of 4". |
removeMethod | Remove {method} | What VoiceOver reads for a tile's remove control, as in "Remove Visa ending in 4242". |
methodNames | [:] | Row titles for alternative payment methods, by API type, for example ["paypal": "PayPal"]. Types not listed use the name Pay.com.js shows for the method, or else the SDK's built-in name. |
Example
import PayDropIn
var strings = PayDropInStrings()
strings.title = String(localized: "Checkout")
strings.payAmount = String(localized: "Pay {amount} now")
strings.saveCardAtMerchant = String(localized: "Remember this card at {merchant}")
strings.methodNames = ["ideal": "iDEAL", "klarna": String(localized: "Pay later with Klarna")]
let dropIn = PayDropIn(checkout: checkout, configuration: .init(merchantDisplayName: "My Shop", strings: strings))Next steps
- Style the drop-in: Colors, fonts, shapes, and icons.
- Present the drop-in: The rest of the configuration.
Was this page helpful?