5. Configuration and features
CashierConfiguration holds the options of one cashier session. Every option has a default, so CashierConfiguration() gives the recommended cashier, and new options are added with defaults so your code keeps compiling.
let configuration = CashierConfiguration(
features: CashierFeatures.default.subtracting(.promotions),
theme: CashierTheme(brandColorLight: "#006FFF", buttonShape: .pill),
texts: CashierTexts([.pay: "Pay now"]),
closeButton: .visible)
CashierView(token: token, environment: environment, configuration: configuration) { result in
handle(result)
}| Option | Default | What it does |
|---|---|---|
| features | CashierFeatures.default (all) | The parts of the cashier that are on. The SDK fetches data only for these |
| theme | empty (server theme applies) | Theme values set in code. Each value you set wins over the server theme for the same key (section 10) |
| texts | empty (server texts apply) | Texts set in code. Each text you set wins over the server text of the same key (section 10) |
| hooks | none | Your code that the cashier calls: events, live amount, method filter, field rules (section 7) |
| paymentHandler | .praxis | Who sends the payment after the final tap (section 8) |
| lockCardholderName | false | Locks the cardholder name field: the customer cannot change the name prefilled from the profile |
| prefillsMethodFields | true | The method fields start with the customer's profile values. false leaves them empty (a saved template or a default value still fills them) |
| returnsAfterResult | false | true ends the cashier at once when a payment result arrives that opens no provider page; onResult gets the result with closedBy = sdk. The SDK's result, bank details, partial approval and pending screens are skipped |
| closeButton | .automatic | .automatic follows the session's server setting show_close_button; .visible always shows it; .hidden never shows it (your app then closes the cashier with close()) |
Features
A feature that is off costs no network request and shows nothing. The server settings still decide what shows when a feature is on.
| Feature | On | Off |
|---|---|---|
| .editableAmount | The customer can change the amount | The session amount shows as fixed text |
| .amountLimits | The cashier fetches the method limits for the session currency and blocks amounts outside them | No limits are fetched; Praxis checks the amount only when the customer pays |
| .quickAmounts | Quick amount buttons, and the customer's last deposit as the starting amount | No buttons, no last deposit is read |
| .currencyChange | The customer can change the payment currency | The currency stays the starting currency; the method list is still read for it |
| .promotions | Bonuses and promotion codes | No bonus or code block, no bonus data is read, no code is sent with the payment |
| .savedInstruments | Saved cards and saved accounts | Saved rows are hidden, no saved card list is read, nothing can be removed |
| .applePay | Apple Pay as its own method and as the switch inside the card method (when the session and the entitlement allow it) | Apple Pay methods are left out and the card method shows no switch |
// Fixed amount and no promotions: no limits or bonuses are fetched.
let configuration = CashierConfiguration(
features: CashierFeatures.default.subtracting([.editableAmount, .amountLimits, .promotions]))Updated about 8 hours ago
Did this page help you?