Before you begin

This guide assumes that you know how to:

Accept payments with iDEAL via Adyen

Prepare the API

iDEAL via Adyen requires the following data to process a payment successfully. Pass the following data in the client session, or in the payment request (for manual payment creation).

Parameter NameRequiredDescription
3-letter currency code in ISO 4217 format, e.g. USD for US dollars
  1. order
Details of the line items of the order

Prepare the SDK for payments

Handle payment method

Integration

PrimerHeadlessUniversalCheckout.ComponentWithRedirectManager is an SDK manager designed to streamline the headless integrations of various payment methods that are comprised of an initial component and a redirect flow.

To integrate PrimerHeadlessUniversalCheckout.ComponentWithRedirectManager, follow these steps:

Create an instance of PrimerHeadlessUniversalCheckout.ComponentWithRedirectManager

1
let manager: PrimerHeadlessUniversalCheckout.ComponentWithRedirectManager = PrimerHeadlessUniversalCheckout.ComponentWithRedirectManager()
swift
copy
Create a new instance of BanksComponent for ADYEN_IDEAL

Using the manager and the convenience provide methods, create a new instance of BanksComponent using ADYEN_IDEAL as the paymentMethodType.

Provide methods can throw, so please make sure to process the thrown errors.

1
let banksComponent: any BanksComponent = try? manager.provide(paymentMethodType: "ADYEN_IDEAL")
swift
copy
Listen for the emitted steps

Register as the component’s stepDelegate and conform to the PrimerHeadlessSteppableDelegate protocol. You will receive instanses of BanksStep.

123456789
func didReceiveStep(step: PrimerHeadlessStep) {        guard let step = step as? BanksStep else { return }        switch step {                // Handle bank list loading being in progress (e.g. show loading indicator)        case .loading: break                // Display list of banks        case .banksRetrieved(banks: let banks): break        }    }
swift
copy
Listen to the data validation statuses

Register as the component’s validationDelegate and conform to the PrimerHeadlessValidatableDelegate protocol.

This component allows you to collect the id corresponding to the user's selected bank, along with a query to filter down the bank list. It's worth mentioning that the data validation is designed to operate in real-time. This means that the accuracy and completeness of the collected data can be confirmed even while users are actively inputting their information. This real-time validation feature ensures that your data remains accurate and complete throughout the data entry process, enhancing the user experience and the reliability of the collected data.

1
func didUpdate(validationStatus: PrimerSDK.PrimerValidationStatus, for data: PrimerSDK.PrimerCollectableData?) {}
swift
copy
Start the flow of the component

Call the start function in order to start the flow of the component.

1
banksComponent.start()
swift
copy

Once called, the .loading step will be emitted, followed by the .banksRetrieved step.

Handle data collection

As mentioned previously, the component allows you to collect  the id corresponding to the user selected bank, and optionally a query to filter down the bank list.

12
banksComponent.updateCollectedData(collectableData: BanksCollectableData.bankId(bankId: bankId))bankComponent.updateCollectedData(collectableData: BanksCollectableData.bankFilterText(text: filterText))
swift
copy

When the collected bank id is valid, as determined by the validationStatus, call the s function to trigger the payment tokenization and to redirect to the selected bank for finalizing the payment.

Handle errors

Register as the component’s errorDelegate and conform to the PrimerHeadlessErrorableDelegate protocol. You will receive instances of PrimerError.

1
func didReceiveError(error: PrimerError) {}
swift
copy
Objective-C Compatibility

The Objective-C compatibility uses the class PrimerHeadlessMainComponentWrapper.

Use the start method of the wrapper to start the component flow.

Use the submit method of the wrapper to submit the data.

Use the selectBankById to select a bank by id.

Use the filterBankByName to filter the list of banks by name.

Get notified of data loading using the following delegate methods:

12
@objc func didStartLoading()@objc func didReceiveBanks(_ banks: [IssuingBank])
swift
copy
Listen for the emitted steps

Register as the wrapper’s stepDelegate and conform to the BanksComponentSteppable protocol. You will need to use the following 2 methods to get notified of loading and banks received flows.

12
@objc func didStartLoading() {}@objc func didReceiveBanks(_ banks: [IssuingBank])
swift
copy
Listen to the data validation statuses

Register as the wrapper’s validationDelegate and conform to the BanksComponentValidatable protocol.

1
@objc func didReceiveValidationStatus(_ status: ValidStatus) {}
swift
copy
Handle errors

Register as the wrapper’s errorDelegate and conform to the BanksComponentErrorable protocol. You will receive instances of NSError.

1
@objc func didReceiveError(_ error: NSError)
swift
copy

Go live

You don’t need to do anything particular to go live — just make sure to use production credentials.