Configuration
This page covers everything you can change in the Cashier: configuration options and features (this page), settings, theme, texts and slots (Customization), events and hooks (Events and hooks), and the payment handler (Payment handler).
CashierConfiguration
Pass a CashierConfiguration when you show the Cashier. Every Cashier setting of the app is set here, in code: the look, the header, the amount and quick amounts, how payment methods show, promotions, billing fields, the result screen and the footer links.
The SDK does not read the Cashier settings you made for your web Cashier in the Praxis Backoffice (Theme Editor). So your app can look and behave differently from your web Cashier, and it changes only when you release a new app version.
Every option has a default, so CashierConfiguration() gives a working Cashier. New options in later SDK versions are added with defaults, so your code keeps compiling.
let configuration = CashierConfiguration(
theme: CashierTheme(brandColorLight: "#006FFF", buttonShape: .pill),
header: CashierHeaderOptions(balance: .hidden),
amount: CashierAmountOptions(
quickAmounts: CashierQuickAmounts(lists: [
.init(amounts: [.amount(20), .amount(50), .amount(100)], currency: "EUR")
])
),
promotions: CashierPromotionOptions(style: .codeField),
texts: CashierTexts(depositButton: "Top up")
)
CashierView(token: token, environment: environment, configuration: configuration) { result in
handle(result)
}CashierConfiguration has 15 options:
| Option | What it sets | Section |
|---|---|---|
| features | Which parts of the Cashier are on | Features |
| header | Balance, Deposit / Withdraw tabs, back and close buttons | Header |
| amount | Currency format, currency mode, quick amounts | Amount and quick amounts |
| paymentMethods | Method order, limits, fees, saved card expiry, removal, field prefill | Payment methods |
| card | Cardholder name prefill and lock | Card |
| promotions | Bonus list or promotion code field | Promotions |
| billingFields | Editable, read-only or hidden, per billing field | Billing fields |
| result | The details on the result screen | Result screen |
| footer | Support and policy links | Footer links |
| returnsAfterResult | Your app shows the result instead of the Cashier | Return after the result |
| presetAmountEditable | The customer can change an amount the session came with | Editable session amount |
| theme | Colors, font, button shape, appearance, field labels | Theme |
| texts | Any text, and the main button text | Texts |
| hooks | Events, live amount, method filter, field rules | Events and hooks |
| paymentHandler | Your code before the payment is sent to Praxis | Payment handler |
Each one, with its format and default, is also listed in the SDK Reference.
Features
CashierFeatures turns parts of the Cashier on or off. The SDK fetches data only for features that are on: a feature that is off costs no network request and shows nothing. Your payment setup at Praxis still decides what shows when a feature is on, for example the methods and their limits.
What each feature does when it is on or off is listed in Features. Quick amounts and promotions are not features: they are on when you set them up in amount (Amount and quick amounts) and promotions (Promotions).
.default is the recommended set. New features can be added in later versions and join .default, so start from .default and remove the features you do not want, as below.
// Fixed amount: the amount cannot change and no limits are fetched
let configuration = CashierConfiguration(
features: CashierFeatures.default.subtracting([.editableAmount, .amountLimits]))While a payment runs
From the moment the customer pays until the result shows, the Cashier hides its close button and refuses a swipe down, so one tap cannot abandon the payment. This applies to .cashierSheet, CashierViewController, and a sheet you present yourself around CashierView.
While the payment processes, the Cashier keeps asking Praxis for its status until the session expires; it then ends with .pending. If your app needs an earlier way out, dismiss the Cashier, or call close() on a CashierSession you hold. The result is then .pending, because the payment may still complete. Check its final status on your server.
Provider and 3-D Secure pages
3-D Secure challenges and payment provider pages open inside the Cashier, in a web view the SDK owns, and return to the Cashier on their own. There is nothing to configure in the app; your server sets the app_return_url when it creates the session, and your app registers it to bring the customer back from bank apps. See 3-D Secure and provider pages.
Holding the session yourself
CashierView(token:environment:...) makes and closes its own session. To read the Cashier state from elsewhere in your app, or to drive it from your own controls, create a CashierSession and pass it in. Your app then closes it.
let session = CashierSession(token: token, environment: environment,
configuration: configuration) { result in handle(result) }
CashierView(session: session) // the ready-made cashier
// CashierViewController(session: session) // UIKit
// Elsewhere
let snapshot = session.snapshot // read-only state, see SDK reference
session.close() // ends with .canceled, or .pending while a payment runsCashierSession is @Observable: SwiftUI views that read snapshot redraw when it changes. A closed session cannot start again; create a new one with a new token.
Updated 8 days ago