15. Testing: mock servers, test cards and go-live checklist

The repository's README describes a demo app and two local mock servers: a Praxis backend mock (port 8787) that mirrors the Praxis cashier API, and a merchant backend mock (port 8788) that plays the merchant's server and creates the session. No credentials are needed. The SDK reaches the mock with CashierEnvironment.mock(), in debug builds only.

🚧

Important

On 22 Nov 2026 the master branch holds README.md, Package.swift and Sources only. The Example app, the mock servers, the docs folder (API contract, specifications) and the Scripts folder the README points to are not on master. Ask the mobile team for the branch that has them before following the steps below.

Run the demo (as the README describes it)

cd Example/mock-server && npm start          # both mock servers; Ctrl-C stops them
cd Example && xcodegen generate && open CashierDemo.xcodeproj

Run the CashierDemo scheme on a simulator and tap Deposit with card. The demo's "Withdrawals" and "Decline recovery and retry" groups open those flows on the mock.

Test cards on the mock

Any future expiry such as 12/34, holder Test User. For Visa cards the last four digits decide the result.

CardNumberCVVResult
Visa approved4111 1111 1111 1111123Approved
Visa 00024000 0000 0000 0002123Declined
Visa 00034000 0000 0009 0003123Pending, then approved on the second status read
Visa 00044000 0000 0008 0004123Server error
Visa 00054000 0000 0007 0005123Redirect to the 3-D Secure page
Visa 00064000 0000 0006 0006123Partially approved (60 % of the amount)
Visa 00074000 0000 0005 0007123Field errors (full name, postal code)
Visa 00084000 0000 0004 0008123Cancelled
Visa 00094000 0000 0003 0009123Authorized
Visa 00104000 0000 0000 0010123Pending that stays pending
Mastercard5555 5555 5555 4444123Approved
Amex3782 822463 100051234Approved
Discover6011 1111 1111 1117123Approved

Praxis core dev

The demo's core dev mode runs the SDK against the native Cashier backend of Praxis core dev: the local merchant server opens a native session (channel: ios_sdk, app_return_url) with a test merchant's credentials and sends the app only the token and the three service addresses. The credentials stay on the Mac, in a git-ignored file.

Documentation and checks in the repository

  • Every public symbol has DocC documentation. Build it with the command below.
  • Scripts/check.sh (not on master) runs the ring and boundary checks, a warnings-as-errors build, the tests, the mock server tests, an iOS simulator build and the public surface check.
xcodebuild docbuild -scheme tech.praxis.cashier.sdk -destination 'generic/platform=iOS Simulator'

Go-live checklist

  • Server creates the session with channel: ios_sdk and an app_return_url, and sends the app only the token
  • App uses CashierEnvironment(graphqlURL:pciURL:logsURL:) with the addresses of the same environment the session was created in
  • Final status is taken from the Praxis notification on the server, not from the device
  • Every failed result logs errorCode.rawValue and traceID; the switch over error codes has a default branch
  • "Maybe" codes (network, server_error, unexpected_response, unknown) do not tell the customer the payment failed for good
  • Apple Pay: the app's entitlement lists the merchant identifier of the session's settings, or the feature is off
  • app_return_url is registered in the app when methods hand the customer to a bank app
  • An own layout was tested with each method the merchant account offers (no layout_incomplete event)

Did this page help you?