Results and error codes

This page explains what the Cashier returns when it closes and what each error code means (this page), and how to fix common problems (Troubleshooting).

CashierResult

Your app gets one CashierResult when the Cashier closes, in onResult.

⚠️

A result is not a payment confirmation

completed on the device does not prove that the money moved. Confirm every payment on your server from the Payment Notification before you credit or debit the customer.

PropertyDescriptionFormat
statusHow the Cashier ended (Status).CashierResult.Status
closedByWho closed it (Closed by).CashierResult.ClosedBy
errorCodeWhy the payment did not complete. Set only when status is .failed.CashierErrorCode?
transactionIDThe Praxis transaction ID, when a transaction exists. Use it to find the payment on your server.String?
traceIDThe Praxis trace ID, for support requests.String?
amountThe amount of the transaction, in major units (for example 50.00). Nil without a transaction.Decimal?
currencyThe ISO 4217 currency code of amount.String?
paymentMethodThe Praxis name of the payment method that paid. Use it to match the result with your records, not for display.String?
orderIDYour order_id of the session.String?
cardBrandThe card brand, for example "Visa". Never a card number or any part of one.String?
intent.deposit or .withdrawal. Nil when the Cashier closed before the session was read.CashierIntent?
withdrawalStatusThe Praxis status of a withdrawal's transaction (Withdrawals). Nil for a deposit, for a withdrawal without a transaction, and for a status this SDK version does not list. Your server's Payment Notification is the source of truth.CashierResult.WithdrawalStatus?

The result never carries error text, customer data or card data.

Status

StatusRaw valueMeaning
.completedcompletedThe payment was approved.
.authorizedauthorizedThe card was authorized and not charged yet, for example a zero-amount authorization.
.pendingpendingThe payment is still processing, or a withdrawal request was accepted and waits to be paid out. The final status reaches your server later.
.failedfailedThe payment did not go through. errorCode says why.
.canceledcanceledThe Cashier closed before a payment started.

Status, closed-by, withdrawal status, step, intent, error code and error category values are structs with static values, not enums, so new values in later SDK versions do not break your build. Always keep a default branch when you switch over them.

Closed by

ValueMeaning
.customerThe customer tapped the close button, or a button under the result.
.codeYour 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.
.sdkThe SDK ended the session itself, for example with returnsAfterResult.

Withdrawals

A withdrawal ends with the same statuses as a deposit. result.intent is .withdrawal, and result.withdrawalStatus carries the Praxis status of the withdrawal. A request Praxis accepted but has not paid out yet ends with .pending and withdrawalStatus .requested:

if result.intent == .withdrawal, result.withdrawalStatus == .requested {
    showRequestAccepted()
}
withdrawalStatusRaw valueMeaning
.approvedapprovedPaid out.
.authorizedauthorizedAuthorized and waits to be paid out. The result status is .authorized.
.requestedrequestedThe withdrawal request was accepted and waits to be paid out.
.requestedPayoutrequested_payoutThe payout request was accepted and waits to be paid out.
.partialPayoutpartial_payoutOnly part of the amount was paid out. The result status is .pending; confirm the paid amount on your server.
.pendingpendingStill processing.
.pendingAsyncpending_asyncStill processing at the provider.
.initializedinitializedCreated, not processing yet.
.verificationverificationBeing verified.
.declineddeclinedRefused.
.errorerrorFailed.
.canceledcancelledCanceled.

See Transaction Statuses.

Error codes

The SDK never sends error text to your app. Map each code to your own message, in your own language:

func message(for code: CashierErrorCode?) -> LocalizedStringResource {
    switch code {
    case .declined:       "Your bank declined the payment. Try another card."
    case .network:        "Check your connection. If you were charged, the payment will appear shortly."
    case .sessionExpired: "This payment session expired. Please start again."
    default:              "The payment did not go through. Please try again."
    }
}
CodeRaw valueCategoryMoney taken?What your app can do
.declineddeclinedpaymentNoAsk for another card or method.
.cardInvalidcard_invalidpaymentNoAsk the customer to check the card. A card typed in the Cashier that can be corrected stays on the card form and reports nothing; this code comes from a saved payout card sent with no security code.
.cardNotAcceptedcard_not_acceptedpaymentNoTry again later.
.transactionCanceledtransaction_canceledpaymentNoThe payment was canceled. The customer may pay again.
.noPaymentMethodno_payment_methodpaymentNoNo payment method is available for this session and currency.
.networknetworknetworkMaybeCheck the final status on your server.
.sessionExpiredsession_expiredsessionNoCreate a new session.
.sessionUnavailablesession_unavailablesessionNoThe Cashier could not read the session when it opened. Create a new session.
.invalidTokeninvalid_tokensessionNoThe token was empty; nothing was sent. Pass the token your server got.
.validationFailedvalidation_failedvalidationNoCheck the amount and the session settings. A withdrawal's preset amount must not be above the balance.
.serverErrorserver_errorserverMaybeCheck the final status on your server.
.unexpectedResponseunexpected_responseserverMaybeCheck the final status; update the SDK.
.unknownunknownserverMaybeCheck the final status on your server.
.configurationErrorconfiguration_errorconfigurationNoThe session was created for the web Cashier (create it with channel: ios_sdk), a payment method needs a native SDK this Cashier does not have, or your method filter returned no id from the list it got. Check the session and your filter.
.paymentMethodUnavailablepayment_method_unavailableconfigurationNoThe selected method could not be shown; nothing was sent. Try again or use another method. On a withdrawal it also ends the error page of a card withdrawal with no saved card, no new card allowed and no other method, or of a method that pays only to an account the customer has none of.

Use errorCode.category (.session, .network, .server, .validation, .configuration, .payment) to group codes instead of handling each one.

.contactEncryptionUnavailable (contact_encryption_unavailable) and .unsupportedSessionType (unsupported_session_type) exist for compatibility; this SDK version never sends them.

Codes are stable: a released code never changes its meaning. New codes can be added, so always keep a default branch.

When the Cashier cannot open (an empty token or a session it cannot read), it shows an error screen and, once closed, ends with .failed and the code of that screen.

📘

Support requests

Log the orderID, transactionID, traceID and errorCode.rawValue of each result. When you contact your CSM about a payment, include them with the SDK version, the iOS version and the sequence of event names you received.


Did this page help you?