This branch documents v6, which is currently in alpha and under active development. Its public API can still change, and the v5 API is not available here.
For the latest stable release, use the
v5branch and the v5 integration guides.
Adyen iOS provides you with the building blocks to create a checkout experience for your shoppers, allowing them to pay using the payment method of their choice.
The v6 alpha integrates with Components: one Component per payment method, combined with your own payments flow. Drop-in, the all-in-one solution, is not available in the v6 alpha yet.
| Major version | State | Deprecated | End-of-life |
|---|---|---|---|
| 6.x.x | Alpha (in development) | --- | --- |
| 5.x.x | Active | --- | --- |
| 4.x.x | Inactive | December 2026 | December 2027 |
| 3.x.x | End-of-life | November 2021 | November 2022 |
More information about our versioning and the Drop-in/Components lifecycle can be found here.
The v6 API documented in this branch is currently alpha. These guides describe the current public v6 API.
- v6 foundations
- v6 card component overview
- v6 card component: session flow
- v6 checkout theme
- v5 to v6 migration notes
Adyen iOS is available through Swift Package Manager.
- iOS 16.0
- Xcode 15.0
- Swift 5.9
- Follow Apple's Adding Package Dependencies to Your App guide on how to add a Swift Package dependency.
- Use
https://github.com/Adyen/adyen-iosas the repository URL. - Specify the version to be at least
6.0.0-alpha.1.
You can add all modules or select individual modules to add to your integration.
The AdyenWeChatPay module needs to be explicitly added to support WeChat Pay.
The AdyenTwint module needs to be explicitly added to support Twint native flow.
The AdyenSwiftUI module needs to be explicitly added to use the SwiftUI specific helpers.
AdyenCheckout: the v6 entry point, includesAdyen,AdyenCard,AdyenComponents,AdyenActionsandAdyenSession.Adyen: core module.AdyenUI: shared UI, form items and theming.AdyenCard: the card components.AdyenComponents: all other payment components except WeChat Pay.AdyenActions: action components.AdyenEncryption: encryption.AdyenSession: handler for the simplified checkout flow.AdyenCardScanner: card scanning support.AdyenWeChatPay: WeChat Pay component.AdyenTwint: Twint component.AdyenCashAppPay: Cash App Pay component.AdyenSwiftUI: SwiftUI apps specific module.
AdyenWeChatPay and AdyenWeChatPayInternal modules don't support any simulators and can only be tested on a real device.
5.27.0 is the last v5 version and 6.0.0-alpha.1 the last v6 version available on CocoaPods. Use Swift Package Manager to get newer versions. See the migration notes for how to switch.
The v6 API is centered around Checkout.setup(...) as the entry point, CheckoutConfiguration as the shared configuration container, callbacks supplied as a value before setup, and payment components created from the resulting checkout flow. See the v6 foundations guide for the full reference.
Note: Drop-in is not part of the v6 alpha yet. The v6 alpha exposes individual payment components; Drop-in support is planned for a later release.
Use the session flow when your backend starts checkout with /sessions. Adyen manages the flow, including payment submission and action handling.
import Adyen
import AdyenActions
import AdyenCard
import AdyenCheckout
let configuration = try CheckoutConfiguration(
environment: .test,
clientKey: clientKey
) {
CardConfiguration()
AuthenticationConfiguration()
.requestorAppURL(URL(string: "https://your-domain.example/adyen")!)
}
let callbacks = CheckoutCallbacks(
onComplete: { result in
print(result.resultCode)
},
onFailure: { error in
print(error.localizedDescription)
}
)
let checkout = try await Checkout.setup(
with: sessionResponse,
configuration: configuration,
callbacks: callbacks
)
let component = try checkout.createPaymentComponent(for: .scheme)In session flow the effective amount comes from the /sessions response, and settings such as storePaymentMethodMode and installments are session-controlled. See the session flow guide.
If your app only needs to handle actions, set up checkout without a SessionResponse or PaymentMethods, and call checkout.handle(action:) when your backend returns an action.
let callbacks = ActionOnlyCheckoutCallbacks(
onAdditionalDetails: { data in
try await callDetails(with: data)
},
onFailure: { error in
print(error.localizedDescription)
}
)
.onAction { actionData, actionViewController in
present(actionViewController, animated: true)
}
.onComplete { result in
print(result.resultCode)
}
let checkout = try await Checkout.setup(
configuration: configuration,
callbacks: callbacks
)createPaymentComponent(for:) returns a CheckoutPaymentComponent. Use its viewController for presentation.
guard let viewController = component.viewController else { return }
present(UINavigationController(rootViewController: viewController), animated: true)Set .onAction on the callbacks value before passing it to Checkout.setup.
Checkout builds the view controller for an action — a 3D Secure challenge, a voucher, a QR code — and hands it to onAction(_:) together with an ActionData describing the action.
.onAction { actionData, actionViewController in
print(actionData.type)
present(actionViewController, animated: true)
}ActionData.type is an ActionType, a RawRepresentable struct with the known values redirect, nativeRedirect, threeDS2, sdk, qrCode, await and voucher. It is a struct rather than an enum so that new action types do not break exhaustive switch statements in your code — always handle unknown values. When you do not set onAction(_:), checkout presents the action on the payment component that started the flow; the action-only flow has no such component, so it always needs a handler.
Drop-in presents actions within its own navigation stack, so onAction(_:) is not invoked for actions raised inside a Drop-in flow.
Pass incoming URLs to the SDK so active redirect actions can resume after the shopper returns from a browser or an external app. It is safe to pass all incoming URLs; any URL not belonging to an active checkout redirect is ignored.
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
Checkout.handleReturn(url: url)
return true
}For SceneDelegate and SwiftUI entry points, see the v6 foundations guide.
In v6 you present each payment method individually with createPaymentComponent(for:), passing either a PaymentMethodType or the identifier of a stored payment method.
// A payment method from the current checkout flow.
let component = try checkout.createPaymentComponent(for: .scheme)
// A stored payment method.
guard let storedCard = checkout.storedPaymentMethods
.compactMap({ $0 as? StoredCardPaymentMethod })
.first else { return }
let storedComponent = try checkout.createPaymentComponent(for: storedCard.identifier)The v6 alpha currently supports:
- Card, including stored cards
- Apple Pay
- BLIK
- ACH Direct Debit
- Instant payment methods
- Stored payment methods
The remaining payment methods are still being migrated to the v6 API. For the components documented so far, see the card component overview.
Checkout-wide styling is configured with CheckoutTheme on CheckoutConfiguration, and applies to every payment component and action created from that checkout flow. Start from CheckoutColors.default and override only the tokens you need.
let theme = CheckoutTheme(
colors: CheckoutColors(
background: .systemBackground,
container: .secondarySystemBackground,
primary: .black,
textOnPrimary: .white,
highlight: .systemBlue,
destructive: .systemRed,
text: .label,
textSecondary: .secondaryLabel
)
)
let configuration = try CheckoutConfiguration(
environment: .test,
clientKey: clientKey
) {
CardConfiguration()
}
.theme(theme)A full list of color tokens can be found in the checkout theme guide.
Strings can be overridden at runtime with localizationProvider(_:) on CheckoutConfiguration, or by adding .strings and .xcstrings files to your app bundle to add a fully new language.
We provide a fully working Demo App to explore the checkout integration in a sandbox environment.
The Demo App includes:
- Sample integrations for the session flow
- UIKit and SwiftUI examples
- Common payment methods (Card, Apple Pay, Instant Payments, Issuer List)
Note: We recommend using your own backend server. Direct API usage with
ADYEN_SERVER_API_KEYis possible for testing only and not for production.
For detailed setup, see the Demo README.
If you have a feature request, or spotted a bug or a technical problem, create a GitHub issue. For other questions, contact our Support Team via Customer Area or via email: support@adyen.com
We strongly encourage you to join us in contributing to this repository so everyone can benefit from:
- New features and functionality
- Resolved bug fixes and issues
- Any general improvements
Read our contribution guidelines to find out how.
This repository is open source and available under the MIT license. For more information, see the LICENSE file.
