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
completedon 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.
| Property | Description | Format |
|---|---|---|
| status | How the Cashier ended (Status). | CashierResult.Status |
| closedBy | Who closed it (Closed by). | CashierResult.ClosedBy |
| errorCode | Why the payment did not complete. Set only when status is .failed. | CashierErrorCode? |
| transactionID | The Praxis transaction ID, when a transaction exists. Use it to find the payment on your server. | String? |
| traceID | The Praxis trace ID, for support requests. | String? |
| amount | The amount of the transaction, in major units (for example 50.00). Nil without a transaction. | Decimal? |
| currency | The ISO 4217 currency code of amount. | String? |
| paymentMethod | The Praxis name of the payment method that paid. Use it to match the result with your records, not for display. | String? |
| orderID | Your order_id of the session. | String? |
| cardBrand | The 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? |
| withdrawalStatus | The 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
| Status | Raw value | Meaning |
|---|---|---|
| .completed | completed | The payment was approved. |
| .authorized | authorized | The card was authorized and not charged yet, for example a zero-amount authorization. |
| .pending | pending | The payment is still processing, or a withdrawal request was accepted and waits to be paid out. The final status reaches your server later. |
| .failed | failed | The payment did not go through. errorCode says why. |
| .canceled | canceled | The 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
| Value | Meaning |
|---|---|
| .customer | The customer tapped the close button, 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 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()
}| withdrawalStatus | Raw value | Meaning |
|---|---|---|
| .approved | approved | Paid out. |
| .authorized | authorized | Authorized and waits to be paid out. The result status is .authorized. |
| .requested | requested | The withdrawal request was accepted and waits to be paid out. |
| .requestedPayout | requested_payout | The payout request was accepted and waits to be paid out. |
| .partialPayout | partial_payout | Only part of the amount was paid out. The result status is .pending; confirm the paid amount on your server. |
| .pending | pending | Still processing. |
| .pendingAsync | pending_async | Still processing at the provider. |
| .initialized | initialized | Created, not processing yet. |
| .verification | verification | Being verified. |
| .declined | declined | Refused. |
| .error | error | Failed. |
| .canceled | cancelled | Canceled. |
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."
}
}| Code | Raw value | Category | Money taken? | What your app can do |
|---|---|---|---|---|
| .declined | declined | payment | No | Ask for another card or method. |
| .cardInvalid | card_invalid | payment | No | Ask 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. |
| .cardNotAccepted | card_not_accepted | payment | No | Try again later. |
| .transactionCanceled | transaction_canceled | payment | No | The payment was canceled. The customer may pay again. |
| .noPaymentMethod | no_payment_method | payment | No | No payment method is available for this session and currency. |
| .network | network | network | Maybe | Check the final status on your server. |
| .sessionExpired | session_expired | session | No | Create a new session. |
| .sessionUnavailable | session_unavailable | session | No | The Cashier could not read the session when it opened. Create a new session. |
| .invalidToken | invalid_token | session | No | The token was empty; nothing was sent. Pass the token your server got. |
| .validationFailed | validation_failed | validation | No | Check the amount and the session settings. A withdrawal's preset amount must not be above the balance. |
| .serverError | server_error | server | Maybe | Check the final status on your server. |
| .unexpectedResponse | unexpected_response | server | Maybe | Check the final status; update the SDK. |
| .unknown | unknown | server | Maybe | Check the final status on your server. |
| .configurationError | configuration_error | configuration | No | The 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. |
| .paymentMethodUnavailable | payment_method_unavailable | configuration | No | The 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.
Updated 8 days ago