Are you looking for test card numbers?

Would you like to contact support?

Default icon

iOS Drop-in integration guide

Accept popular payment methods in your iOS app with a single client-side implementation.

Drop-in is our pre-built UI solution for accepting payments on your app. Drop-in shows all payment methods as a list, in the same block. This integration requires you to make one API request to /sessions endpoint.

Adding new payment methods usually doesn't require more development work. Drop-in supports cards, wallets, and most local payment methods.

How it works

Try it out!

From an implementation perspective, a Drop-in integration contains:

  • Server-side: a single API call which creates the payment sessions.
  • Client-side: Drop-in, which uses the payment session data to make the payment request and to handle any other actions like redirects or 3D Secure authentication.
  • Webhook server: receives webhook events which tell you what is the outcome of each payment.

If you need to handle additional use cases, you need to implement additional endpoints and client-side configuration.
The payment flow is the same for all payments:

  1. The shopper goes to the checkout page.
  2. Your server uses the shopper's country and currency information from your client to create a payment session.
  3. Your client creates an instance of Drop-in using the session data from the server.
  4. Drop-in shows the available payment methods, collects the shopper's payment details, handles additional actions, and presents the payment result to the shopper.
  5. Your webhook server receives the event containing the payment outcome.

Before you begin

Before you begin to integrate, make sure you have followed the Get started with Adyen guide to:

  • Get an overview of the steps needed to accept live payments.
  • Create your test account.

After you have created your test account:

Step 1: Create a payment session

A payment session is a resource with information about a payment flow initiated by the shopper. This resource has all the information Drop-in needs to handle all the stages of a payment flow. You can configure this resource with information like available payment methods, payment amount, or line items.

To create a payment session, make a /sessions request, including:

Parameter name Required Description
merchantAccount -white_check_mark- Your merchant account name.
amount -white_check_mark- The currency and value of the payment, in minor units. This is used to filter the list of available payment methods to your shopper.
returnUrl -white_check_mark- URL where the shopper should be taken back to after a redirection. This URL can have a maximum of 1024 characters. For more information on setting a custom URL scheme for your app, read the Apple Developer documentation.
reference -white_check_mark- Your unique reference for the payment. Must be 3 characters or more.
expiresAt The session expiry date in ISO8601 format, for example 2023-11-23T12:25:28Z, or 2023-05-27T20:25:28+08:00. When not specified, the expiry date is set to 1 hour after session creation. You cannot set the session expiry to more than 24 hours after session creation.
countryCode The shopper's country code. This is used to filter the list of available payment methods to your shopper.
shopperLocale The language that the payment methods will appear in. Set it to the shopper's language and country code. The default is en-US. The front end also uses this locale if it's available.
shopperEmail The shopper's email address. Strongly recommended because this field is used in a number of risk checks, and for 3D Secure.
shopperReference Your reference to uniquely identify this shopper. Strongly recommended because this field is used in a number of risk checks.
applicationInfo If you're building an Adyen solution for multiple merchants, include some basic identifying information, so that we can offer you better support. For more information, refer to Building Adyen solutions.

Here's an example of how you would create a session for a payment of 10 EUR:

