iOS SDK — Card
Build your own card form, then charge using the encrypted checkout API.
SPM products: SwirepayCore, SwirepayCard
Import: import SwirepayCore
One-time card checkout
do {
let result = try await SwirepayAPIHelper.shared.createOneTimeEncryptedCardCheckout(
customerName: name,
customerEmail: email,
phoneE164: "+14155552671",
cardNumberDigits: "4242424242424242",
expiryMonth: 12,
expiryYear: 2030,
cvv: "123",
cardholderName: name,
billingStreet: street,
billingCity: city,
billingState: state,
billingPostalCode: postal,
billingCountryCode: "US",
amountMinorUnits: 1000,
currencyCode: "USD"
)
let completion = result.paymentCompletionResponse
if completion.success {
// Done — use completion.paymentMethodGid / paymentSessionGid
}
} catch {
// Show error.localizedDescription
}
On staging, this auto-creates a checkout session when none is set. For production apps, prefer explicit
createCheckoutSession+ checkout-session pipeline (same as Checkout sheet).
Recurring card checkout
let result = try await SwirepayAPIHelper.shared.createRecurringEncryptedCardCheckout(
// same parameters as one-time …
)
// result returns item/plan/subscription gids (separate from one-time completion shape)
Notes
SwirepayCard.shared.startPayment(amount:)is a sample-only helper that uses a placeholder token. Replace with real tokenization in production.- Always read completion.success — HTTP 200 alone does not confirm payment.