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:

OptionWhat it setsSection
featuresWhich parts of the Cashier are onFeatures
headerBalance, Deposit / Withdraw tabs, back and close buttonsHeader
amountCurrency format, currency mode, quick amountsAmount and quick amounts
paymentMethodsMethod order, limits, fees, saved card expiry, removal, field prefillPayment methods
cardCardholder name prefill and lockCard
promotionsBonus list or promotion code fieldPromotions
billingFieldsEditable, read-only or hidden, per billing fieldBilling fields
resultThe details on the result screenResult screen
footerSupport and policy linksFooter links
returnsAfterResultYour app shows the result instead of the CashierReturn after the result
presetAmountEditableThe customer can change an amount the session came withEditable session amount
themeColors, font, button shape, appearance, field labelsTheme
textsAny text, and the main button textTexts
hooksEvents, live amount, method filter, field rulesEvents and hooks
paymentHandlerYour code before the payment is sent to PraxisPayment 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 runs

CashierSession 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.


Did this page help you?