Configuration & Customization

Configuration, theme, texts, slots, events, hooks and the payment handler.

This page covers everything you can change in the Cashier: configuration options and features (§1), settings, theme, texts and slots (§2), events and hooks (§3), and the payment handler (§4).

1. Configuration

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

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: cashierEnvironment, configuration: configuration) { result in
    handle(result)
}

CashierConfiguration has 15 options:

OptionWhat it setsSection
featuresWhich parts of the Cashier are on§2.2
headerBalance, Deposit / Withdraw tabs, back and close buttons§2.3.1
amountCurrency format, currency mode, quick amounts§2.3.2
paymentMethodsMethod order, limits, fees, saved card expiry, removal, field prefill§2.3.3
cardCardholder name prefill and lock§2.3.4
promotionsBonus list or promotion code field§2.3.5
billingFieldsEditable, read-only or hidden, per billing field§2.3.6
resultThe details on the result screen§2.3.7
footerSupport and policy links§2.3.8
returnsAfterResultYour app shows the result instead of the Cashier§2.3.9
presetAmountEditableThe customer can change an amount the session came with§2.3.10
themeColors, font, button shape, appearance, field labels§2.5
textsAny text, and the main button text§2.8
hooksEvents, live amount, method filter, field rules§3
paymentHandlerYour code before the payment is sent to Praxis§4

Each one, with its format and default, is also listed in the SDK Reference.

1.2 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 §2.2. Quick amounts and promotions are not features: they are on when you set them up in amount (§2.3.2) and promotions (§2.3.5).

.default is the recommended set. 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]))

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

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

1.5 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: cashierEnvironment,
                             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.

2. Customization

2.1 Overview

Everything you can customize is set in code, in one place: the CashierConfiguration you pass when you show the Cashier, plus slots on the predefined template. Nothing is customized by subclassing or registering types.

AreaWhat you can changeSet withSection
FeaturesWhich parts of the Cashier are onCashierConfiguration.features§2.2
HeaderBalance, Deposit / Withdraw tabs, back and close buttonsCashierConfiguration.header (CashierHeaderOptions)§2.3.1
AmountCurrency format, currency mode, quick amount buttonsCashierConfiguration.amount (CashierAmountOptions)§2.3.2
Payment methodsLast used method first, limits, fees, saved card expiry, removal, field prefillCashierConfiguration.paymentMethods (CashierPaymentMethodOptions)§2.3.3
CardCardholder name prefill and lockCashierConfiguration.card (CashierCardOptions)§2.3.4
PromotionsBonus list or promotion code fieldCashierConfiguration.promotions (CashierPromotionOptions)§2.3.5
Billing fieldsEditable, read-only or hidden, per fieldCashierConfiguration.billingFields (CashierBillingFields)§2.3.6
Result screenWhich payment details showCashierConfiguration.result (CashierResultOptions)§2.3.7
FooterSupport and policy linksCashierConfiguration.footer (CashierFooterLinks)§2.3.8
Return after the resultYour app shows the resultCashierConfiguration.returnsAfterResult§2.3.9
Editable session amountThe customer can change an amount the session came withCashierConfiguration.presetAmountEditable§2.3.10
SlotsYour header and footer, hidden blocks, your views between blocks.cashierHeader, .cashierFooter, .cashierHide, .cashierInsert; CashierSlots in UIKit§2.4
ThemeBrand colors, text color on brand, font, button shape, corner radius, appearance, field labelsCashierConfiguration.theme (CashierTheme)§2.5
Color rolesAny of 42 colors the Cashier draws withCashierTheme.roleColors§2.6
Your views in the themeColors, spacing, fonts and radius for your own viewscashierResolvedTheme, .cashierFont(_:)§2.7
TextsAny text, for every language or per language; the deposit and withdrawal button textCashierConfiguration.texts (CashierTexts)§2.8
Fields and methodsExtra field checks, hidden or required fields, default values, method orderCashierConfiguration.hooks (CashierHooks)§2.9
PaymentYour code before the Praxis submitCashierConfiguration.paymentHandler§2.10
LayoutThe order of blocks, one page or severalYour own layoutLayouts & Examples

All of them combine in one configuration:

let configuration = CashierConfiguration(
    theme: CashierTheme(
        brandColorLight: "#0F768A",
        brandColorDark: "#3FB6CC",
        fontName: "Lora",
        buttonShape: .pill,
        appearance: .system,
        fieldLabelStyle: .floatingLabel,
        roleColors: [.screenBackground: Color("AppBackground")]
    ),
    header: CashierHeaderOptions(balance: .allPages, showsBackButton: true),
    amount: CashierAmountOptions(
        currencyFormat: .symbol,
        quickAmounts: CashierQuickAmounts(lists: [
            .init(amounts: [.amount(20), .amount(50), .amount(100), .maximum],
                  currency: "EUR", startingAmount: 50)
        ])
    ),
    paymentMethods: CashierPaymentMethodOptions(lastUsedFirst: true, fees: .ifNotZero, allowsRemoval: true),
    card: CashierCardOptions(prefillsCardholderName: true, locksCardholderName: true),
    promotions: CashierPromotionOptions(style: .bonusList),
    billingFields: CashierBillingFields(country: .readOnly, phone: .hidden),
    result: CashierResultOptions(showsDate: true, showsTotal: true, showsPaymentInstrument: true),
    footer: CashierFooterLinks(
        supportEmail: "[email protected]",
        termsOfService: URL(string: "https://merchant.example/terms")
    ),
    texts: CashierTexts([.agree_with_terms_of_service: "I accept the terms"], depositButton: "Deposit now"),
    hooks: CashierHooks(fieldRules: [CashierFieldRule(field: "zip", minimumLength: 4)])
)

