Skip to main content

iOS SDK — Unified Checkout Sheet

One modal UI for Card, Bank (ACH), Apple Pay, and Google Pay (web). Uses encrypted checkout-session v3 when you pass a session.

SPM products: SwirepayCore, SwirepayCheckout
Import: import SwirepayCheckout


Step 1 — Choose enabled payment methods​

import SwirepayCore

let paymentTypes: Set<SwirepayCheckoutSessionPaymentType> = [
.card,
.achLegacy,
.applePayUS,
]

Valid session paymentType values: CARD, ACH_LEGACY, APPLE_PAY_US.


Step 2 — Create checkout session​

let session = try await SwirepayAPIHelper.shared.createCheckoutSession(
amountMinorUnits: 1000, // .00 USD
currencyCode: "USD",
paymentTypes: paymentTypes
)

Step 3 — Present the sheet​

import SwirepayCheckout

let config = SwirepayCheckoutConfiguration(
apiKey: apiKey,
accountGid: accountGid,
environment: .sandbox,
currency: .usd,
amountMinorUnits: 1000,
merchantDisplayName: "Your Store",
applePayMerchantIdentifier: "merchant.com.your.app", // nil hides Apple Pay
applePayCountryCode: "US",
businessType: "BUSINESS",
plaidIsTest: true,
checkoutSession: session,
walletCheckoutURL: URL(string: "https://your-hosted-checkout.example.com/"), // Google Pay web
prefill: SwirepayCheckoutPrefill(name: "Jane", email: "jane@example.com"),
enabledPaymentTypes: paymentTypes
)

SwirepayCheckout.present(from: self, configuration: config) { result in
switch result {
case .success(let completion):
print(completion.prettyJSONString)
// completion.success, completion.paymentSessionGid, …
case .failure(let error):
print(error.localizedDescription)
}
}

The sheet initializes the SDK internally when the user taps Pay or a wallet button.


Sample app​

Examples/SPPayementSDKDemo/ shows this flow under the CHECKOUT action.