3. Install the package and choose the environment

Add the package

The SDK is a Swift package. In Xcode choose File → Add Package Dependencies, enter the repository address Praxis gives you, and add the library product PraxisCashier to your app target. In a Package.swift:

dependencies: [
    .package(url: "<repository address from Praxis>", from: "0.2.0")
],
targets: [
    .target(name: "MyApp", dependencies: [
        .product(name: "PraxisCashier", package: "tech.praxis.cashier.sdk")
    ])
]
import PraxisCashier

Choose the environment

No Praxis environment is built into the SDK. Pass the addresses Praxis gives you; the initialiser checks that every address is https before anything is sent.

let environment = try CashierEnvironment(
    graphqlURL: cashierServiceURL,   // Cashier-Service GraphQL, https only
    pciURL: pciSecureFormURL,        // PCI-Secure-Form
    logsURL: eventLogsURL            // optional; nil sends no logs
)
EnvironmentHowNotes
A Praxis environmentCashierEnvironment(graphqlURL:pciURL:logsURL:)Throws CashierEnvironment.ConfigurationError.insecureURL for an address that is not https. Plain http is accepted only on localhost, 127.0.0.1 and ::1
Local mock serverCashierEnvironment.mock() or .mock(port:)Exists in debug builds only, so a release build cannot reach the mock

Apple Pay

  • The Apple Pay merchant identifier comes from the session's PCI-Secure-Form settings. Your app's Apple Pay entitlement must list it.
  • Apple Pay shows only when the feature is on (it is by default), Praxis sends Apple Pay settings for the session, and the device can pay.
  • To keep Apple Pay off: CashierFeatures.default.subtracting(.applePay).

Return from a bank app

Register the session's app_return_url in your app when you want the customer brought back to your app after a provider page handed them to a bank app. The app needs no URL-handling code for provider and 3-D Secure pages (section 12).


Did this page help you?