CashierView(token: token, environment: cashierEnvironment, configuration: configuration, onResult: handle) {
    Cashier.AmountFirstLayout()
        .cashierHeader { BrandHeader() }
}

Every value has a default, listed with it. The defaults are the same as the web Cashier's defaults, with one exception: the close button shows by default. A value the SDK cannot use is ignored, its default applies, and the event configuration_value_ignored is sent once.

🚧

All customization follows one rule: card data and customer data never reach your app. See §2.11.


2.2 Features

CashierConfiguration.features (CashierFeatures, an option set). Default: .default, the recommended set. The SDK fetches data only for features that are on, and your payment setup at Praxis still decides what shows.

FeatureWhen onWhen off
.editableAmountThe customer can enter or change the amount when the session has none. A session amount stays fixed unless presetAmountEditable is true (§2.3.10).The session amount shows as fixed text.
.amountLimitsThe method limits for the currency are fetched and enforced; amounts outside them are blocked.No limits are fetched; Praxis checks the amount when the customer pays.
.currencyChangeThe customer can change the payment currency.The currency stays the starting currency.
.savedInstrumentsSaved cards and saved accounts. The customer can remove them when paymentMethods.allowsRemoval is true.Saved rows are hidden and nothing can be removed.
.applePayApple Pay, as its own method and as the switch in the card method. It shows only when Praxis sends Apple Pay settings for the session, the device can pay, and your app's Apple Pay capability lists that merchant ID.Apple Pay methods are left out and the card method shows no switch.
let features = CashierFeatures.default.subtracting(.currencyChange)

Quick amounts and promotions are switched on by their settings, not by a feature: see §2.3.2 and §2.3.5.


2.3 Settings

Each group below is one option of CashierConfiguration. Every parameter has a default, so set only the values you want to change:

CashierConfiguration(header: CashierHeaderOptions(balance: .hidden))   // everything else keeps its default

2.3.1 Header

CashierConfiguration.header (CashierHeaderOptions). The header is the bar at the top of every page.

ParameterDescriptionFormatRequired
balanceWhere the customer's balance shows: .hidden (never), .mainPages (on the amount page only) or .allPages (on every page with the header, except the result screens). Default: .mainPages.CashierHeaderOptions.VisibilityNo
paymentTypeWhere the Deposit / Withdraw tabs show, with the same values as balance. A session with one transaction type shows one tab that names it. A session that allows both shows both, and the customer can switch until they try to pay. Default: .mainPages.CashierHeaderOptions.VisibilityNo
showsBackButtontrue shows a back button on the first page. A tap sends the event cashier_back_button and the Cashier stays open, so your app can react, for example by closing it. Later pages always have a back button. Default: false.BoolNo
closeButton.visible shows the close button; .hidden never shows it. While a payment runs, the close button is hidden whatever this value. Default: .visible.CashierHeaderOptions.CloseButtonNo
📘

The web Cashier hides the close button by default. The app shows it by default, because a full-screen Cashier needs a way out. If you hide it, give the customer another way out, for example a swipe down on .cashierSheet, your own navigation, or a close button in your own header slot (§2.4) that calls close().

2.3.2 Amount and quick amounts

CashierConfiguration.amount (CashierAmountOptions).

ParameterDescriptionFormatRequired
currencyFormatHow amounts show the currency: .symbol (€10) or .isoCode (EUR 10). Default: .isoCode..symbol or .isoCodeNo
currencyModeWhich currency amounts show in: .paymentCurrency, the currency the customer pays in, or .baseCurrency, the base currency of the customer's account, with the payment currency hidden. Default: .paymentCurrency..paymentCurrency or .baseCurrencyNo
quickAmountsThe quick amount buttons under the amount. Default: no buttons.CashierQuickAmountsNo

Quick amounts. Quick amount buttons let the customer pick a common amount with one tap. Give one or more lists of buttons, or build the buttons from the customer's last deposit.

CashierQuickAmounts:

ParameterDescriptionFormatRequired
listsYour button lists. The Cashier picks one list for the session, as described below. Default: [].[CashierQuickAmounts.List]No
basedOnLastDeposittrue builds the buttons of a deposit from the customer's last deposit instead: up to five amounts, from the last deposit (at least 20) up to the method maximum. A customer with no previous deposit gets 20, 50, 100, 200 and 500, those up to the method maximum. No buttons show when the method has no maximum. When the last deposit is in another currency or below the method minimum, your lists apply instead. Default: false.BoolNo

CashierQuickAmounts.List:

ParameterDescriptionFormatRequired
amountsThe buttons, in order: .amount(_:) for a fixed amount, or .maximum for a Max button set to the method maximum. Amounts must not be negative.[CashierQuickAmounts.Choice]Yes
currencyThe currency the list is for, as an ISO 4217 code. nil means any currency. Default: nil.String?No
paymentMethodThe payment method the list is for, as the method key Praxis sends (the paymentMethod of CashierPaymentRequest). nil means any method. Default: nil.String?No
intentThe transaction type the list is for: .deposit or .withdrawal. Default: .deposit.CashierIntentNo
startingAmountThe amount the Cashier starts with, used only when the session has no amount and the customer has no previous deposit. Only a list with no paymentMethod and a matching currency applies, because no method is selected yet when the Cashier opens. Must be 0 or more. Default: nil.Decimal?No