curl \
-H "x-API-key: YOUR_X-API-KEY" \
-H "content-type: application/json" \
-d '{
  "merchantAccount": "YOUR_MERCHANT_ACCOUNT",
  "amount": {
      "value": 1000,
      "currency": "EUR"
  "returnUrl": "my-app://",
  "reference": "YOUR_PAYMENT_REFERENCE",
  "countryCode": "NL"
Client client = new Client("YOUR_X-API-KEY", Environment.TEST);

Checkout checkout;
checkout = new Checkout(client);

CreateCheckoutSessionRequest checkoutSessionRequest = new CreateCheckoutSessionRequest();
Amount amount = new Amount();
CreateCheckoutSessionResponse checkoutSessionResponse = checkout.sessions(checkoutSessionRequest);
$client = new \Adyen\Client();
$client->setApplicationName('Test Application');
$service = new \Adyen\Service\Checkout($client);
$params = array(
   'amount' => array(
       'currency' => "EUR",
       'value' => 1000
   'countryCode' => 'NL',
   'merchantAccount' => 'YOUR_MERCHANT_ACCOUNT',
   'reference' => 'YOUR_PAYMENT_REFERENCE',
   'returnUrl' => 'my-app://'
$result = $service->sessions($params);
def test_sessions_success(self):
    ady = Adyen.Adyen()
    client = ady.client
    client.xapikey = config.xapikey
    client.platform = "test"
    client.app_name = "appname"
    request = {}
    request['amount'] = {"value": "1000", "currency": "EUR"}
    request['reference'] = "YOUR_PAYMENT_REFERENCE"
    request['merchantAccount'] = "YOUR_MERCHANT_ACCOUNT"
    request['returnUrl'] = "my-app://"
    request['countryCode'] = "NL"

    result = self.ady.checkout.sessions(request)
var checkoutSessionRequest = new CreateCheckoutSessionRequest
      merchantAccount: "MERCHANT_ACCOUNT",
      reference: "YOUR_PAYMENT_REFERENCE",
      returnUrl: "my-app://",
      amount: new Amount("EUR", 1000L),
      countryCode: "NL"
var client = new Client("YOUR_X-API-KEY", Adyen.Model.Enum.Environment.Test);
var checkout = new Checkout(client);
var createCheckoutSessionResponse = checkout.Sessions(checkoutSessionRequest);
const { Client, CheckoutAPI } = require('@adyen/api-library');

const client = new Client({ apiKey: "YOUR_API_KEY", environment: "TEST" });
const checkout = new CheckoutAPI(client);

    amount: { currency: "EUR", value: 1000 },
    reference: "YOUR_PAYMENT_REFERENCE",
    returnUrl: "",
    merchantAccount: 'YOUR_MERCHANT_ACCOUNT',
    countryCode: "NL"
    .then((response) => {
    .catch((e) => {

The response contains:

  • sessionData: the payment session data you need to pass to your front end.
  • id: a unique identifier for the session data.
  • The request body.

HTTP 201 /sessions response body
    "amount": {
        "currency": "EUR",
        "value": 1000
    "countryCode": "NL",
    "expiresAt": "2021-08-24T13:35:16+02:00",
    "id": "CSD9CAC34EBAE225DD",
    "merchantAccount": "YOUR_MERCHANT_ACCOUNT",
    "reference": "YOUR_PAYMENT_REFERENCE",
    "returnUrl": "my-app://",
    "sessionData": "Ab02b4c..."

If you don't get an HTTP 201 response, use the errorCode field and the list of API error codes to troubleshoot.

Step 2: Set up Drop-in

1. Get Adyen iOS

Choose how you want to install the Adyen iOS client-side library:

To install iOS Drop-in using Swift Package Manager, follow the Apple guide and specify:
  • The repository URL as
  • The Adyen iOS client-side library version to be at least 5.0.0.

2. Create the context

First, create an instance of APIContext that contains:

Then, create an instance of AdyenContext that contains:

  • The instance of APIContext.
  • Payment information.
  • Optional analytics configuration.
// Set the client key and environment in an instance of APIContext.
let apiContext = APIContext(clientKey: clientKey, environment: Environment.test) // Set the environment to a live one when going live.
// Create the amount with the value in minor units and the currency code.
let amount = Amount(value: 1000, currencyCode: "EUR")
// Create the payment object with the amount and country code.
let payment = Payment(amount: amount, countryCode: "NL")
// Create an instance of AdyenContext, passing the instance of APIContext, payment object, and optional analytics configuration.
let adyenContext = AdyenContext(apiContext: apiContext, payment:payment, analyticsConfiguration: analyticsConfiguration)

3. Create a configuration object

Use the fields from the /sessions response to configure and create an instance of AdyenSession:

let configuration = AdyenSession.Configuration(sessionIdentifier: sessionId, // The id from the API response.
                                               initialSessionData: data, // The sessionData from the API response.
                                               adyenContext: adyenContext)

4. Initialize AdyenSession

Call the static initialize function of the AdyenSession, setting:

  • configuration: the configuration object you created in the previous step.
  • delegate: your delegate object. For example, self.
  • presentationDelegate: your delegate object. For example, self.

This asynchronously creates and returns an instance of the session.

AdyenSession.initialize(with: configuration, delegate: self, presentationDelegate: self) { [weak self] result in
        switch result {
        case let .success(session):
            //Store the session object.
            self?.session = session
        case let .failure(error):
            //Handle the error.

5. Configure Drop-in

Create a Drop-in configuration object (DropInComponent.Configuration), setting the adyenContext. Some payment methods require additional configuration, and you can add optional configuration.

let dropInConfiguration = DropInComponent.Configuration(adyenContext: adyenContext)
// Some payment methods have additional required or optional configuration.
// For example, an optional configuration to show the cardholder name field for cards.
dropInConfiguration.card.showsHolderNameField = true

6. Initialize the DropInComponent class

Set the instance of AdyenSession you created in the previous step as the delegate and, if you accept gift cards, partialPaymentDelegate of the DropInComponent instance.

let dropInComponent = DropInComponent(paymentMethods: session.sessionContext.paymentMethods,
                                      configuration: dropInConfiguration)

// Keep the instance of Drop-in to so that it doesn't get destroyed after the function is executed.
self.dropInComponent = dropInComponent

// Set the session as the delegate.
dropInComponent.delegate = session
// If you support gift cards, set the session as the partial payment delegate.
dropInComponent.partialPaymentDelegate = session

7. Show Drop-in in your app

Call the present method, passing the configured viewController.

present(dropInComponent.viewController, animated: true)

Your instance of AdyenSession handles all actions to complete the payment.

8. Handle the result

Drop-in either handles a result code or error object.

Result code

When the payment flow is finished, your instance of AdyenSession calls the didComplete method.
Implement this in your Drop-in configuration object:

func didComplete(with resultCode: SessionPaymentResultCode, // The result code from the API response.
                 component: Component, // The Drop-in component.
                 session: AdyenSession) // Your instance of AdyenSession.

Use the result code to tell your shopper the result of the payment. Possible result codes:

Result code Description Action to take
authorised The payment was successfully authorised. Inform the shopper that the payment was successful.
refused The payment was refused.
The response also contains a refusal reason that indicates why it was refused.
Inform the shopper that the payment was refused.
pending The final status of the payment isn't available yet. This is common for payments with an asynchronous flow, such as Boleto or iDEAL. Inform the shopper that you've received their order, and are waiting for them to complete the payment.
When the shopper completes the payment, you get the payment outcome.
cancelled The payment was cancelled (by either the shopper or your system) before processing was completed. Inform the shopper that the payment was cancelled.
error An error occurred during payment processing.
The response also contains an error code that gives more details about the error.
Inform the shopper that an error occurred during payment processing.
received The payment request was received, but the final status of the payment isn't available yet. Some payments, like SEPA Direct Debit, take time to process. Inform the shopper that you've received their order, and are waiting for the final payment result.

When the final payment status is available, you get the payment outcome.
presentToShopper Show the voucher or QR code to the shopper. Inform the shopper that you've received their order, and are waiting for them to complete the payment.
When the shopper completes the payment, you get the payment outcome.


If an error occurs during the payment flow, your instance of AdyenSession calls the didFail method containing the error.
Implement this in your Drop-in configuration object:

func didFail(with error: Error, // The error object.
             from component: Component, // The Drop-in component.
             session: AdyenSession) // Your instance of AdyenSession.

The error tells you the type of error and contains a message with details. Use the information to tell the shopper what happened and use the message to troubleshoot the error.

Step 3: Get the payment outcome

You get the outcome of each payment asynchronously, in a webhook event with eventCode: AUTHORISATION. Use this to update your order management system.
For a successful payment, the event contains success: true.

Example webhook for a successful payment
  "live": "false",

For an unsuccessful payment, you get success: false, and the reason field has details about why the payment was unsuccessful.

Example webhook for an unsuccessful payment
  "live": "false",
        "reason":"validation 101 Invalid card number",

Test and go live

Before going live, use our list of test cards and other payment methods to test your integration. We recommend testing each payment method that you intend to offer to your shoppers.

You can check the status of a test payment in your Customer Area, under TransactionsPayments.

To debug or troubleshoot test payments, you can also use API logs in your test environment.

When you are ready to go live, you need to:

  1. Apply for a live account. Review the process to start accepting payments on Get started with Adyen.
  2. Assess your PCI DSS compliance by submitting the Self-Assessment Questionnaire-A.
  3. Configure your live account
  4. Submit a request to add payment methods in your live Customer Area .
  5. Switch from test to our live endpoints.
  6. Load Drop-in from one of our live environments and set the environment to match your live endpoints:

    Endpoint region environment value
    Europe liveEurope
    Australia liveAustralia
    US liveUnitedStates
    Asia Pacific South East liveApse

Next steps