Quick Start
A working Cashier in your iOS app, with code to copy.
Get the Praxis Cashier running in your iOS app with the predefined template: the customer sees or enters the amount first, then picks the payment method and pays. Your server adds two parameters to the session request it already sends, and the app code on this page is complete: copy it and run.
For every option and the details of each step, see the Integration Guide.
1. What you need
- Sandbox credentials from your CSM:
merchant_id,application_keyand the merchant secret. - The iOS SDK enabled for your sandbox application (ask your CSM).
- The PCI card form enabled for your sandbox application (ask your CSM).
- Xcode 27.2 or later and an app that targets iOS 18 or later.
- A server that already creates cashier sessions with the Cashier Payment Request, as for the Hosted Payment Page.
2. Add the SDK to your app
Your CSM gives you the package URL and the version of the SDK.
In Xcode, choose File → Add Package Dependencies…, enter the package URL, set Dependency Rule to Exact Version with the version your CSM gives you, and add the PraxisCashier library to your app target.
3. Create the session on your server
Create the session with the same Cashier Payment Request (POST /cashier/cashier) you use for the Hosted Payment Page, signed as usual. Add two parameters:
| Parameter | Value |
|---|---|
channel | ios_sdk |
app_return_url | The URL your app registers in step 4, for example myapp://praxis/return |
Request (additional parameters only)
{
"channel": "ios_sdk",
"app_return_url": "myapp://praxis/return"
}These two parameters are not part of the gt-authentication signature, so your signing code does not change. The response has no redirect_url.
Return session.auth_token from the response to your app. The app code in step 5 expects an endpoint on your server that answers POST with:
Your server → your app
{ "token": "8a7sd87a8sd778ac961062c6bedddb8" }
Keep the request on your serverAuthenticate your app user first, and take the customer, amount, currency and intent from your own records. Your Praxis credentials never go into the app.
4. Register the return URL
Some payments open a bank app. To bring the customer back to your app afterwards, register the scheme of the app_return_url you send in step 3: in your target, open Info → URL Types, add a URL type, and set URL Schemes to myapp.
Use your own scheme in a real app, and send the same value as app_return_url.
5. Show the Cashier
Add this file to your app. Set sessionEndpoint to the endpoint from step 3.
DepositView.swift
import SwiftUI
import PraxisCashier
let sessionEndpoint = URL(string: "https://your-server.example/cashier-session")!
struct DepositView: View {
@State private var launch: Launch?
@State private var message = ""
var body: some View {
VStack(spacing: 16) {
Button("Deposit") {
Task {
do {
launch = Launch(token: try await createCashierSession())
} catch {
message = "Could not start the payment. Please try again."
}
}
}
.buttonStyle(.borderedProminent)
Text(message)
}
.fullScreenCover(item: $launch) { launch in
// No layout passed: the Cashier uses the predefined template
CashierView(token: launch.token, environment: .sandbox) { result in
self.launch = nil
message = text(for: result)
}
}
}
private func createCashierSession() async throws -> String {
var request = URLRequest(url: sessionEndpoint)
request.httpMethod = "POST"
let (data, _) = try await URLSession.shared.data(for: request)
return try JSONDecoder().decode(SessionResponse.self, from: data).token
}
private func text(for result: CashierResult) -> String {
switch result.status {
case .completed, .authorized: "Thank you! Your deposit is on its way."
case .pending: "Your payment is being processed."
case .failed: "The payment did not go through (\(result.errorCode?.rawValue ?? "unknown"))."
default: "" // .canceled, or a status added later
}
}
}
private struct Launch: Identifiable {
let id = UUID()
let token: String
}
private struct SessionResponse: Decodable {
let token: String
}Show DepositView() anywhere in your app, for example as the root view of your WindowGroup.
6. Run a test payment
- Run the app.
- Tap Deposit. The Cashier opens on the amount page with the amount of the session.
- Pick a card method and pay with a test card from Testing. If the card asks for 3-D Secure, the challenge opens inside the Cashier.
- Close the result screen. Your app shows the result message.
- Check that your server received the Payment Notification for the order.
Credit the customer from the webhook onlyThe result in the app tells the customer what happened. Update balances only after your server has received and verified the Payment Notification.
7. Before you go live
- Take the customer, amount, currency and intent from your own records on the server.
- Verify the signature of every Payment Notification and process it idempotently.
- Switch the server to your live credentials and the app to
environment: .live. - Go through the implementation checklist in the Integration Guide.
What's next
- Integration Guide: each step in detail, payment flows, testing and going live.
- Configuration & Customization: your brand colors, fonts and texts.
- Layouts: payment method first, one page, your own layout.
- Blocks Catalog: every block, what it shows by default and how to draw it in your own design.
- Results, Errors & Troubleshooting: every status and error code.
- SDK Reference: every method and parameter.
Updated about 18 hours ago