Which list is used. For the session's transaction type, the Cashier takes the first list that matches, in this order:

  1. The list for the selected payment method and the currency.
  2. A list for any method, with the currency.
  3. A list for the selected method, with any currency.

A list with neither a method nor a currency is never used. Buttons outside the method limits are left out. When no list matches, no buttons show.

let quickAmounts = CashierQuickAmounts(lists: [
    // Deposits in EUR: four buttons, starting at 50
    .init(amounts: [.amount(20), .amount(50), .amount(100), .maximum], currency: "EUR", startingAmount: 50),
    // Withdrawals in EUR
    .init(amounts: [.amount(50), .amount(100), .amount(200)], currency: "EUR", intent: .withdrawal),
    // Deposits in USD
    .init(amounts: [.amount(25), .amount(50), .amount(100)], currency: "USD")
])

let configuration = CashierConfiguration(amount: CashierAmountOptions(quickAmounts: quickAmounts))
📘

Quick amounts are off when you set no lists and basedOnLastDeposit is false, which is the default. No buttons show. The customer's last deposit still starts the amount when the session has none.

Quick amount buttons do not show while the amount is locked: with a session amount (unless presetAmountEditable is true), or with .editableAmount off. To hide the buttons in one layout only, use .cashierHide(.quickAmounts) (§2.4).

2.3.3 Payment methods

CashierConfiguration.paymentMethods (CashierPaymentMethodOptions). Which methods the customer can use is set at Praxis; these values decide how they show.

ParameterDescriptionFormatRequired
lastUsedFirsttrue starts the method list with the method the customer used last. Default: false.BoolNo
showsLimitstrue shows the minimum and maximum amount on each method row. This changes the text only; the .amountLimits feature decides whether limits are enforced. Default: true.BoolNo
feesHow method fees show: .always, .ifNotZero (only when the fee is more than zero) or .hidden. Default: .always.CashierPaymentMethodOptions.FeeVisibilityNo
showsCardExpirytrue shows the expiry date of saved cards: on the selected method, in the method list (with expires MM/YY while the customer manages saved cards), in the retry list and in the wallet card list of a withdrawal. false shows no date; an expired card still shows expired. Default: false.BoolNo
allowsRemovaltrue lets the customer remove a saved card or saved account. The Cashier always asks before it removes one. Needs the .savedInstruments feature. Default: false.BoolNo
prefillsFieldstrue fills method fields from the customer profile. false leaves them empty; a saved template or a default value from Praxis still fills them. Default: true.BoolNo

2.3.4 Card

CashierConfiguration.card (CashierCardOptions).

ParameterDescriptionFormatRequired
prefillsCardholderNametrue fills the cardholder name with the customer's name from the session. Default: false.BoolNo
locksCardholderNametrue stops the customer from changing the cardholder name. Use it with prefillsCardholderName: true; without a prefill the field stays empty and locked. It also locks the name field of the billing form. Default: false.BoolNo

2.3.5 Promotions

CashierConfiguration.promotions (CashierPromotionOptions). Which bonuses and promotion codes are valid is set at Praxis.

ParameterDescriptionFormatRequired
style.bonusList shows the bonuses Praxis offers for the session, for the customer to pick from. .codeField shows a field where the customer types a promotion code. nil shows no promotion block. Default: nil.CashierPromotionOptions.Style?No
📘

With style nil, promotions are off completely: no bonus or code block shows, no bonus data is read, and no code is sent with the payment. To hide the block in one layout only, use .cashierHide(.promotions) (§2.4).

2.3.6 Billing fields

CashierConfiguration.billingFields (CashierBillingFields). The billing fields show when the payment method needs billing data. Each field takes one of three values:

  • .editable: the customer can fill in or change the field.
  • .readOnly: the field shows the value from the customer profile, and the customer cannot change it, unless the value has an error: the field then becomes editable so the customer can fix it.
  • .hidden: the field does not show.
ParameterFieldDefault
countryCountry.editable
nameCustomer name.editable
emailEmail.editable
phonePhone.editable
postalCodePostal code.editable
stateState.editable
cityCity.editable
addressAddress.editable
let billingFields = CashierBillingFields(country: .readOnly, email: .readOnly, phone: .hidden)

To add checks to a field or make it required, use CashierHooks (§2.9).

2.3.7 Result screen

CashierConfiguration.result (CashierResultOptions). The details the result screen shows after a payment.

ParameterDescriptionFormatRequired
showsDeclineReasonShows why a payment was declined. Default: true.BoolNo
showsDateShows the date and time of the payment. Default: false.BoolNo
showsFeeShows the fee. Default: false.BoolNo
showsTotalShows the total amount. Default: false.BoolNo
showsBonusShows the bonus the customer received. Default: false.BoolNo
showsPaymentInstrumentShows the card or account used, masked. Default: false.BoolNo
showsBillingDescriptorShows the billing descriptor: the name the payment has on the customer's statement. Default: false.BoolNo

With returnsAfterResult true (§2.3.9), the result screen does not show, so these values have no effect.

