iOS SDK
The Paypercut iOS SDK is a drop-in native payment sheet — card, Apple Pay, and saved cards — that you present from your app with a single call. The customer pays inside a native SwiftUI sheet, and the SDK hands you back a payment method for your backend to charge.
Card details are captured directly into Paypercut's PCI-compliant vault on-device — they never pass through your app or your servers.
Why the native SDK?
- Native UX — a SwiftUI sheet that renders card, Apple Pay, and saved cards, themed to your brand.
- Minimal PCI scope — the PAN is captured straight into Paypercut's vault; it never touches your app or servers.
- You stay in control of the charge — the SDK produces a payment method; your backend confirms the payment with your secret key.
- Localized — the sheet ships in 18 languages and follows the device locale (or a locale you pass).
How it works
The SDK is checkout-less — you supply the transaction context directly, with no checkout to create first.
- Your app presents the payment sheet with your publishable key and the amount / currency.
- The customer enters card details (or taps Apple Pay / picks a saved card) and confirms. 3-D Secure runs automatically when required.
- The SDK returns a payment method (
pm_…) viaonResult. - Your backend confirms the payment with that payment method id using your secret key.
The SDK does not move money. It collects payment details and returns a payment method; charging it is a server-to-server call from your backend.
Prerequisites
- A Paypercut merchant account — Sign up and get your publishable key (
pk_test_…/pk_live_…) from API Keys. - The transaction amount and currency — you pass these to the SDK directly. Optionally pass saved cards you've fetched server-to-server and a known customer email.
- (For Apple Pay) an Apple Pay merchant identifier registered with Paypercut.
Installation
Add the package in Xcode (File ▸ Add Package Dependencies…) or in your Package.swift:
dependencies: [
.package(url: "https://github.com/paypercut/paypercut-ios-sdk.git", from: "2.0.1"),
],
targets: [
.target(name: "YourApp", dependencies: [
.product(name: "Paypercut", package: "paypercut-ios-sdk"),
]),
]
The on-device tokenization dependency (Paypercut's PCI-compliant vault) is resolved transitively — you don't add it yourself.
Requirements: iOS 15+, SwiftUI.
Quick start
Present the sheet with your publishable key + amount / currency, then confirm the returned payment method on your backend:
import SwiftUI
import Paypercut
struct CheckoutScreen: View {
@State private var paypercut = Paypercut(
publishableKey: "pk_test_…", // your publishable key
amount: 2500, // total in minor units (2500 = €25.00)
currency: "EUR",
applePayMerchantIdentifier: "merchant.com.yourcompany.yourapp" // omit to hide Apple Pay
)
var body: some View {
paypercut.paymentSheet { result in
switch result {
case let .created(pm): confirmOnYourBackend(pm.paymentMethodId) // charge on your backend
case let .blik(code): confirmBlikOnYourBackend(code)
case .cancelled: dismiss()
case let .failed(message): showError(message)
}
}
}
}
The sheet renders the enabled methods, collects the details, and returns a payment method. Charging it is a call from your backend using your secret key.
Payment methods
You control which methods appear through the config you pass:
- Card — an inline card form, with an optional "save card" checkbox and billing-address collection.
- Apple Pay — the native Apple Pay button appears when the device supports it, your account has it enabled, and you pass an Apple Pay merchant identifier. (Apple Pay needs a one-time merchant-ID registration with Paypercut for live payments.)
- Saved cards — pass the customer's saved cards (fetched server-to-server) and they're offered for one-tap reuse.
- BLIK (Poland / PLN) — returns the entered code for your backend to confirm and poll.
Save a card for future payments
The SDK does not save cards itself. It tells you whether the card should be kept, and your backend saves it when it confirms the payment.
Read saveForFutureUse on the returned payment method (PaymentMethodCreated):
| Mode | saveForFutureUse |
|---|---|
.payment |
true when the customer ticked Save card for future use, otherwise false |
.setup (Add card) and .subscription |
always true |
When it is true, create the Payment Intent on your backend with the customer and setup_future_usage:
curl https://api.paypercut.io/v1/payment_intents \
-H "Authorization: Bearer sk_test_…" \
-H "Content-Type: application/json" \
-d '{
"amount": 2500,
"currency": "EUR",
"payment_method": "pm_…",
"customer": "01HD7M6DRKZ4Q4QEVWJB0RC1S6",
"setup_future_usage": "on_session",
"confirm": true
}'
- Use
on_sessionwhen future payments happen while the customer is present in your checkout. - Use
off_sessionwhen you charge the card later without the customer present, such as subscriptions or a card you save now to charge later. - Pass the same customer to the SDK (
customer:) and to the Payment Intent. - When
saveForFutureUseisfalse, omitsetup_future_usage. The card is used for this payment only.
Paypercut attaches the card to the customer after the Payment Intent is confirmed and the customer completes any required authentication.
Adding a card without a payment. Setup mode (Add card) collects and secures the card, but it is not saved to the customer on its own. The recommended way to save a card to a customer today is to complete a payment with it through the normal flow: present the sheet in .payment mode with the customer, and when saveForFutureUse is true, confirm the Payment Intent with the same customer and setup_future_usage. The card is saved to the customer once that payment succeeds.
Connected accounts (platforms)
If you run a platform on Paypercut Connect, you can present the sheet for one of your connected accounts. Initialize the SDK with your platform's publishable key and the connected account ID:
let paypercut = Paypercut(
publishableKey: "pk_test_…", // your platform's publishable key
account: "01HD7M6DRKZ4Q4QEVWJB0RC1S6", // the connected account
amount: 2500,
currency: "EUR"
)
- One account per instance. The account is fixed for the life of the
Paypercutinstance. To take a payment for another connected account, create a new instance. - Accepted values. Surrounding whitespace is removed. The ID must contain only printable ASCII characters; any other value stops the app with a precondition failure when you create the instance. Paypercut validates that the account exists and that your platform can act for it.
- Omit
accountto take payments for the account that owns the publishable key. - Your backend uses the same account. Send the
Paypercut-Accountheader with the connected account ID, together with your platform secret key, on every backend call for the payment: creating and confirming the Payment Intent, and reading the customer and its saved cards. Customers and saved cards belong to the connected account.
If the payment session returned for the key and account does not belong to the requested account, the sheet fails to load with the error code account_mismatch. The SDK never falls back to your platform's own account.
Full reference
The complete integration guide — every configuration option, Appearance / theming, the 3-D Secure retrigger (handleNextAction), result & event handling, error codes, and Apple Pay setup — lives in the SDK's README, which is kept in lockstep with the code:
Testing
Use sandbox keys (pk_test_…) during development. Test Apple Pay on a real device — it does not run in the iOS Simulator. For test cards and sandbox scenarios, see the Testing Guide.
Support & resources
- Paypercut Dashboard
- paypercut-ios-sdk README — full reference
- Checkout Experience
- Technical Support
Ready to add native checkout to your iOS app? Create your free Paypercut account →

