SDK Reference
The public methods, parameters and types of the iOS SDK.
This page lists the public methods, parameters and types of the Praxis iOS SDK. For step-by-step instructions, see Accept payments in your iOS app.
Status, closed-by, withdrawal status, step, intent, error code and error category values are structs with static values, not enums, so new values do not break your build. Always keep a default branch when you switch over them.
Presentation
CashierView
CashierViewA SwiftUI view that shows the Cashier.
// The predefined template over a session the view makes and closes
CashierView(
token: String,
environment: CashierEnvironment,
configuration: CashierConfiguration = CashierConfiguration(),
onResult: @escaping @MainActor (CashierResult) -> Void
)
// Your layout over a session the view makes and closes
CashierView(token:environment:configuration:onResult:layout:)
// The predefined template, or your layout, over a session your app holds and closes
CashierView(session: CashierSession)
CashierView(session: CashierSession, layout: () -> Content)| Parameter | Description | Format | Required |
|---|---|---|---|
token | The session token your server got from the Cashier Payment Request (session.auth_token). An empty token shows an error and ends with invalid_token. | String | Yes |
environment | The Praxis environment: .sandbox or .live. | CashierEnvironment | Yes |
configuration | Features, behavior, theme, texts, hooks and payment handler. Default: CashierConfiguration(). | CashierConfiguration | No |
onResult | Called once, on the main actor, when the Cashier closes. | (CashierResult) -> Void | Yes |
layout | Your layout from Cashier blocks and containers. Default: Cashier.AmountFirstLayout(). | @ViewBuilder () -> Content | No |
session | A session your app holds. The view starts it when it appears and never closes it. | CashierSession | Yes, in the session initializers |
CashierView is generic over its layout: a stored property needs the full type, for example CashierView<Cashier.AmountFirstLayout>.
cashierSheet modifier
cashierSheet modifierPresents the Cashier full height over a view, with the SDK's own sheet chrome.
.cashierSheet(
isPresented: Binding<Bool>,
token: String,
environment: CashierEnvironment,
configuration: CashierConfiguration = CashierConfiguration(),
onResult: @escaping @MainActor (CashierResult) -> Void
)
.cashierSheet(isPresented:token:environment:configuration:onResult:layout:)| Parameter | Description | Format | Required |
|---|---|---|---|
isPresented | Whether the Cashier shows. The SDK turns it to false when the customer closes the Cashier. Setting it to false closes the session. | Binding<Bool> | Yes |
token, environment, configuration, onResult, layout | As for CashierView. |
CashierViewController
CashierViewControllerA UIViewController that shows the Cashier in UIKit.
CashierViewController(
token: String,
environment: CashierEnvironment,
configuration: CashierConfiguration = CashierConfiguration(),
slots: CashierSlots = CashierSlots(),
onResult: @escaping @MainActor (CashierResult) -> Void
)
CashierViewController(session: CashierSession, slots: CashierSlots = CashierSlots())
CashierViewController(session: CashierSession, @ViewBuilder layout: @escaping () -> Content)| Parameter | Description | Format | Required |
|---|---|---|---|
slots | Your header, footer, hidden blocks and inserted views. See Customization. Default: CashierSlots() (no slots). | CashierSlots | No |
session | A session your app holds and closes. | CashierSession | Yes, in the session initializers |
layout | Your SwiftUI layout. | @ViewBuilder () -> Content | Yes, in the layout initializer |
| Other parameters | As for CashierView. |
The controller exposes session (CashierSession). Storyboards are not supported. Present it modally or push it. A controller that made its session closes it when it is dismissed or removed from its parent. While a payment runs, a presented controller refuses the swipe down, and a pushed one hides its back button and turns off swipe-back.
CashierScope
CashierScopeConnects your own views to a session: it puts the session and the resolved theme into the SwiftUI environment and starts the session when it first appears. CashierView, .cashierSheet and CashierViewController wrap your layout in a scope for you.
CashierScope(session) {
// your layout
}Environment
CashierEnvironment
CashierEnvironmentThe Praxis environment the Cashier talks to. The SDK has the service addresses of each environment built in. It holds no key or secret.
CashierView(token: token, environment: .sandbox) { result in … }| Value | Description |
|---|---|
.sandbox | The Praxis sandbox, for development and testing. |
.live | The Praxis live environment. |
Use the environment your server created the session in.
When Praxis gives you another domain for your sessions, build the environment from it:
| Value | Description |
|---|---|
try .sandbox(domain: "cashier-test.example.com") | The Praxis sandbox on that domain. |
try .live(domain: "pay.example.com") | The Praxis live environment on that domain. |
A domain that is not a bare host name (no scheme, path or port) throws invalidDomain.
Configuration
CashierConfiguration
CashierConfigurationCashierConfiguration(
features: CashierFeatures = .default,
theme: CashierTheme = CashierTheme(),
header: CashierHeaderOptions = CashierHeaderOptions(),
amount: CashierAmountOptions = CashierAmountOptions(),
paymentMethods: CashierPaymentMethodOptions = CashierPaymentMethodOptions(),
card: CashierCardOptions = CashierCardOptions(),
promotions: CashierPromotionOptions = CashierPromotionOptions(),
billingFields: CashierBillingFields = CashierBillingFields(),
result: CashierResultOptions = CashierResultOptions(),
footer: CashierFooterLinks = CashierFooterLinks(),
texts: CashierTexts = CashierTexts(),
hooks: CashierHooks = CashierHooks(),
paymentHandler: CashierPaymentHandler = .praxis,
returnsAfterResult: Bool = false,
presetAmountEditable: Bool = false
)| Parameter | Description | Format | Required |
|---|---|---|---|
features | The parts of the Cashier that are on. Default: .default (the recommended set). | CashierFeatures | No |
theme | Colors, font, button shape, appearance, field labels. | CashierTheme | No |
header | Balance, Deposit / Withdraw tabs, back and close buttons. | CashierHeaderOptions | No |
amount | Currency format, currency mode, quick amounts. | CashierAmountOptions | No |
paymentMethods | How payment methods show, and field prefill. | CashierPaymentMethodOptions | No |
card | Cardholder name prefill and lock. | CashierCardOptions | No |
promotions | The promotion block. Default: none. | CashierPromotionOptions | No |
billingFields | Editable, read-only or hidden, per billing field. | CashierBillingFields | No |
result | The details on the result screen. | CashierResultOptions | No |
footer | Support and policy links. Default: none, so no footer. | CashierFooterLinks | No |
texts | Texts that win over the server texts, and the main button texts. | CashierTexts | No |
hooks | Events, live amount, method filter, field rules. | CashierHooks | No |
paymentHandler | .praxis or .custom { … }. Default: .praxis. | CashierPaymentHandler | No |
returnsAfterResult | Ends the Cashier as soon as a result arrives that opens no provider page. Default: false. | Bool | No |
presetAmountEditable | The customer can change an amount the session came with. Needs .editableAmount; a zero-amount authorization stays fixed. Default: false. | Bool | No |
Details: Configuration and Settings.
CashierFeatures
CashierFeaturesAn option set. .default is the recommended set; start from it and remove what you do not want.
| Value | Description |
|---|---|
.editableAmount | The customer can enter or change the amount when the session has none. A session amount stays fixed unless presetAmountEditable is true. |
.amountLimits | Method limits are fetched and enforced. |
.currencyChange | The customer can change the currency. |
.savedInstruments | Saved cards and accounts. |
.applePay | Apple 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. |
CashierHeaderOptions
CashierHeaderOptionsCashierHeaderOptions(
balance: Visibility = .mainPages,
paymentType: Visibility = .mainPages,
showsBackButton: Bool = false,
closeButton: CloseButton = .visible
)| Parameter | Description | Format | Required |
|---|---|---|---|
balance | Where the balance shows. Default: .mainPages. | .hidden, .mainPages, .allPages | No |
paymentType | Where the Deposit / Withdraw tabs show. Default: .mainPages. | .hidden, .mainPages, .allPages | No |
showsBackButton | A back button on the first page; a tap sends cashier_back_button. Default: false. | Bool | No |
closeButton | The close button. Default: .visible. | .visible, .hidden | No |
CashierAmountOptions
CashierAmountOptionsCashierAmountOptions(
currencyFormat: CurrencyFormat = .isoCode,
currencyMode: CurrencyMode = .paymentCurrency,
quickAmounts: CashierQuickAmounts = CashierQuickAmounts()
)| Parameter | Description | Format | Required |
|---|---|---|---|
currencyFormat | €10 or EUR 10. Default: .isoCode. | .symbol, .isoCode | No |
currencyMode | Amounts in the payment currency, or in the account's base currency. Default: .paymentCurrency. | .paymentCurrency, .baseCurrency | No |
quickAmounts | The quick amount buttons. Default: none. | CashierQuickAmounts | No |
CashierQuickAmounts
CashierQuickAmountsCashierQuickAmounts(lists: [List] = [], basedOnLastDeposit: Bool = false)
CashierQuickAmounts.List(
amounts: [Choice], // .amount(Decimal) or .maximum
currency: String? = nil,
paymentMethod: String? = nil,
intent: CashierIntent = .deposit,
startingAmount: Decimal? = nil
)| Parameter | Description | Format | Required |
|---|---|---|---|
lists | Button lists; the first match for the method and currency is used. Default: []. | [CashierQuickAmounts.List] | No |
basedOnLastDeposit | Builds deposit buttons from the customer's last deposit. Default: false. | Bool | No |
List.amounts | The buttons, in order. | [CashierQuickAmounts.Choice] | Yes |
List.currency | ISO 4217 code; nil for any currency. | String? | No |
List.paymentMethod | Method key; nil for any method. | String? | No |
List.intent | .deposit or .withdrawal. Default: .deposit. | CashierIntent | No |
List.startingAmount | The amount the Cashier starts with when the session has no amount and the customer no previous deposit. Must be 0 or more. Default: nil. | Decimal? | No |
No lists and basedOnLastDeposit false means quick amounts are off. Rules: Amount and quick amounts.
CashierPaymentMethodOptions
CashierPaymentMethodOptionsCashierPaymentMethodOptions(
lastUsedFirst: Bool = false,
showsLimits: Bool = true,
fees: FeeVisibility = .always,
showsCardExpiry: Bool = false,
allowsRemoval: Bool = false,
prefillsFields: Bool = true
)| Parameter | Description | Format | Required |
|---|---|---|---|
lastUsedFirst | The last used method first. Default: false. | Bool | No |
showsLimits | Limits text on method rows. Default: true. | Bool | No |
fees | Fee text on method rows. Default: .always. | .always, .ifNotZero, .hidden | No |
showsCardExpiry | Expiry date on every saved card; off, an expired card shows expired alone. Default: false. | Bool | No |
allowsRemoval | The customer can remove saved cards and accounts. Default: false. | Bool | No |
prefillsFields | Fills method fields from the profile. Default: true. | Bool | No |
CashierCardOptions
CashierCardOptionsCashierCardOptions(prefillsCardholderName: Bool = false, locksCardholderName: Bool = false)| Parameter | Description | Format | Required |
|---|---|---|---|
prefillsCardholderName | Fills the cardholder name with the customer's name. Default: false. | Bool | No |
locksCardholderName | Locks the cardholder name and the billing name. Use with prefillsCardholderName. Default: false. | Bool | No |
CashierPromotionOptions
CashierPromotionOptionsCashierPromotionOptions(style: Style? = nil)| Parameter | Description | Format | Required |
|---|---|---|---|
style | .bonusList, .codeField, or nil for no promotions. Default: nil. | CashierPromotionOptions.Style? | No |
CashierBillingFields
CashierBillingFieldsCashierBillingFields(country:name:email:phone:postalCode:state:city:address:countries:)Each field parameter is .editable (default), .readOnly or .hidden. countries (CashierCountryList) sets the countries the country sheet offers and which come first; by default, every country in alphabetical order. Details: Billing fields.
CashierResultOptions
CashierResultOptionsCashierResultOptions(
showsDeclineReason: Bool = true,
showsDate: Bool = false,
showsFee: Bool = false,
showsTotal: Bool = false,
showsBonus: Bool = false,
showsPaymentInstrument: Bool = false,
showsBillingDescriptor: Bool = false
)Each value shows one detail on the result screen. Details: Result screen.
CashierFooterLinks
CashierFooterLinksCashierFooterLinks(
supportWebsite: URL? = nil,
supportEmail: String? = nil,
supportPhone: String? = nil,
privacyPolicy: URL? = nil,
termsOfService: URL? = nil
)The footer shows when at least one link is set. URLs must be https. Details: Footer links.
CashierTheme and CashierTexts
CashierTheme and CashierTextsEvery parameter, color role, text style and text key is listed in Customization.
CashierTheme(brandColorLight:brandColorDark:brandTextColorLight:brandTextColorDark:fontName:buttonShape:appearance:fieldLabelStyle:roleColors:cornerRadius:)
CashierTheme(brand: Color, brandText: Color? = nil)
CashierTexts(_ texts: [CashierTexts.Key: String] = [:], depositButton: String? = nil, withdrawalButton: String? = nil)
CashierTexts(byLanguage: [String: [CashierTexts.Key: String]], depositButton: String? = nil, withdrawalButton: String? = nil)CashierHooks
CashierHooksCashierHooks(
onEvent: (@MainActor @Sendable (CashierEvent) -> Void)? = nil,
onAmountChange: (@MainActor @Sendable (CashierAmountUpdate) -> Void)? = nil,
methodFilter: (@MainActor @Sendable ([CashierMethodInfo]) async -> [String])? = nil,
fieldRules: [CashierFieldRule] = [],
skippedFieldChecks: [String: Set<String>] = [:],
fieldAdjustments: [CashierFieldAdjustment] = []
)| Parameter | Description | Format | Required |
|---|---|---|---|
onEvent | Each event, in order. | (CashierEvent) -> Void | No |
onAmountChange | The live amount. | (CashierAmountUpdate) -> Void | No |
methodFilter | Returns the method ids to show, in order. Cannot add methods. | ([CashierMethodInfo]) async -> [String] | No |
fieldRules | Extra field checks. | [CashierFieldRule] | No |
skippedFieldChecks | Per method key, field names whose checks are off. | [String: Set<String>] | No |
fieldAdjustments | Hide, require or prefill fields. | [CashierFieldAdjustment] | No |
All hooks run on the main actor. Details: Events & Hooks.
CashierFieldRule
CashierFieldRuleCashierFieldRule(field: String, methods: Set<String>? = nil, pattern: String? = nil,
minimumLength: Int? = nil, isRequired: Bool = false, errorTextKey: CashierTexts.Key? = nil)| Parameter | Description | Format | Required |
|---|---|---|---|
field | The field name as Praxis sends it, for example zip. | String | Yes |
methods | The method keys the rule applies to. Default: nil (every method). | Set<String>? | No |
pattern | A regular expression the value must match. An invalid pattern is ignored. | String? | No |
minimumLength | The least number of characters. | Int? | No |
isRequired | The field must hold a value. Default: false. | Bool | No |
errorTextKey | The text key of the message. | CashierTexts.Key? | No |
CashierFieldAdjustment
CashierFieldAdjustment| Method | Description |
|---|---|
.hide(field:method:) | Hides a field of a method. |
.require(field:method:) | Makes a field of a method required. |
.defaultValue(_:field:method:) | Gives a field of a method a start value. |
CashierPaymentHandler
CashierPaymentHandler| Value | Description |
|---|---|
.praxis | The SDK sends the payment to Praxis. The default. |
.custom(_:) | Your async code gets a CashierPaymentRequest and returns a CashierPaymentOutcome. It runs on the main actor, once per final tap, with a 130-second limit. |
CashierPaymentRequest: amount (Decimal), currency (String), originAmount (Decimal?, the base-currency amount of a cross-currency payment), paymentMethod (String), paymentMethodType (String?, "cc" for a card method, nil otherwise), termsAccepted (Bool), hasPromotionCode (Bool), payload (CashierPaymentPayload, sealed; its only method is submitToPraxis()).
CashierPaymentOutcome: the outcome of submitToPraxis(), .notSubmitted, or .finished(_ status: CashierResult.Status, transactionID: String? = nil). Details: Payment Handler.
Session
CashierSession
CashierSessionOne payment session. @Observable and @MainActor. Creating it does no network work; it starts when a CashierScope (or CashierView) first appears, or when you call start().
CashierSession(
token: String,
environment: CashierEnvironment,
configuration: CashierConfiguration = CashierConfiguration(),
onResult: @escaping @MainActor (CashierResult) -> Void = { _ in }
)| Member | Description |
|---|---|
snapshot | The read-only CashierSnapshot. |
start() | Starts the session. Called for you by the scope. |
close() | Closes the Cashier and calls onResult once with closedBy .code: .canceled before a payment, .pending while one runs. A closed session cannot start again. |
next() | Does what the main button does now. |
back() | Shows the page before in Cashier.Pages. Does nothing on the first page, outside the form, while a payment runs, or after close(); snapshot.canGoBack says when it moves. |
setAmount(_ amount: Decimal) | Sets the amount, in major units. Ignored when the amount is locked. |
selectCurrency(_ code: String) | Picks a currency from snapshot.currencies. |
selectMethod(id: String) | Selects a method from snapshot.methods. |
selectBonus(id: String?) | Selects an offered bonus, or none with nil. |
applyPromotionCode() | Applies the code typed in the promotion code field. |
setTermsAccepted(_ accepted: Bool) | Ticks or unticks the terms box. |
Commands that do not apply in the current state are ignored.
CashierSnapshot
CashierSnapshot| Property | Description | Format |
|---|---|---|
step | The part of the Cashier the customer is on. | CashierStep |
isBusy | Starting, paying or checking the status. | Bool |
canPay | The main button pays now and is enabled. | Bool |
canContinue | The main button continues to another section and is enabled. | Bool |
canGoBack | Going back works now: back() moves. False on the first page, on a single page, while a payment runs, during 3-D Secure and after a result. | Bool |
amount | The amount to pay, in major units. Nil before the session starts. | Decimal? |
currency | The ISO 4217 code of amount. | String? |
currencies | The currencies the customer can pick. | [String] |
intent | The intent of the active tab. | CashierIntent |
paymentMethod | The selected method. | CashierMethodInfo? |
methods | The methods the customer can pick: server order, then saved rows. | [CashierMethodInfo] |
termsRequired | The terms must be accepted before paying. | Bool |
termsAccepted | The terms box is ticked. | Bool |
bonus | The selected bonus. | CashierBonusInfo? |
bonuses | The offered bonuses. | [CashierBonusInfo] |
fee | The fee of the selected method. | Decimal? |
total | The total to pay (on a withdrawal: what the customer receives). | Decimal? |
result | The result, once the payment ended. While the Cashier is still open, result.closedBy is .sdk. | CashierResult? |
amountLimits | The selected method's smallest and largest amount, for example for a Max button. Nil with no method, when .amountLimits is off, or when the method has no limit for the currency. On a withdrawal the maximum is capped by the balance. | CashierAmountLimits? |
language | The session language your server set, for example "en". The Cashier shows its texts in it, which can differ from the app's language. Nil before the session starts. | String? |
isRightToLeft | The session language reads right to left (he, ar). CashierView and CashierScope then mirror the Cashier; with CashierSessionScope, set the layout direction of your views from it. | Bool |
CashierStep
CashierStep| Value | Description |
|---|---|
.loading | The Cashier is starting, or a tab is loading. |
.amount | The amount section: amount, currency and method. |
.details | The method details section. |
.billing | The billing section. |
.result | The payment is processing, needs a decision, or ended. |
.error | An error screen shows. |
CashierIntent
CashierIntent| Value | Description |
|---|---|
.deposit | The customer pays in. Authorization sessions report a deposit. |
.withdrawal | The customer withdraws. |
CashierMethodInfo
CashierMethodInfo| Property | Description | Format |
|---|---|---|
id | The method key, or saved-<n> for a saved card or account. | String |
name | The method title, or an SDK name for a saved row (no digits). | String |
type | The method type, for example cc. | String? |
logoURL | The method logo. | URL? |
isSaved | The row is a saved card or account. | Bool |
isInMaintenance | The method cannot pay now. | Bool |
CashierBonusInfo
CashierBonusInfo| Property | Description | Format |
|---|---|---|
id | The bonus id. | String |
title | The bonus title. | String |
CashierSlotContext
CashierSlotContextWhat slot content reads from @Environment(\.cashierSlotContext): snapshot, back(), close(), next(). See Customization.
Results
CashierResult
CashierResult| Property | Description | Format |
|---|---|---|
status | How the Cashier ended. | CashierResult.Status |
closedBy | Who closed it. | CashierResult.ClosedBy |
errorCode | Why the payment failed. Set only for .failed. | CashierErrorCode? |
transactionID | The Praxis transaction ID. | String? |
traceID | The Praxis trace ID, for support. | String? |
amount | The transaction amount, in major units. Nil without a transaction. | Decimal? |
currency | The ISO 4217 code of amount. | String? |
paymentMethod | The Praxis name of the payment method that paid. | String? |
orderID | Your order_id. | String? |
cardBrand | The card brand, for example Visa. | String? |
intent | .deposit or .withdrawal. | CashierIntent? |
withdrawalStatus | The Praxis status of a withdrawal. Nil for a deposit, a withdrawal without a transaction, or a status the SDK does not list. | CashierResult.WithdrawalStatus? |
CashierResult.Status
CashierResult.Status| Case | Description |
|---|---|
.completed | The payment was approved. |
.authorized | The card was authorized and not charged yet. |
.pending | Still processing, or a withdrawal request waits to be paid out. |
.failed | The payment did not go through. |
.canceled | The Cashier closed before a payment started. |
CashierResult.ClosedBy
CashierResult.ClosedBy| Case | Description |
|---|---|
.customer | The customer tapped close or a button under the result. |
.code | Your app closed the Cashier: it called close() on the session or the slot context, dismissed the CashierView or CashierViewController that made the session, or set the .cashierSheet binding to false. |
.sdk | The SDK ended the session, for example with returnsAfterResult. |
CashierResult.WithdrawalStatus
CashierResult.WithdrawalStatus.approved, .authorized, .requested, .requestedPayout, .partialPayout, .pending, .pendingAsync, .initialized, .verification, .declined, .error, .canceled. Meanings: Results & Error Codes.
Errors
CashierErrorCode
CashierErrorCode| Case | Raw value | Category |
|---|---|---|
.declined | declined | payment |
.cardInvalid | card_invalid | payment |
.cardNotAccepted | card_not_accepted | payment |
.transactionCanceled | transaction_canceled | payment |
.noPaymentMethod | no_payment_method | payment |
.walletUnavailable | wallet_unavailable | payment |
.network | network | network |
.sessionExpired | session_expired | session |
.sessionUnavailable | session_unavailable | session |
.invalidToken | invalid_token | session |
.validationFailed | validation_failed | validation |
.serverError | server_error | server |
.unexpectedResponse | unexpected_response | server |
.unknown | unknown | server |
.configurationError | configuration_error | configuration |
.paymentMethodUnavailable | payment_method_unavailable | configuration |
errorCode.category is one of .session, .network, .server, .validation, .configuration, .payment; category.rawValue gives it as text for analytics. CashierErrorCode(rawValue:) makes a code from a logged value; prefer the static values. What each code means and what to do: Results & Error Codes.
Events
CashierEvent
CashierEvent| Property | Description | Format |
|---|---|---|
name | The event. Every name is listed in Events & Hooks. | CashierEvent.Name |
paymentMethod | The type of the selected method, for example cc for cards (the same as CashierMethodInfo.type). | String? |
methodKeys | Empty on cashier_loaded; nil on every other event. | [String]? |
actionType | The action type of the payment answer, for example redirect or await. | String? |
status | The transaction status. | String? |
errorCode | On transaction_failed and cashier_loading_failed: the same code as the result. | CashierErrorCode? |
cardBrand | The card brand in lower case, for example visa. | String? |
isValid | The validity of the card or method fields. | Bool? |
amount, currency | The amount (major units) and currency. | Decimal?, String? |
traceID | The Praxis trace ID. | String? |
ignoredName | On configuration_value_ignored: the value that was ignored. | String? |
reason | On layout_incomplete: requiredBlock (a required block is missing), duplicateSealed (two card blocks on screen at once) or presentation (blocks are outside Cashier.Pages, so only the amount section opens). | String? |
missing | On layout_incomplete: the blocks your layout must draw and does not, for example ["cashier.mainButton", "cashier.terms"], or a left-out card input such as cashier.cardField.expiry. Empty when the reason is presentation. | [String]? |
intent | The intent of the tab the customer is on. Nil on initSession, initApp, createPaymentPage, createResultPage, layout_incomplete, configuration_value_ignored and terms_accepted_by_code. | CashierIntent? |
secondaryIntents | The session's other intents. | [CashierIntent]? |
Event names and when each is sent: Events & Hooks.
CashierAmountUpdate
CashierAmountUpdate| Property | Description | Format |
|---|---|---|
amount | The amount, in the account's base currency. | Decimal |
totalCharge | The amount to charge in currency. | Decimal? |
displayAmount | The amount in currency, an included fee taken out (withdrawal: what leaves the balance). | Decimal? |
fee | The fee in currency. | Decimal? |
total | The total to pay (withdrawal: what the customer receives). | Decimal? |
currency | The payment currency. | String |
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.
Slots
Slot methods
Methods of Cashier.AmountFirstLayout and Cashier.OnePageLayout. Add them to the template and pass it as the last closure of CashierView or .cashierSheet.
.cashierHeader { /* your view */ }
.cashierFooter { /* your view */ }
.cashierHide(_ block: HideableBlock)
.cashierInsert(before anchor: CashierAnchor) { /* your view */ }
.cashierInsert(after anchor: CashierAnchor) { /* your view */ }CashierSlots
CashierSlotsThe UIKit form of the slot methods, passed to CashierViewController.
| Method | Description |
|---|---|
setHeader(_:) | Replaces the header with your UIView. |
setFooter(_:) | Replaces the footer with your UIView. |
hide(_:) | Hides a HideableBlock. |
insert(before:_:), insert(after:_:) | Adds your UIView before or after a CashierAnchor. |
HideableBlock
HideableBlock.header, .footer, .quickAmounts, .promotions.
CashierAnchor
CashierAnchor.header, .amount, .quickAmounts, .promotions, .selectedMethod, .amountChangeNote, .totalToPay, .terms, .mainButton, .footer, .stepTitle, .cardForm, .savedCardCode, .walletSwitch, .methodFields, .bankPicker, .saveCardNote, .billingForm, .result.
Where each block shows and what each slot can do: Customization.
Theme helpers
CashierResolvedTheme
CashierResolvedThemeRead it with @Environment(\.cashierResolvedTheme) inside the Cashier.
| Member | Description | Format |
|---|---|---|
color(_:) | The color of a CashierTheme.Role. | Color |
cornerRadius | The corner radius of buttons and cards. | CGFloat |
spacing(_:) | A step of the spacing scale, .s2 to .s40. | CGFloat |
font(_:) | The font of a TextStyle. | Font |
cashierFont(_:)
cashierFont(_:).cashierFont(_ style: CashierResolvedTheme.TextStyle)Sets the font, letter spacing and line height of a Cashier text style on your text, following Dynamic Type. Spacing steps and text styles are listed in Customization.
Layout
Cashier.AmountFirstLayout
Cashier.AmountFirstLayoutThe predefined template. CashierView, .cashierSheet and CashierViewController use it when you pass no layout. Up to three pages: the amount and the method, the method details, and billing. Pages a payment does not need are skipped.
Cashier.AmountFirstLayout()Cashier.OnePageLayout
Cashier.OnePageLayoutThe second pre-built layout: the same blocks on one page. The main button always pays.
Cashier.OnePageLayout()Both layouts take the slot methods (see Slots).
Cashier.Pages
Cashier.PagesYour own pages, in your own order. The main button runs the checks of the page and shows the next page; on the last page that shows, it pays. While the Cashier loads, processes or shows a result or an error, the outcome page shows instead.
Cashier.Pages(
@Cashier.PagesBuilder pages: () -> YourPages,
@ViewBuilder bottom: () -> Bottom, // optional
@ViewBuilder outcome: () -> OutcomePage // optional; default Cashier.Outcome()
)| Parameter | Description | Format | Required |
|---|---|---|---|
pages | The Cashier.Pages, in the order the customer goes through them. Write them one after the other; an if or a switch around a page is not supported (use cashierPageShown(when:)). | @Cashier.PagesBuilder () -> YourPages | Yes |
bottom | The pinned bottom area of the pages that have none of their own, usually the main button. | @ViewBuilder () -> Bottom | No |
outcome | The page for loading, processing, results and errors. Default: Cashier.Outcome(). | @ViewBuilder () -> OutcomePage | No |
Every block of your layout must be inside Cashier.Pages. Blocks outside it give layout_incomplete with the reason presentation. How the pages, their checks and the required blocks work: Blocks & Containers.
Cashier.Page
Cashier.PageOne page of Cashier.Pages. A page opens the sections of its checks; the last page that shows also opens every section no earlier page opened. Each page is drawn only while it shows.
Cashier.Page(
_ title: String,
validates checks: Cashier.PageCheck..., // optional
@ViewBuilder content: () -> Content,
@ViewBuilder bottom: () -> Bottom, // optional
@ViewBuilder footer: () -> Footer // optional; needs bottom
)| Parameter | Description | Format | Required |
|---|---|---|---|
title | The page's title, in the customer's language. VoiceOver reads it when the page shows; your views read it from @Environment(\.cashierPage). With an empty title, VoiceOver moves to the top of the page and a Cashier.StepTitle on it takes the focus. | String | Yes |
checks | What the main button checks before the customer may leave the page. None by default. | Cashier.PageCheck... | No |
content | The page's content. It scrolls. | @ViewBuilder () -> Content | Yes |
bottom | The page's pinned bottom area, in place of the bottom of Cashier.Pages. | @ViewBuilder () -> Bottom | No |
footer | What shows under the bottom area, for example Cashier.Footer(). On a page that scrolls as a whole, it shows once the customer scrolls to the end; on a page whose content scrolls, it stays pinned under the bottom area. | @ViewBuilder () -> Footer | No |
cashierPageScrolling(_:)
cashierPageScrolling(_:)Sets how a Cashier.Page scrolls.
Cashier.Page(…) { … }
.cashierPageScrolling(_ scrolling: Cashier.PageScrolling)Cashier.PageScrolling values:
| Value | Description |
|---|---|
.wholePage | The content and the bottom area scroll as one page. The bottom area sticks to the bottom of the screen until its own place scrolls into view, and the footer follows it. The default. |
.contentOnly | Only the content scrolls. A Cashier.Header at the top of the content stays pinned, and the bottom area and the footer stay pinned at the bottom. |
cashierPageShown(when:)
cashierPageShown(when:)Shows a Cashier.Page only while a rule returns true. Cashier.Pages asks again whenever the payment changes: the method, the amount, the currency. A hidden page is skipped by the main button and by back; when the page the customer is on hides, the page before it shows.
Cashier.Page(…) { … }
.cashierPageShown(when isShown: @escaping @MainActor @Sendable (Cashier.PageEligibility) -> Bool)
Cashier.Page(…) { … }
.cashierPageShown(_ isShown: Bool) // a decision your app makes itselfCashier.PageEligibility, what the rule reads:
| Member | Description | Format |
|---|---|---|
isNeeded | The payment needs this page now: it runs one check the payment needs, or no check at all. For example, a billing page is not needed when the payment has no billing field. | Bool |
needs(_:) | The payment needs this check now. The method, the amount and the terms are always needed. | (Cashier.PageCheck) -> Bool |
snapshot | The Cashier's state now. | CashierSnapshot |
Cashier.Page("", validates: .billing) { Cashier.BillingForm() }
.cashierPageShown { page in page.isNeeded }Cashier.PageCheck
Cashier.PageCheckA check a page runs before the customer may leave it. Pass it to validates: of Cashier.Page.
| Value | The main button lets the customer leave the page when | Section it opens | Block the page draws |
|---|---|---|---|
.method | A method is chosen and its details have loaded. The button stays disabled until then. | Amount | None |
.amount | The amount and the currency are set, payable and inside the limits. The button stays disabled until then. | Amount | None |
.methodDetails | The card, the saved card code, the method fields or the bank are valid. A tap shows every error of the page instead. | Method details | Cashier.MethodDetails or the single detail blocks |
.billing | The billing fields are valid. A tap shows every error of the page instead. | Billing | Cashier.BillingForm |
.terms | The terms box is ticked when it is required. A tap shows the terms error instead. | None | Cashier.Terms |
rawValue (and description) gives the check as text, for logs.
Cashier.PageContext
Cashier.PageContextThe page the customer is on, for any view inside a Cashier.Page. Read it with @Environment(\.cashierPage). Positions count only the pages that show, so "step 2 of 3" stays right when a rule hides a page.
@Environment(\.cashierPage) private var page| Member | Description | Format |
|---|---|---|
index | The page's place among the pages that show, from 0. | Int |
count | The number of pages that show. | Int |
isFirst | The customer is on the first page that shows. | Bool |
isLast | The customer is on the last page that shows, the one whose main button pays. | Bool |
title | The page's title, as you gave it to Cashier.Page. | String |
back() | Shows the page before, as the header's back button and CashierSession.back() do. Returns false on the first page, outside Cashier.Pages or while a payment runs. | () -> Bool |
Outside Cashier.Pages, the value is one page whose back() does nothing.
cashierPagesStyle(_:)
cashierPagesStyle(_:)Sets how the pages of Cashier.Pages inside a view move from one to the next.
Cashier.Pages { … }
.cashierPagesStyle(_ style: CashierPagesStyle)CashierPagesStyle values:
| Value | Description |
|---|---|
.inPlace | The pages show one at a time in the Cashier's page: a swipe from the leading edge goes back, and a new page slides in. The default. |
.inPlace(swipe:transition:) | The same, with your swipe and transition. Defaults: swipe: .back, transition: .slide. |
CashierPagesStyle.Swipe | Description |
|---|---|
.back | A swipe from the leading edge goes back. The default. |
.backAndForward | A swipe from the leading edge goes back; a swipe from the trailing edge continues, as the main button does (its checks run first). It never pays: on the last page only the main button pays. |
.disabled | No swipe: the main button and back only. |
CashierPagesStyle.Transition | Description |
|---|---|
.slide | The new page slides in from the side it comes from, following the layout direction. It fades under Reduce Motion. The default. |
.fade | The new page fades in. |
.immediate | The new page shows at once. |
.cashierPagesStyle(.inPlace(swipe: .backAndForward, transition: .fade))Blocks
The Cashier blocks (Cashier.Amount(), Cashier.MainButton(), …) and the required-block rule are listed in Blocks & Containers.
Appendix: text keys
Every text key of the Cashier, as the static property on CashierTexts.Key and the key string. Texts with {{…}} contain placeholders.
| Swift name | Text key |
|---|---|
.add | Add |
.add_promotion_code | add_promotion_code |
.address | address |
.addYourCard | addYourCard |
.agree_with_terms_of_service | Agree with terms of service |
.all_Payment_Methods | All Payment Methods |
.allPaymentMethods | allPaymentMethods |
.amount | Amount |
.amount_credited | amount_credited |
.amountFirstExchangeRate | amountFirstExchangeRate |
.appearsOnStatementAs | appearsOnStatementAs |
.apply | Apply |
.are_you_sure_you_want_to_remove | Are you sure you want to remove |
.authorize | Authorize |
.back | back |
.back_to_site | Back to site |
.background_Exchange_Confirmation | Background Exchange Confirmation |
.between | between |
.billing_address | Billing address |
.billingInformation | billingInformation |
.bonus_not_supported | bonus_not_supported |
.bonus_unlocked | bonus_unlocked |
.bonus_unlocked_capital | Bonus_unlocked |
.bonuses_not_available_message | bonuses_not_available_message |
.bonusReceived | bonusReceived |
.cancel | Cancel |
.cancel_pending_withdrawals | cancel_pending_withdrawals |
.cancel_request | cancel_request |
.cancel_withdrawal | cancel_withdrawal |
.cancel_withdrawal_credited_message | cancel_withdrawal_credited_message |
.cancel_withdrawal_request_title | cancel_withdrawal_request_title |
.cannotBeBlank | cannotBeBlank |
.cardHolderName | cardHolderName |
.cardNotAccepted | cardNotAccepted |
.cardNumber | cardNumber |
.cardNumberLabel | cardNumberLabel |
.change_currency | Change currency |
.change_payment_method | Change payment method |
.choose_another_method | Choose another method |
.choose_provider_card | Choose {{provider}} card |
.choose_bonus | Choose bonus |
.choose_different_method | choose_different_method |
.chooseanothermethod | chooseanothermethod |
.city | city |
.close | close |
.confirm | Confirm |
.contact_details | Contact details |
.contact_Support | Contact Support |
.continue | Continue |
.continue_without_bonus | continue_without_bonus |
.copied | Copied! |
.copy | Copy |
.country | country |
.credited_back | credited_back |
.crypto | Crypto |
.currency | Currency |
.customer_support_email | customer_support_email |
.customer_support_link_text | customer_support_link_text |
.customer_support_phone | customer_support_phone |
.customer_support_url | customer_support_url |
.customerName | customerName |
.cvcLabel | cvcLabel |
.date | date |
.debit_or_credit_card | Debit or credit card |
.deposit | deposit |
.deposit_fees | deposit_fees |
.dismiss | dismiss |
.dod_error_text | dod_error_text |
.dod_text | dod_text |
.dod_url | dod_url |
.dod_url_text | dod_url_text |
.download_PDF | Download PDF |
.downloaded | Downloaded |
.email | email |
.emailIsNotValid | emailIsNotValid |
.ending_in | ending in |
.enter_valid_card_number | Enter valid card number |
.enter_valid_date | Enter valid date |
.enter_valid_name | Enter valid name |
.enter_promotion_code | enter_promotion_code |
.enterSecurityCodeForCard | enterSecurityCodeForCard |
.exchange_rate_may_vary | exchange_rate_may_vary |
.expired | expired |
.expires | expires |
.expiryDate | expiryDate |
.failed_to_remove | Failed to remove |
.fee | Fee |
.fiat | Fiat |
.field_invalid | Field invalid |
.final_amount_may_vary_by | Final amount may vary by |
.from | from |
.from_capital | From |
.get_Payment_Details | Get Payment Details |
.get_full_bonus_just | get_full_bonus_just |
.go_back_capital | Go back |
.go_back | go-back |
.help | Help |
.higher_deposit_needed | higher_deposit_needed |
.higher_deposit_needed_message | higher_deposit_needed_message |
.higher_withdrawal_needed_message | higher_withdrawal_needed_message |
.hours | hours |
.iaccept | iaccept |
.idontaccept | idontaccept |
.if_no_the_transaction_will_be_processed_without_additional_conversion | If no, the transaction will be processed without additional conversion. |
.included_fee | included_fee |
.incorrect_value | Incorrect value |
.insufficient_balance | Insufficient balance |
.invalidInputFormat | invalidInputFormat |
.invalidValue | invalidValue |
.limits | limits |
.maintenance_available_in | maintenance_available_in |
.maintenance_not_available_until_date | maintenance_not_available_until_date |
.maintenance_not_available_until_day | maintenance_not_available_until_day |
.maintenance_now_available | maintenance_now_available |
.maintenance_refresh_to_use | maintenance_refresh_to_use |
.makeAnotherPayment | makeAnotherPayment |
.max | Max |
.maximum | maximum |
.maximum_amount_limit_message | maximum_amount_limit_message |
.maximum_deposit_limit | maximum_deposit_limit |
.maximum_withdrawal_limit | maximum_withdrawal_limit |
.maximumLength | maximumLength |
.min_deposit | Min. deposit |
.minimum | minimum |
.minimum_deposit | Minimum deposit |
.minimum_deposit_for_bonus | minimum_deposit_for_bonus |
.minimum_deposit_required | minimum_deposit_required |
.minimum_withdrawal_required | minimum_withdrawal_required |
.minimumLength | minimumLength |
.minute | minute |
.minutes | minutes |
.more | more |
.nameOnCard | nameOnCard |
.need_help | Need help? |
.newClosed | newClosed |
.newContinue | newContinue |
.no_available_payment_methods | No available payment methods |
.no_saved_cards | No saved cards |
.no_bonus | no_bonus |
.no_fee | no_fee |
.no_fees | no_fees |
.no_pending_withdrawals | no_pending_withdrawals |
.noCountryFound | noCountryFound |
.noCountryFoundSubtitle | noCountryFoundSubtitle |
.noOptions | noOptions |
.noOptionsAvailable | noOptionsAvailable |
.noRegionFound | noRegionFound |
.noRegionFoundSubtitle | noRegionFoundSubtitle |
.partialApprovalBonusWarning | partialApprovalBonusWarning |
.partialApprovalRequestedAmount | partialApprovalRequestedAmount |
.partialApprovalSubtitle | partialApprovalSubtitle |
.partialApprovalSuccessDescription | partialApprovalSuccessDescription |
.partialApprovalSuccessTitle | partialApprovalSuccessTitle |
.partialApprovalTimerPrefix | partialApprovalTimerPrefix |
.partialApprovalTimerSuffix | partialApprovalTimerSuffix |
.partialApprovalTitle | partialApprovalTitle |
.partialApprovalYouCanDeposit | partialApprovalYouCanDeposit |
.payment_details | payment details |
.payment_details_capital | Payment details |
.payment_method_capital | Payment method |
.payment_method_unavailable | Payment method unavailable |
.payment_summary | Payment summary |
.paymentDetails | paymentDetails |
.payments_are_unavailable_in_the_selected_currency | Payments are unavailable in the selected currency |
.phone | phone |
.phoneIsNotValid | phoneIsNotValid |
.pick_another_method | pick_another_method |
.please_contact_customer_support | Please contact customer support |
.please_do_not_close_this_window | Please do not close this window |
.pleaseEnterPayout | pleaseEnterPayout |
.plus | plus |
.postalCode | postalCode |
.powerSlideEnterAmount | powerSlideEnterAmount |
.powerSlideMyAccount | powerSlideMyAccount |
.privacy_Policy | Privacy Policy |
.protected_with_pci | protected_with_pci |
.province | province |
.recently_used | recently_used |
.regionCode | regionCode |
.remove | Remove |
.remove_payment_method | Remove payment method |
.removed | removed |
.search | Search |
.searchCountry | searchCountry |
.searchPhoneCode | searchPhoneCode |
.second | second |
.seconds | seconds |
.securityCode | securityCode |
.select_bank | Select bank |
.select_country | Select country |
.select_region_code | Select region code |
.select_payment_method | select_payment_method |
.show_more | Show more |
.showLess | showLess |
.showMore | showMore |
.state | State |
.temporarily_unavailable | temporarily_unavailable |
.terms_of_Service | Terms of Service |
.terms_conditions_link_text | terms_conditions_link_text |
.terms_conditions_url | terms_conditions_url |
.the_fee_is | the_fee_is |
.to | to |
.to_pay_now_use_another_payment_method | to_pay_now_use_another_payment_method |
.token_provider_is_not_available | Token provider is not available |
.total_add | total_add |
.total_to_pay | total_to_pay |
.traceId | traceId |
.try_another_card | Try another card |
.tryAgain | tryAgain |
.unsuccessful_transaction | unsuccessful_transaction |
.unsuccessful_transaction_apm | unsuccessful_transaction_apm |
.unsuccessful_transaction_ob | unsuccessful_transaction_ob |
.up_to | up to |
.we_will_save_your_card | we_will_save_your_card |
.withdraw | withdraw |
.withdrawal_cancelled_success | withdrawal_cancelled_success |
.withdrawal_fees | withdrawal_fees |
.withdrawal_requests | withdrawal_requests |
.withdrawal_request_accepted | withdrawal-request-accepted |
.withdrawal_request_message | withdrawal-request-message |
.you_add | you_add |
.you_pay | you_pay |
.you_pay_in | you_pay_in |
.you_receive | you_receive |
.you_receive_in | you_receive_in |
.you_withdraw | you_withdraw |
.youll_get_funds | youll_get_funds |
.your_transaction_is_processing | Your transaction is processing. |
.requestAccepted | requestAccepted |
.transaction_successful | Transaction successful |
.transactionAuthorized | transactionAuthorized |
.your_transaction_failed | Your transaction failed |
.your_transaction_has_been_canceled | Your transaction has been canceled |
.your_transaction_is_pending | Your transaction is pending |
.select_currency_to_pay_in | select_currency_to_pay_in |
.footerPanoramic | footerPanoramic |
.invalidIbanFormat | invalidIbanFormat |
.invalidBicFormat | invalidBicFormat |
.entrada_inv_lida_corrija | Entrada inválida, corrija |
.can_t_get_session_information | Can't get session information |
.token_is_invalid | Token is invalid |
.if_you_require_assistance_or_technical_support_please_contact_customer_support | If you require assistance or technical support, please contact customer support. |
.somethingWentWrong | somethingWentWrong |
.do_you_accept_potential_conversion_charges_to_increase_the_chances_of_completing_the_transaction_successfully | Do you accept potential conversion charges to increase the chances of completing the transaction successfully? |
.additional_currency_conversion_may_be_applied_to_complete_the_transaction_successfully | Additional currency conversion may be applied to complete the transaction successfully. |
.this_card_cannot_be_accepted_Please_consider_using_another_card_or_trying_a_different_payment_method | This card cannot be accepted. Please consider using another card or trying a different payment method. |
.tryAnotherMethodText | tryAnotherMethodText |
.payment_method_not_available | Payment method not available. |
.please_contact_your_site_administrator | Please contact your site administrator. |
.session_expired | Session expired |
.your_session_has_expired_Please_try_again_by_starting_over | Your session has expired. Please try again by starting over. |
.something_went_wrong | Something went wrong. |
.please_contact_your_system_administrator_Code_101 | Please contact your system administrator (Code: 101) |
.please_try_again_with_lower_amount | Please try again with lower amount. |
.apologies_it_appears_that_you_don_t_have_any_payment_details_registered_to_use_for_withdrawal_request | Apologies, it appears that you don't have any payment details registered to use for withdrawal request |
.sdk_deposit_limit_alert | sdk_deposit_limit_alert |
.sdk_clear_search | sdk_clear_search |
.sdk_fee_info | sdk_fee_info |
.sdk_wallet_transaction_failed | sdk_wallet_transaction_failed (on the Apple Pay sheet for a declined payment with a message; default: Transaction failed. {{error_message}}) |
.sdk_wallet_payment_declined | sdk_wallet_payment_declined (declined, no message; default: "Payment declined. Please choose another card.") |
.sdk_wallet_something_went_wrong | sdk_wallet_something_went_wrong (on the Apple Pay sheet for other errors; default: Something went wrong. {{error_message}}) |
.sdk_wallet_no_processor | sdk_wallet_no_processor (on the Apple Pay sheet when the card cannot be used; when you do not set it, sdk_wallet_no_gateways shows) |
.sdk_wallet_no_gateways | sdk_wallet_no_gateways (on the Apple Pay sheet when the card cannot be used and sdk_wallet_no_processor is not set) |
.sdk_bank_file_bank_name | sdk_bank_file_bank_name |
.sdk_saved_card | sdk_saved_card |
.sdk_saved_account | sdk_saved_account |
.sdk_pix_key_type_label | sdk_pix_key_type_label |
.sdk_pix_bank_code_label | sdk_pix_bank_code_label |
.sdk_pix_bank_branch_label | sdk_pix_bank_branch_label |
.sdk_pix_bank_account_label | sdk_pix_bank_account_label |
.sdk_pix_bank_account_digit_label | sdk_pix_bank_account_digit_label |
.sdk_pix_bank_account_type_label | sdk_pix_bank_account_type_label |
.insufficient_funds_for_amount_deposit_Try_a_lower_amount | Insufficient funds for {{amount}} deposit. Try a lower amount. |
.sdk_cvv_show | sdk_cvv_show |
.sdk_cvv_hide | sdk_cvv_hide |
What's next
Updated about 18 hours ago