2.3.8 Footer links

CashierConfiguration.footer (CashierFooterLinks). The footer under the first page shows your support contacts and policy links. It shows when at least one link is set.

ParameterDescriptionFormatRequired
supportWebsiteYour support page. Must be https. Default: nil (no link).URL?No
supportEmailYour support email address. Default: nil (no link).String?No
supportPhoneYour support phone number, for example "+357 22 000000". Default: nil (no link).String?No
privacyPolicyYour privacy policy. Must be https. Default: nil (no link).URL?No
termsOfServiceYour terms of service. Must be https. Default: nil (no link).URL?No

To show your own footer instead, use .cashierFooter { … } (§2.4).

2.3.9 Return after the result

ParameterDescriptionFormatRequired
returnsAfterResulttrue ends the Cashier as soon as a payment result arrives that opens no provider page, and calls onResult with closedBy .sdk. The SDK's result, bank details, partial approval and pending screens are skipped, so you show your own. Default: false.BoolNo

2.3.10 Editable session amount

When your server creates the session with an amount, the Cashier shows that amount as fixed text. Set presetAmountEditable to let the customer change it.

ParameterDescriptionFormatRequired
presetAmountEditabletrue shows the session amount prefilled and lets the customer change it, within the method limits when .amountLimits is on. false shows it as fixed text. Needs the .editableAmount feature. A zero-amount card authorization always stays fixed. Has no effect when the session has no amount. Default: false.BoolNo
let configuration = CashierConfiguration(presetAmountEditable: true)

2.4 Slots

Slots change the predefined template without writing your own layout. They are methods of Cashier.AmountFirstLayout and Cashier.OnePageLayout: add them to the template and pass it as the last closure of CashierView or .cashierSheet. In UIKit, use CashierSlots (§2.4.4).

MethodParametersEffect
.cashierHeader { … }Your viewReplaces the header on every page.
.cashierFooter { … }Your viewReplaces the footer under the first page.
.cashierHide(_:)HideableBlockHides a block.
.cashierInsert(before:_:)CashierAnchor, your viewAdds your view before a block.
.cashierInsert(after:_:)CashierAnchor, your viewAdds your view after a block.
CashierView(token: token, environment: cashierEnvironment, onResult: handle) {
    Cashier.AmountFirstLayout()
        .cashierHeader { BrandHeader() }
        .cashierFooter { Text("Payments are processed by Praxis").cashierFont(.small) }
        .cashierHide(.quickAmounts)
        .cashierInsert(before: .mainButton) { SecurityNote() }
        .cashierInsert(after: .selectedMethod) { LoyaltyHint() }
}

2.4.1 Blocks you can hide: HideableBlock

Only blocks without legal or payment meaning can be hidden.

ValueHides
.headerThe header: back and close buttons, the Deposit / Withdraw tabs, the balance. Give the customer a way to close and go back if you hide it, and do not hide it in sessions with more than one intent.
.footerThe footer under the first page.
.quickAmountsThe quick amount buttons.
.promotionsThe bonus list and the promotion code field. To turn promotions off completely, including the data request, leave promotions.style nil instead (§2.3.5).

2.4.2 Where you can insert: CashierAnchor

Inserted content sits between blocks, in its own clipped container, and shows only while its anchor block shows. Several inserts at the same anchor show in the order you wrote them. Content is never placed inside a block.

AnchorPageBlock
.headerEvery pageThe header
.amountAmountThe amount, currency and limits
.quickAmountsAmountThe quick amount buttons
.promotionsAmountThe bonus list or the promotion code, whichever shows
.selectedMethodAmountThe selected payment method
.amountChangeNoteAmountThe note when the method changes the amount
.totalToPayAmountThe fee and the total
.termsAmount; details and billing during a decline recoveryThe terms box
.mainButtonEvery pageThe main button
.footerAmountThe footer
.stepTitleDetails, billingThe page title
.cardFormDetailsThe card fields
.savedCardCodeDetailsThe saved card CVV field
.walletSwitchDetailsThe card or Apple Pay switch
.methodFieldsDetailsThe fields of a non-card method
.bankPickerDetailsThe bank list of a bank wire
.saveCardNoteDetailsThe note that a new card is saved
.billingFormBillingThe billing and contact fields
.resultResultThe result of the payment

2.4.3 What slot content can read: CashierSlotContext

Slot content does not get the CashierSession. It reads @Environment(\.cashierSlotContext), which is nil outside slot content:

MemberDescription
snapshotThe read-only CashierSnapshot: step, amount, currency, selected method, total, result and more. Never card or personal data.
back()Goes back one page. Ignored on the first page or while a payment runs.
close()Closes the Cashier. onResult is called with closedBy .code.
next()Does what the main button does now. Ignored when the button is disabled.
struct BrandHeader: View {
    @Environment(\.cashierSlotContext) private var cashier
    @Environment(\.cashierResolvedTheme) private var theme

    var body: some View {
        HStack {
            if let cashier, cashier.snapshot.step != .amount {
                Button("Back") { cashier.back() }
            }
            Spacer()
            Image("logo")
            Spacer()
            Button("Close") { cashier?.close() }
        }
        .foregroundStyle(theme.color(.headerIcon))
        .padding(theme.spacing(.s16))
    }
}
🚧

Inside slot content, @Environment(CashierSession.self) is nil. A non-optional read of it there stops the app at run time.

2.4.4 Slots in UIKit: CashierSlots

Pass CashierSlots to CashierViewController(token:environment:configuration:slots:onResult:) or CashierViewController(session:slots:). Your views are UIViews.

MethodEffect
setHeader(_:)Replaces the header.
setFooter(_:)Replaces the footer.
hide(_:)Hides a HideableBlock.
insert(before:_:)Adds your view before a CashierAnchor.
insert(after:_:)Adds your view after a CashierAnchor.
var slots = CashierSlots()
slots.setHeader { BrandHeaderView() }
slots.hide(.quickAmounts)
slots.insert(after: .selectedMethod) { LoyaltyHintView() }

let cashier = CashierViewController(token: token, environment: cashierEnvironment, slots: slots) { result in
    handle(result)
}

2.5 Theme

CashierConfiguration.theme (CashierTheme). The Cashier takes its look from two sources; the later one wins, value by value:

  1. Built-in defaults.
  2. Your CashierTheme values that are not nil. roleColors and cornerRadius win over the palette and the button shape.

The theme is not read from the Praxis Backoffice, so the loading screen already has your look.

ParameterDescriptionFormatRequired
brandColorLightThe brand color in light appearance, as hex: # and 3, 4, 6 or 8 digits (for example "#0F768A"). The Cashier builds its whole palette from it: main button, links, selected states, quick amounts. Default: nil (#0F768A).String?No
brandColorDarkThe brand color in dark appearance, as hex. It is not taken from brandColorLight: with .dark or .system, set it too, or use CashierTheme(brand:brandText:). Default: nil (#0F758A).String?No
brandTextColorLightThe text color on the main button and the selected quick amount in light appearance, as hex. Default: nil (#F2F2F2).String?No
brandTextColorDarkThe same in dark appearance. Default: nil (#F2F2F2).String?No
fontNameThe family or PostScript name of a font your app has registered. nil or "default" uses the system font. A font the app does not have falls back to the system font: serif or monospace for the web Cashier's serif and monospace fonts, sans-serif otherwise. The SDK never downloads fonts. Sizes and weights do not change. Default: nil (the system font).String?No
buttonShapeThe corner style of the main button and of the parts that follow it (method card, field groups, dialogs, bonus cards): .rounded (8 pt), .sharp (0 pt) or .pill (20 pt). Default: nil (.rounded).CashierTheme.ButtonShape?No
cornerRadiusA corner radius in points for the same parts. Wins over buttonShape. Must be 0 or more. Default: nil.CGFloat?No
appearance.light, .dark or .system. With .system, the Cashier reads the device setting when it opens and keeps it while it is open. Default: nil (.light).CashierTheme.Appearance?No
fieldLabelStyleHow method and billing fields show labels: .topLabel (label above the field), .floatingLabel (label inside the field) or .noLabel (each field group is one box with thin dividers). Default: nil (.topLabel).CashierTheme.FieldLabelStyle?No
roleColorsColors for single roles. See §2.6. Default: [:].[CashierTheme.Role: Color]No

One brand color for both appearances. CashierTheme(brand:brandText:) takes SwiftUI colors. A color from your asset catalog that changes with the appearance gives its light value to light appearance and its dark value to dark appearance:

let theme = CashierTheme(brand: Color("BrandBlue"), brandText: .white)

All properties of CashierTheme are var, so you can also change a theme after creating it:

var theme = CashierTheme(brand: Color("BrandBlue"))
theme.buttonShape = .pill
theme.fieldLabelStyle = .floatingLabel
📘

Not customizable: spacing and type sizes. Text sizes follow the customer's Dynamic Type setting.

🚧

An invalid hex color or a negative cornerRadius is ignored and reported once with configuration_value_ignored; ignoredName names the field.


2.6 Color roles

CashierTheme.Role names each color the Cashier draws with. A role you set in roleColors replaces the palette color of that role, in both appearances. Use a color from your asset catalog to give different light and dark values.

RoleUsed for
.screenBackgroundThe screen background
.sheetSurfaceSheet surfaces
.dialogSurfaceDialog surfaces
.fieldBackgroundInput backgrounds
.highContrastTerms text, checkbox border and fill, currency selector, text cursor
.onAccentConstantCheckbox tick and the spinner on the main button
.accentThe brand color: main button, selected pill, links
.accentPressedThe main button while pressed
.onAccentText on the main button and the selected pill
.accentSoftQuick amount pills, the exchange icon background
.pillPressedA quick amount pill while pressed
.cardSurfaceMethod card, picker rows, bonus cards
.selectedRowThe selected picker row, the currency row
.closeButtonFillThe sheet close button
.radioFillThe currency row radio button
.pendingIconCircleThe circle behind the pending result icon
.headerDividerThe line under the header
.disabledFillA disabled button
.dividerDividers
.fieldBorderField borders
.grabberThe sheet grabber
.placeholderTextPlaceholders
.appliedButtonDisabledThe disabled Apply label of the promotion code
.inputBorderThe promotion code input border
.secondaryTextSubtitles and the footer
.disabledTextDisabled button text
.headerIconHeader back and close icons
.noteTextThe amount change note
.headerTextHeader tab, balance and step subtitle
.mutedTextBonus descriptions and the result help link
.primaryTextThe amount, titles and body text
.strongTextField text, banner text, dialog text, the result title
.errorLimit text, field errors, the decline reason
.errorSoftThe circle behind the declined result icon
.success"No fees" and an unlocked bonus
.warningThe maintenance warning
.warningSoftThe maintenance warning background
.termsErrorThe terms box and text in the error state
.cardFieldBorderThe card field group border
.backdropThe backdrop behind sheets and dialogs
.sheetShadowThe sheet shadow
.dialogShadowThe dialog shadow
let theme = CashierTheme(
    brandColorLight: "#0F768A",
    roleColors: [
        .screenBackground: Color("AppBackground"),
        .primaryText: Color("AppText"),
        .error: .red
    ]
)
🚧

Check contrast when you set text and background roles. The Cashier does not adjust colors you set.


2.7 The theme in your own views

Inside the Cashier, your slot content and your own layout views can draw with the resolved theme: your values over the defaults. Read @Environment(\.cashierResolvedTheme) (CashierResolvedTheme). Outside the Cashier it holds the default theme.

MemberReturnsDescription
color(_:)ColorThe color of a role (§2.6).
cornerRadiusCGFloatThe corner radius from buttonShape or your cornerRadius.
spacing(_:)CGFloatA step of the spacing scale.
font(_:)FontThe font of a text style. Follows Dynamic Type only with a font your app registered.

For text, prefer the view modifier .cashierFont(_:): it sets the font, letter spacing and line height of the style and follows Dynamic Type with every font, as the Cashier's own text does.

struct LoyaltyHint: View {
    @Environment(\.cashierResolvedTheme) private var theme

    var body: some View {
        Text("You earn points with this deposit")
            .cashierFont(.caption)
            .foregroundStyle(theme.color(.secondaryText))
            .padding(theme.spacing(.s12))
            .background(theme.color(.cardSurface), in: RoundedRectangle(cornerRadius: theme.cornerRadius))
    }
}

Spacing steps (CashierResolvedTheme.Spacing):

StepPointsStepPoints
.s22.s2020
.s44.s2222
.s88.s2424 (the gap between blocks on the first page)
.s1010.s2525
.s1212.s3232
.s1616 (the side inset of every screen).s4040
.s1717

Text styles (CashierResolvedTheme.TextStyle), sizes at the default Dynamic Type size:

StyleSize and weightUsed for
.amount48 pt, semiboldThe amount
.stepTitle24 pt, semiboldPage titles
.resultTitle22 pt, semiboldResult titles
.button16 pt, semiboldButtons
.methodTitle16 pt, semiboldMethod titles
.bonusTitle16 pt, semiboldBonus titles
.promoLink16 pt, mediumThe promotion code link
.body16 pt, regularBody text and fields
.resultRow16 pt, regularResult detail rows
.badge14 pt, heavyBonus badges
.label14 pt, semiboldLabels, the header tab
.totalAmount14 pt, semiboldThe total to pay
.dialogLink14 pt, mediumDialog text buttons
.caption14 pt, regularCaptions
.captionLoose14 pt, regularCaptions with looser line spacing
.terms14 pt, regularTerms text
.dialogText14 pt, regularDialog text
.subtitle14 pt, regularSubtitles
.small12 pt, regularSmall text
.footerLink12 pt, regularFooter links

2.8 Texts

Every text the Cashier shows comes from the texts set for your application at Praxis, in the session language. The keys are the same as the Praxis web Cashier's translation keys, plus a few SDK keys that start with sdk_. Replace any text with CashierConfiguration.texts (CashierTexts).

InitializerDescription
CashierTexts(_:depositButton:withdrawalButton:)Your texts for every language: [CashierTexts.Key: String].
CashierTexts(byLanguage:depositButton:withdrawalButton:)Your texts per language: [String: [CashierTexts.Key: String]], where the language code is matched exactly with the session language (for example "de").
// The same text in every language
let texts = CashierTexts([
    .deposit: "Deposit now",
    .agree_with_terms_of_service: "I accept the terms"
])

// Per language
let localized = CashierTexts(byLanguage: [
    "en": [.deposit: "Deposit now"],
    "de": [.deposit: "Jetzt einzahlen"]
])

Which text wins: a CashierTexts holds either texts for every language (CashierTexts(_:)) or texts per language (CashierTexts(byLanguage:)). Your text wins over the server text. With byLanguage, a session language you did not list uses the server text. A key with no text anywhere shows the key itself.

Main button text. depositButton and withdrawalButton replace the Deposit / Withdraw text of the main button: on the amount page and on the final pay button (on a one-page layout, always). A bank wire still shows Get Payment Details, a card authorization shows Authorize, and Continue on the details page is unchanged. A value equal to a known text key shows that key's text; an empty value means the standard text. They win over the texts for that button in every language. For a different button text per language, set the deposit and withdraw keys with CashierTexts(byLanguage:) instead.

ParameterDescriptionFormatRequired
depositButtonThe main button text of a deposit. Default: nil (the standard text).String?No
withdrawalButtonThe main button text of a withdrawal. Default: nil (the standard text).String?No
let texts = CashierTexts(depositButton: "Top up", withdrawalButton: "Cash out")

Placeholders. Some texts contain placeholders such as {{amount}}, which the Cashier fills in. Keep them in your text.

Keys. Each key has a static property on CashierTexts.Key, named after the key, for example Agree with terms of service is .agree_with_terms_of_service and Payment details is .payment_details_capital. Look up the exact name in the appendix. Every key the Cashier knows has a static property. CashierTexts.Key(rawValue:) takes the key text verbatim, but a key the Cashier does not know is ignored and reported once with configuration_value_ignored.

🚧

Texts are shown as they are. Never put card data, customer data or server text into your texts.


2.9 Fields and methods

These parameters are part of CashierHooks, passed in CashierConfiguration.hooks. They are described with examples in §3.5.

ParameterDescriptionFormatRequired
methodFilterKeeps and reorders payment methods: return the ids to show, in order. Cannot add methods.([CashierMethodInfo]) async -> [String]No
fieldRulesExtra checks on method and billing fields: pattern (regular expression), minimumLength, isRequired, and errorTextKey for the message. Limit to methods with methods.[CashierFieldRule]No
skippedFieldChecksPer method key, field names whose checks are turned off.[String: Set<String>]No
fieldAdjustments.hide(field:method:), .require(field:method:), .defaultValue(_:field:method:).[CashierFieldAdjustment]No

Field names are the names Praxis sends for a method's fields, for example account_number or zip. Your code never sees what the customer types.


2.10 Payment handler

CashierConfiguration.paymentHandler: .praxis (default) or .custom { request in … } to run your own code, for example a risk check, before the payment is sent to Praxis. See §4.


2.11 What your app cannot change

These limits keep card data out of your app and minimize your PCI DSS scope.

Your app cannotWhy
Read or send card numbers, CVVs, card tokens, contact data, billing values or field values.They never leave the SDK.
Charge through your own payment provider.A Payment Handler gets amounts, flags and a sealed payload only.
Replace a block that captures or shows personal data: card form, saved card code, method fields, billing form, bank details.These blocks are sealed. You can place them, and hide them where hiding is allowed, but not rebuild them.
Hide the amount, selected method, total, terms or main button.They carry legal or payment meaning.
Read the CashierSession from slot content.Slot content gets CashierSlotContext only.
See which saved card or account a saved row is.A saved row has the id saved-<n> and an SDK name; its label, masked number and last digits stay in the SDK.
Show your own text inside SDK screens other than through CashierTexts.Every text the Cashier shows comes from texts.
Change spacing or type sizes.Neither is part of CashierTheme.

3. Events and hooks

3.1 CashierHooks

Put your code in CashierHooks and pass it in CashierConfiguration(hooks:). Every hook runs on the main actor.

let hooks = CashierHooks(
    onEvent: { event in analytics.track(event.name.rawValue, traceID: event.traceID) },
    onAmountChange: { update in
        if let total = update.total ?? update.totalCharge { cartView.show(total, update.currency) }
    },
    methodFilter: { methods in methods.filter { !$0.isInMaintenance }.map(\.id) },
    fieldRules: [CashierFieldRule(field: "zip", minimumLength: 4)]
)
let configuration = CashierConfiguration(hooks: hooks)
HookDescription
onEventEach CashierEvent, in order (§3.2).
onAmountChangeThe live amount (§3.3).
methodFilterKeeps and reorders payment methods (§3.4).
fieldRulesExtra checks on fields (§3.5).
skippedFieldChecksField checks to turn off, per method key (§3.5).
fieldAdjustmentsHide a field, make it required, or give it a start value (§3.5).

3.2 Events

Event names are the web Payment Page SDK names, so you can track the app and the web the same way. A few events exist only in the SDK: layout_incomplete, configuration_value_ignored and terms_accepted_by_code. Read the name with event.name.rawValue.

NameRaw valueWhen
initSessioninitSessionThe session was read.
initAppinitAppThe Cashier was set up.
cashierLoadedcashier_loadedThe Cashier is ready.
paymentMethodSelectedpayment_method_selectedA method was selected.
createPaymentPagecreatePaymentPageThe form of the selected method is ready.
hostedPaymentFieldsLoadedhosted_payment_fields_loadedThe card fields showed.
hostedFieldsValid / hostedFieldsInvalidhpf_form_valid / hpf_form_invalidThe card fields became valid or invalid.
methodFieldsLoadedapm_fields_loadedThe method fields showed.
methodFieldsValid / methodFieldsInvalidapm_form_valid / apm_form_invalidThe method fields became valid or invalid.
submitcashier_submitThe payment was handed off.
transactionAttemptedtransaction_attemptedThe payment answer arrived and is OK.
redirectionredirectionA provider page opened.
transactiontransactionA transaction status arrived.
thankYouPageLoadedthank_you_page_loadedThe final result showed.
createResultPagecreateResultPageThe result page was made.
transactionFailedtransaction_failedThe payment ended on an error.
loadingFailedcashier_loading_failedThe Cashier could not load, or ended on an error screen.
layoutIncompletelayout_incompleteYour layout leaves out a block the payment needs. See Required blocks.
configurationValueIgnoredconfiguration_value_ignoredA configuration value you set was ignored, for example an invalid color, a negative amount or a URL that is not https. ignoredName names the field.
termsAcceptedByCodeterms_accepted_by_codeYour app ticked the terms box.
backButtoncashier_back_buttonThe customer tapped the header back button on the first page. This button shows only when header.showsBackButton is true. The Cashier stays open, so your app can react, for example by closing it.
walletNotPresentedwallet_not_presentedThe Apple Pay sheet could not open, so Apple Pay is hidden for the rest of the session. Most often your app's Apple Pay capability does not contain the merchant ID Praxis gave you; a debug build also prints a console warning that names it.

There is no event for a step change (read CashierSnapshot.step), no click event and no per-field event.

Event fields. Every field of CashierEvent, with its format, is listed in the SDK Reference. Events carry the method type, action type, status, error code, card brand, validity, amount and currency, trace ID, the ignored value name, the layout_incomplete reason and the intents; a field is nil when the event does not use it. cashier_loaded always carries currency (the account's base currency, else the session currency) and amount (the session amount, nil when there is none). The two withdrawal error pages send transaction_failed, not cashier_loading_failed.

Deposits and withdrawals. event.intent is the intent of the tab the customer is on (.deposit or .withdrawal), so you can track withdrawals apart from deposits. A card authorization session reports a deposit. secondaryIntents is set on cashier_loaded and cashier_loading_failed in sessions that offer more than one intent.

3.3 Live amount

onAmountChange gets a CashierAmountUpdate while the amount section shows an amount: first when it shows, then each time the amount, charge, display amount, fee, total or currency changes. On a withdrawal, displayAmount is what leaves the balance and total is what the customer receives. When the customer sees only the base currency and the method charges in another currency, displayAmount, fee and total are in the method's currency while currency stays the base currency.

Every field of CashierAmountUpdate is listed in the SDK Reference.

3.4 Method filter

methodFilter gets the methods the picker would offer ([CashierMethodInfo]) and returns the ids to keep, in the order to show. It can remove and reorder methods, but not add one. Unknown ids are ignored. A saved card or account has the opaque id saved-<n>.

🚧

If your filter returns no id from the list it got, the Cashier shows its error screen and ends with the configuration_error code.

3.5 Field rules and adjustments

Field names are the names Praxis sends for a method's fields, for example account_number or zip.

let hooks = CashierHooks(
    fieldRules: [
        CashierFieldRule(field: "account_number", methods: ["example_wallet"], pattern: "^[0-9]+$", minimumLength: 6)
    ],
    skippedFieldChecks: ["example_wallet": ["address"]],
    fieldAdjustments: [
        .hide(field: "state", method: "example_wallet"),
        .require(field: "phone", method: "example_wallet"),
        .defaultValue("GB", field: "country", method: "example_wallet")
    ]
)
TypeDescription
CashierFieldRule(field:methods:pattern:minimumLength:isRequired:errorTextKey:)Adds a check to a method or billing field: a regular expression, a minimum length, or a required value. methods nil means every method. errorTextKey picks the message from CashierTexts.
skippedFieldChecks[method key: Set<field name>]: turns off the checks of the named fields.
CashierFieldAdjustment.hide(field:method:), .require(field:method:), .defaultValue(_:field:method:).

The SDK applies these inside. Your code never sees what the customer types.

3.6 What never reaches your code

Events and hooks never carry card numbers, CVVs, card tokens, customer data (name, email, phone, address), field values, server messages or the session token.

4. Payment handler

4.1 Overview

By default, CashierPaymentHandler.praxis sends the payment to Praxis and the SDK does everything. To step in, for example for your own risk check, pass a .custom handler:

let configuration = CashierConfiguration(paymentHandler: .custom { request in
    guard await myRiskCheck(amount: request.amount, currency: request.currency) else {
        return .notSubmitted
    }
    return await request.payload.submitToPraxis()
})

4.2 What the handler gets

The handler runs once per tap on the final button, after every check passed and after the card is protected. It gets a CashierPaymentRequest:

PropertyDescriptionFormat
amount, currencyThe amount (major units; crypto in the minor units the payment sends) and currency of the payment.Decimal, String
originAmountThe amount the customer entered in the base currency, for a cross-currency payment; nil otherwise.Decimal?
paymentMethodThe method key.String
paymentMethodType"cc" for a card method; nil for other methods.String?
termsAcceptedWhether the terms were accepted.Bool
hasPromotionCodeWhether a promotion code is sent. Never the code itself.Bool
payloadEverything else, sealed.CashierPaymentPayload

The payload cannot be read, printed or inspected. The only thing it can do is submitToPraxis(), which sends it to Praxis exactly as the default handler does.

4.3 What the handler returns

ReturnWhat the Cashier does
The outcome of request.payload.submitToPraxis()Continues as with the default handler: processing, provider page, result.
.notSubmittedNothing was sent. The button stops being busy and the customer stays on the page.
.finished(_:transactionID:)Your code finished the payment another way. The Cashier shows the result for that status (title and icon only). The transaction ID reaches CashierResult.transactionID.
🚧

Payments finished outside Praxis

When your handler returns .finished, Praxis did not process the payment, so no Payment Notification follows for it. Confirm and reconcile such payments in the system that finished them, before you credit the customer. Every payment sent with submitToPraxis() is confirmed by the Payment Notification as usual.

4.4 Rules

  • Once. submitToPraxis() sends at most once. A second call returns .notSubmitted and sends nothing.
  • Timeout. The handler has 130 seconds. After that the Cashier treats the payment as sent with its answer lost: it shows the processing screen and reads the payment result. A later submitToPraxis() sends nothing.
  • Close. CashierSession.close() cancels the handler and closes the payload.
  • Main actor. The handler runs on the main actor.
🚧

A handler cannot charge through your own payment provider. It never gets the card number, CVV, card token, customer contact data or any field value.

What's next


Did this page help you?