Search

Are you looking for test card numbers?

Would you like to contact support?

Online-payment icon

iOS Components integration guide

Build your checkout form with our iOS Components.

We built separate Components per payment method that you can use to render UI and collect your shopper's payment details. For more information on which payment methods have a Component, see list of Components.

If you are new to integrating with Adyen, see our Online payments page for an overview of integration options and available features.

Components is supported from v49 of the /paymentMethods, /payments, and /payments/details endpoints.

See sample code

  Check out Components on GitHub.

Whenever you want to offer a new payment method, you need to add the specific Component on your payments form. The steps for integrating each Component is similar regardless of the payment method.

On this page we talk about both server-side and client-side integration steps:

  1. From your server, submit a request to get a list of payment methods available to the shopper.
  2. Add Components to your payments form.
  3. From your server, submit a payment request with the data returned by the Component.
  4. Determine from the response if you need to perform additional actions on your client app, such as to redirect the shopper.
  5. From your server, verify the payment result.
  6. Present the payment result to the shopper.

Before you begin

Before you start integrating with our online payments API, make sure that you have performed the following steps:

  1. Sign up for an Adyen test account
  2. Get your API Key. Save a copy as you need it for API calls you make to the Adyen payments platform.
  3. Install one of our Libraries to connect with the Adyen APIs.
  4. If you're building for multiple merchants, provide some basic information so that we can offer you better support.
  5. Install Components for iOS.

Install iOS Components

Get Components for iOS from CocoaPods or Carthage.

CocoaPods

  1. Add pod 'Adyen' to your Podfile.
  2. Run pod install.

Carthage

  1. Add github "adyen/adyen-ios" to your Cartfile.
  2. Run carthage update.
  3. Link the framework with your target as described in Carthage Readme.

Step 1: Get available payment methods

  1. Make a POST /paymentMethods call, providing:

    • merchantAccount: Your merchant account name. 
    • countryCode: The shopper's country.
    • amount: The currency and value of the payment. 
    • channel: The platform of the shopper's device. Use iOS.

    We use the countryCodeamount, and channel to tailor the list of payment methods to your shopper.

    curl https://checkout-test.adyen.com/v50/paymentMethods \
    -H "x-API-key: YOUR_X-API-KEY" \
    -H "content-type: application/json" \
    -d '{
      "merchantAccount": "YOUR_MERCHANT_ACCOUNT",
      "countryCode": "NL",
      "amount": {
        "currency": "EUR",
        "value": 1000
      },
      "channel": "iOS"
    }'
    # Set your X-API-KEY with the API key from the Customer Area.
    adyen = Adyen::Client.new
    adyen.api_key = "YOUR_X-API-KEY"
    
    response = adyen.checkout.payment_methods({
      :merchantAccount => 'YOUR_MERCHANT_ACCOUNT',
      :countryCode => 'NL',
      :amount => {
        :currency => 'EUR',
        :value => 1000
      },
      :channel => 'iOS'
    })
    // Set your X-API-KEY with the API key from the Customer Area.
    Client client = new Client(xApiKey,Environment.TEST);
    
    Checkout checkout = new Checkout(client);
    PaymentMethodsRequest paymentMethodsRequest = new PaymentMethodsRequest();
    paymentMethodsRequest.setMerchantAccount("YOUR_MERCHANT_ACCOUNT");
    paymentMethodsRequest.setCountryCode("NL");
    Amount amount = new Amount();
    amount.setCurrency("EUR");
    amount.setValue(1000L);
    paymentMethodsRequest.setAmount(amount);
    paymentMethodsRequest.setChannel(PaymentMethodsRequest.ChannelEnum.IOS);
    PaymentMethodsResponse response = checkout.paymentMethods(paymentMethodsRequest);
    // Set your X-API-KEY with the API key from the Customer Area.
    $client = new \Adyen\Client();
    $client->setXApiKey("YOUR_X-API-KEY");
    $service = new \Adyen\Service\Checkout($client);
    
    $params = array(
      "merchantAccount" => "YOUR_MERCHANT_ACCOUNT",
      "countryCode" => "NL",
      "amount" => array(
        "currency" => "EUR",
        "value" => 1000
      ),
      "channel" => "iOS"
    );
    $result = $service->paymentMethods($params);
    #Set your X-API-KEY with the API key from the Customer Area.
    adyen = Adyen.Adyen()
    adyen.client.xapikey = 'YOUR_X-API-KEY'
    
    result = adyen.checkout.payment_methods({
      'merchantAccount': 'YOUR_MERCHANT_ACCOUNT',
      'countryCode': 'NL',
      'amount': {
        'value': 1000,
        'currency': 'EUR'
      },
      'channel': 'iOS',
    })
    // Set your X-API-KEY with the API key from the Customer Area.
    var client = new Client ("YOUR-X-API-KEY", Environment.Test);
    var checkout = new Checkout(client);
    var amount = new Model.Checkout.Amount("EUR", 1000);
    var paymentMethodsRequest = new Model.Checkout.PaymentMethodsRequest(MerchantAccount: "YOUR_MERCHANT_ACCOUNT")
    {
       CountryCode = "NL",
       Amount = amount,
       Channel = "iOS"
    };
    const {Client, Config, CheckoutAPI} = require('@adyen/api-library');
    const config = new Config();
    // Set your X-API-KEY with the API key from the Customer Area.
    config.apiKey = '[API_KEY]';
    config.merchantAccount = '[MERCHANT_ACCOUNT]';
    const client = new Client({ config });
    client.setEnvironment("TEST");
    const checkout = new CheckoutAPI(client);
    const paymentsResponse = checkout.paymentMethods({
        amount: {
            currency: "EUR",
            value: 1000,
        },
        countryCode: "NL",
        channel: "iOS",
        merchantAccount: config.merchantAccount
    }).then(res => res);

    A list of available paymentMethods is returned in the response. Each payment method has a:

    • name: Name of the payment method.
    • type: Unique payment method code.
    {
      "paymentMethods":[
        {
          "details":[...],
          "name":"Credit Card",
          "type":"scheme"
          ...
        },
        {
          "details":[...],
          "name":"SEPA Direct Debit",
          "type":"sepadirectdebit"
        },
        ...
      ]
    }

If you want to know more about the properties returned in the response, see the response parameters on API Explorer.

  1. Pass the response to your client app. You then use this in the next step to present which payment methods are available to the shopper.

Step 2: Add Components to your payment form

  1. Decode the /paymentMethods response with the PaymentMethods structure. Find the payment method object for the Component that you want to instantiate. For example, for a card payment, you need to find the CardPaymentMethod object.

    let paymentMethods = try JSONDecoder().decode(PaymentMethods.self, from: paymentMethodsResponse)
  2. Initialize the Component for the payment method that you'll be accepting. To initialize a Component, you will need the decoded payment method response, and any other additional required parameters.

    The steps for adding Components are the same for each payment method, however, some may require additional configuration. For information on the required configuration, refer to the payment method integration guides.

    For example, to initialize the CardComponent, you also need the Client Encryption Public Key.

    let cardComponent = CardComponent(paymentMethod: cardPaymentMethod,
    publicKey: "YOUR_PUBLIC_KEY")
    // Replace CardComponent with the payment method Component that you want to add.
    // Check specific payment method pages to confirm if you need to configure additional required parameters.
    // For example, to enable the Card form, you need to provide your Client Encryption Public Key.
    cardComponent.delegate = self
    cardComponent.environment = .test
    // When you're ready to go live, change this to .live
    // or to other environment values described in https://adyen.github.io/adyen-ios/Docs/Structs/Environment.html
    present(cardComponent.viewController, animated: true)
  3. After the shopper provides payment details, the Component invokes the didSubmit method from the PaymentComponentDelegate. Get the contents of data.paymentMethod and pass this to your server. Dismiss the Component immediately, or wait until you have submitted the details to your server.

    func didSubmit(_ data: PaymentComponentData, from component: PaymentComponent)

    In case an error occurs on the app, the Component invokes the didFail method from the PaymentComponentDelegate. Dismiss the Component's view controller and display an error message.

    func didFail(with error: Error, from component: PaymentComponent)

For more information on iOS Components classes, see our reference documentation page.

Step 3: Make a payment

  1. From your server, make a POST /payments request specifying:

    • amount
    • reference: Your unique reference for this payment.
    • paymentMethod: The data.paymentMethod from the didSubmit method from your client app.
    • returnUrl: URL to where the shopper should be taken back to after a redirection. This is used for payment methods that require redirection to issuer's site, such as iDEAL, or in a 3D Secure authentication flow. For more information on setting a custom URL scheme for your app, read the Apple Developer documentation.
    • merchantAccount: Your merchant account name.
      Additional parameters are required for some payment methods, native 3D Secure 2 authentication, and recurring payments. For information on the required fields, refer to the payment method integration guides.

    The example below shows how you would make a card payment using encrypted values generated by the Card Component.

    curl https://checkout-test.adyen.com/v51/payments \
    -H "x-API-key: YOUR_X-API-KEY" \
    -H "content-type: application/json" \
    -d '{
      "amount":{
        "currency":"EUR",
        "value":1000
      },
      "reference":"YOUR_ORDER_NUMBER",
      "paymentMethod": {hint:data.paymentMethod from the didSubmit}data.paymentMethod{/hint},
      "returnUrl":"my-app://",
      "merchantAccount":"YOUR_MERCHANT_ACCOUNT"
    }'
    # Set your X-API-KEY with the API key from the Customer Area.
    adyen = Adyen::Client.new
    adyen.env = :test
    adyen.api_key = "YOUR_X-API-KEY"
     
    paymentMethod = COMPONENT_DATA_PAYMENTMETHOD
    # Data object passed from didSubmit method from the client app, parsed from JSON to a Hash.
    
    response = adyen.checkout.payments({
      :amount => {
        :currency => "EUR",
        :value => 1000
      },
      :reference => "YOUR_ORDER_NUMBER",
      :paymentMethod => paymentMethod,
      :returnUrl => "https://your-company.com/checkout?shopperOrder=12xy..",
      :merchantAccount => "YOUR_MERCHANT_ACCOUNT"
    })
    
    # Check if further action is needed.
    if response.body.has_key(:action)
       # Pass the action object to your front end
       # response.body[:action]
    else
       # No further action needed, pass the resultCode object to your front end
       # response.body[:resultCode]
    // Set your X-API-KEY with the API key from the Customer Area.
    Client client = new Client(xApiKey,Environment.TEST);
     
    Checkout checkout = new Checkout(client);
    PaymentsRequest paymentsRequest = new PaymentsRequest();
    paymentsRequest.setMerchantAccount("YOUR_MERCHANT_ACCOUNT");
    Amount amount = new Amount();
    amount.setCurrency("EUR");
    amount.setValue(15000L);
    paymentsRequest.setAmount(amount);
    String encryptedCardNumber = "adyenjs_0_1_18$...encryptedCardNumber";
    String encryptedExpiryMonth = "adyenjs_0_1_18$...encryptedExpiryMonth";
    String encryptedExpiryYear = "adyenjs_0_1_18$...encryptedExpiryYear";
    String encryptedSecurityCode = "adyenjs_0_1_18$...encryptedSecurityCode";
    paymentsRequest.setReference("Your order number");
    paymentsRequest.addEncryptedCardData(encryptedCardNumber,encryptedExpiryMonth, encryptedExpiryYear, encryptedSecurityCode, "John Smith");
    paymentsRequest.setReturnUrl("my-app://");
    PaymentsResponse paymentsResponse = checkout.payments(paymentsRequest);
    // Set your X-API-KEY with the API key from the Customer Area.
    $client = new \Adyen\Client();
    $client->setXApiKey("YOUR_X-API-KEY");
    $service = new \Adyen\Service\Checkout($client);
    
    $paymentMethod = COMPONENT_DATA_PAYMENTMETHOD;
    // Data object passed from didSubmit method from the client app, parsed from JSON to an array
    
    $params = array(
      "amount" => array(
        "currency" => "EUR",
        "value" => 1000
      ),
      "reference" => "YOUR_ORDER_NUMBER",
      "paymentMethod" => $paymentMethod,
      "returnUrl" => "https://your-company.com/checkout?shopperOrder=12xy..",
      "merchantAccount" => "YOUR_MERCHANT_ACCOUNT"
    );
    
    $result = $service->payments($params);
    
    // Check if further action is needed.
    if (array_key_exists("action", $result){
       // Pass the action object to your front end
       // $result["action"]
    }
    else {
       // No further action needed, pass the resultCode to your front end
       // $result['resultCode']
    }
    # Set your X-API-KEY with the API key from the Customer Area.
    adyen = Adyen.Adyen()
    adyen.client.xapikey = 'YOUR_X-API-KEY'
    
    paymentMethod = COMPONENT_DATA_PAYMENTMETHOD
    # Data object passed from didSubmit method from the client app, parsed from JSON to a dictionary
    
    result = adyen.checkout.payments({
       'amount': {
          'value': 1000,
          'currency': 'EUR'
       },
       'reference': 'YOUR_ORDER_NUMBER',
       'paymentMethod': paymentMethod,
       'returnUrl': 'https://your-company.com/checkout?shopperOrder=12xy..',
       'merchantAccount': 'YOUR_MERCHANT_ACCOUNT'
    })
    
    # Check if further action is needed
    if 'action' in result.message:
       # Pass the action object to your front end
       # result.message['action']
    else:
       # No further action needed, pass the resultCode to your front end
       # result.message['resultCode']
    // Set your X-API-KEY with the API key from the Customer Area.
    var client = new Client ("YOUR_X-API-KEY", Environment.Test);
    var checkout = new Checkout(client);
    
    var amount = new Model.Checkout.Amount("EUR", 1000);
    var details = new Model.Checkout.DefaultPaymentMethodDetails{
      Type = "scheme",
      EncryptedCardNumber = "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
      EncryptedExpiryMonth = "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
      EncryptedExpiryYear = "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
      EncryptedSecurityCode = "adyenjs_0_1_18$MT6ppy0FAMVMLH..."
    };
    var paymentsRequest = new Model.Checkout.PaymentRequest
    {
      Reference = "YOUR_ORDER_NUMBER",
      Amount = amount,
      ReturnUrl = @"my-app://",
      MerchantAccount = "YOUR_MERCHANT_ACCOUNT",
      PaymentMethod = details
    };
    
    var paymentResponse = checkout.Payments(paymentsRequest);
    // Set your X-API-KEY with the API key from the Customer Area.
    const {Client, Config, CheckoutAPI} = require('@adyen/api-library');
    const config = new Config();
    // Set your X-API-KEY with the API key from the Customer Area.
    config.apiKey = '[API_KEY]';
    config.merchantAccount = '[YOUR_MERCHANT_ACCOUNT]';
    const client = new Client({ config });
    client.setEnvironment("TEST");
    const checkout = new CheckoutAPI(client);
    checkout.payments({
        amount: { currency: "EUR", value: 1000 },
        paymentMethod: {COMPONENT_DATA_PAYMENTMETHOD}, // Data object passed from didSubmit method from the client app
        reference: "YOUR_ODRER_NUMBER",
        merchantAccount: config.merchantAccount,
        shopperReference: "shopperReference",
        returnUrl: "https://your-company.com/checkout?shopperOrder=12xy.."
    }).then(res => res);

    Response

    Depending on the payment result, you receive a response containing:

    • resultCode: Provides information about the result of the request.
    • pspReference: Our unique identifier for the transaction.
    • details: This array shows the fields that you need to pass in your next request.
    • action: If you receive this object, this indicates that you need to perform an additional action on your client app to complete the payment. The type field specifies the required action. Possible values are:

      • redirect
      • threeDS2Fingerprint
      • threeDS2Challenge

  2. The next steps depend on if you received an action object in the response.

    • If you received an action object, pass this to your client app and perform step 4. Make sure that you only pass the action object and not the full response.
    • If you did not get an action object, proceed to step 6 to present the payment result to your shopper.
    {
    "pspReference": "88154795347618C",
    "resultCode": "Authorised"
    }
    {
    "resultCode": "RedirectShopper",
    "action": {
      "method": "POST",
      "paymentData": "Ab02b4c0!BQABAgCW5sxB4e/==",
      "paymentMethodType": "scheme",
      "type": "redirect",
      "url": "https://test.adyen.com/hpp/3d/validate.shtml",
      "data": {
        "PaReq": "eNpVUslygkAQ/RXjB8yCgEi1kyJSq..",
        "TermUrl": "https://your-company.com/...",
        "MD": "ejJydDdDeExyVUFrTEFaMTlITCt_..."
      }
    },
    "details": [
    {
      "key": "MD",
      "type": "text"
    },
    {
      "key": "PaRes",
      "type": "text"
    }
    ],
    "paymentData": "Ab02b4c0!BQABAgCW5sxB4e/=="
    }

Step 4: Perform additional actions on your client app

  1. Use the Action class to determine the type of action that you should take.

    let action = try JSONDecoder().decode(Action.self, from: actionResponse)
  2. Your next steps depend on what the action that the class returns:

Step 5: Submit additional payment details

  1. From your server, make a POST /payments/details request.

    • details: This is the data.details from the didProvide method from your client app.
    curl https://checkout-test.adyen.com/v51/payments/details \
    -H "x-API-key: YOUR_X-API-KEY" \
    -H "content-type: application/json" \
    -d '{hint:data.details from didProvide}data.details{/hint}'
    # Set your X-API-KEY with the API key from the Customer Area.
    adyen = Adyen::Client.new
    adyen.env = :test
    adyen.api_key = "YOUR_X-API-KEY"
    
    request = COMPONENT_DATA_DETAILS
    # Data object passed from didProvide method from the client app, parsed from JSON to a Hash.
    
    response = adyen.checkout.payments.details(request)
    
    # Check if further action is needed.
    if response.body.has_key(:action)
       # Pass the action object to your frontend
       puts response.body[:action]
    else
       # No further action needed, pass the resultCode to your frontend
       puts response.body[:resultCode]
    end
    // Set your X-API-KEY with the API key from the Customer Area.
    String apiKey = "YOUR_X-API-KEY";
    
    String paymentData = "Ab02b4c0!BQABAgAKspbjN8+5...";
    String fingerPrint = "eyJ0aHJlZURTQ29tcEluZCI6IlkifQ==";
    
    Client client = new Client(apiKey,Environment.TEST);
    Checkout checkout = new Checkout(client);
    PaymentDetailsRequest paymentDetailsRequest = new PaymentDetailsRequest();
    paymentDetailsRequest.setFingerPrint();
    PaymentsResponse paymentsResponse = checkout.paymentDetails(PaymentDetailsRequest);
    // Set your X-API-KEY with the API key from the Customer Area.
    $client = new \Adyen\Client();
    $client->setXApiKey("YOUR_X-API-KEY");
    $service = new \Adyen\Service\Checkout($client);
    
    $params = COMPONENT_DATA_DETAILS;
    // Data object passed from didProvide method from the client app, parsed from JSON to an array
    
    $result = $service->paymentDetails($params);
    
    // Check if further action is needed
    if (array_key_exists("action", $result){
       // Pass the action object to your frontend.
       // $result["action"]
    }
    else {
       // No further action needed, pass the resultCode to your front end
       // $result['resultCode']
    }
    #Set your X-API-KEY with the API key from the Customer Area.
    adyen = Adyen.Adyen()
    adyen.client.xapikey = 'YOUR_X-API-KEY'
    
    request = COMPONENT_DATA_DETAILS
    # Data object passed from didProvide method from the client app, parsed from JSON to a dictionary
    
    result = adyen.checkout.payments_details(request)
    
    # Check if further action is needed.
    if 'action' in result.message:
       # Pass the action object to your front end
       # result.message['action']
    else:
       # No further action needed, pass the resultCode to your front end
       # result.message['resultCode']
    // Set your X-API-KEY with the API key from the Customer Area.
    var client = new Client ("YOUR_X-API-KEY", Environment.Test);
    var checkout = new Checkout(client);
    string paymentData = "Ab02b4c0!BQABAgCuZFJrQOjSsl\/zt+...";
    string fingerPrint = "eyJ0aHJlZURTQ29tcEluZCI6IlkifQ==";
    
    var details = new Dictionary<string, string>
    {
      { "threeds2.fingerprint": fingerPrint }
    };
    var paymentsDetailsRequest = new Model.Checkout.PaymentsDetailsRequest(Details: details);
    var paymentResponse = checkout.PaymentDetails(paymentsDetailsRequest);
    // Set your X-API-KEY with the API key from the Customer Area.
    const {Client, Config, CheckoutAPI} = require('@adyen/api-library');
    const config = new Config();
    // Set your X-API-KEY with the API key from the Customer Area.
    config.apiKey = '[API_KEY]';
    config.merchantAccount = '[MERCHANT_ACCOUNT]';
    const client = new Client({ config });
    client.setEnvironment("TEST");
    const checkout = new CheckoutAPI(client);
    checkout.paymentsDetails({
        details: {COMPONENT_DATA_DETAILS}  // Data object passed from didProvide method from the client app
    }).then(res => res);


    Depending on the payment result, you receive a response containing:

    • resultCode: Provides information about the result of the request.
    • pspReference: Our unique identifier for the transaction.
    • action: If you receive this object, this indicates that you need to perform step 4 again.

  2. The next steps depend on if you received an action object in the response.
    • If you received an action object, pass the action object to your client app and perform step 4 again.
    • If you did not get an action object, proceed to the next step to present the payment result to your shopper.

Step 6: Present the payment result

After the shopper completes the payment and no more further actions are required on the client app, use the resultCode to inform the shopper of the payment status.

resultCode Description Action to take
Authorised The payment was successful. Inform the shopper that the payment was successful.
Error Inform the shopper that there was an error processing their payment. You'll receive a refusalReason in the same response, indicating the cause of the error.
Pending The shopper has completed the payment but the final result is not yet known. Inform the shopper that you've received their order, and are waiting for the payment to be completed.
You will receive the final result of the payment in an AUTHORISATION notification.
Refused The payment was refused. Inform the shopper that the payment was refused. Ask the shopper to try the payment again using a different payment method or card.
Received For some payment methods, it can take some time before the final status of the payment is known. Inform the shopper that you've received their order, and are waiting for the payment to clear.
You will receive the final result of the payment in an AUTHORISATION notification.

For other possible resultCode values and recommended messages that you can present to your shopper, see Result codes.

Action Components

Use the following Components to help you perform additional required actions as described in step 4, such as redirecting your shopper to another app or to a website to complete the payment, or handling 3D Secure 2 native authentication flows. The Components also returns the information that you need to submit in your next API request.

Using the Redirect Component

  1. If you get Action .redirect, initialize the Redirect Component.

    let redirectComponent = RedirectComponent(action: redirectAction)
  2. You then need to inform the Component when shopper returns to your app. To do this, implement the following in your UIApplicationDelegate:

    func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey: Any] = [:]) -> Bool {
     RedirectComponent.applicationDidOpen(url)
    
     return true
    }
  3. After the Redirect Component completes the additional action, the Component invokes the didProvide method from the ActionComponentDelegate. Get the contents of data.details and pass this to your server. Dismiss the Component immediately, or wait until you have submitted the details to your server.

    func didSubmit(_ data: ActionComponentData, from component: ActionComponent)

    In case an error occurs on the app, the Component invokes the didFail method from the ActionComponentDelegate. Dismiss the Component's view controller and display an error message.

    func didFail(with error: Error, from component: ActionComponent)
  4. From your server, make a POST /payments/details request.

    • details: This is the data.details from the didProvide method from your client app.
    curl https://checkout-test.adyen.com/v51/payments/details \
    -H "x-API-key: YOUR_X-API-KEY" \
    -H "content-type: application/json" \
    -d '{hint:data.details from didProvide}data.details{/hint}'
    # Set your X-API-KEY with the API key from the Customer Area.
    adyen = Adyen::Client.new
    adyen.env = :test
    adyen.api_key = "YOUR_X-API-KEY"
    
    request = COMPONENT_DATA_DETAILS
    # Data object passed from didProvide method from the client app, parsed from JSON to a Hash.
    
    response = adyen.checkout.payments.details(request)
    
    # Check if further action is needed.
    if response.body.has_key(:action)
       # Pass the action object to your frontend
       puts response.body[:action]
    else
       # No further action needed, pass the resultCode to your frontend
       puts response.body[:resultCode]
    end
    // Set your X-API-KEY with the API key from the Customer Area.
    String apiKey = "YOUR_X-API-KEY";
    
    String paymentData = "Ab02b4c0!BQABAgAKspbjN8+5...";
    String fingerPrint = "eyJ0aHJlZURTQ29tcEluZCI6IlkifQ==";
    
    Client client = new Client(apiKey,Environment.TEST);
    Checkout checkout = new Checkout(client);
    PaymentDetailsRequest paymentDetailsRequest = new PaymentDetailsRequest();
    paymentDetailsRequest.setFingerPrint();
    PaymentsResponse paymentsResponse = checkout.paymentDetails(PaymentDetailsRequest);
    // Set your X-API-KEY with the API key from the Customer Area.
    $client = new \Adyen\Client();
    $client->setXApiKey("YOUR_X-API-KEY");
    $service = new \Adyen\Service\Checkout($client);
    
    $params = COMPONENT_DATA_DETAILS;
    // Data object passed from didProvide method from the client app, parsed from JSON to an array
    
    $result = $service->paymentDetails($params);
    
    // Check if further action is needed
    if (array_key_exists("action", $result){
       // Pass the action object to your frontend.
       // $result["action"]
    }
    else {
       // No further action needed, pass the resultCode to your front end
       // $result['resultCode']
    }
    #Set your X-API-KEY with the API key from the Customer Area.
    adyen = Adyen.Adyen()
    adyen.client.xapikey = 'YOUR_X-API-KEY'
    
    request = COMPONENT_DATA_DETAILS
    # Data object passed from didProvide method from the client app, parsed from JSON to a dictionary
    
    result = adyen.checkout.payments_details(request)
    
    # Check if further action is needed.
    if 'action' in result.message:
       # Pass the action object to your front end
       # result.message['action']
    else:
       # No further action needed, pass the resultCode to your front end
       # result.message['resultCode']
    // Set your X-API-KEY with the API key from the Customer Area.
    var client = new Client ("YOUR_X-API-KEY", Environment.Test);
    var checkout = new Checkout(client);
    string paymentData = "Ab02b4c0!BQABAgCuZFJrQOjSsl\/zt+...";
    string fingerPrint = "eyJ0aHJlZURTQ29tcEluZCI6IlkifQ==";
    
    var details = new Dictionary<string, string>
    {
      { "threeds2.fingerprint": fingerPrint }
    };
    var paymentsDetailsRequest = new Model.Checkout.PaymentsDetailsRequest(Details: details);
    var paymentResponse = checkout.PaymentDetails(paymentsDetailsRequest);
    // Set your X-API-KEY with the API key from the Customer Area.
    const {Client, Config, CheckoutAPI} = require('@adyen/api-library');
    const config = new Config();
    // Set your X-API-KEY with the API key from the Customer Area.
    config.apiKey = '[API_KEY]';
    config.merchantAccount = '[MERCHANT_ACCOUNT]';
    const client = new Client({ config });
    client.setEnvironment("TEST");
    const checkout = new CheckoutAPI(client);
    checkout.paymentsDetails({
        details: {COMPONENT_DATA_DETAILS}  // Data object passed from didProvide method from the client app
    }).then(res => res);

    The response contains:

      {
       "resultCode": "Authorised",
       "pspReference": "88154795347618C"
     }

Using the 3D Secure 2 Component

  1. If you get Action .threeDS2Fingerprint, initialize the 3D Secure 2 Component.

    let threeDS2Component = ThreeDS2Component()
    threeDS2Component.delegate = self
    self.threeDS2Component = threeDS2Component
    
    threeDS2Component.handle(action)
  2. After the Component completes the 3D Secure 2 device fingerprinting, the Component invokes the didProvide method from the ActionComponentDelegate. Get the contents of data.details and pass this to your server. Dismiss the Component immediately, or wait until you have submitted the details to your server.

    func didSubmit(_ data: ActionComponentData, from component: ActionComponent)

    In case an error occurs on the app, the Component invokes the didFail method from the ActionComponentDelegate. Dismiss the Component's view controller and display an error message.

    func didFail(with error: Error, from component: ActionComponent)
  3. From your server, make a POST /payments/details request.

    • details: This is the data.details from the didProvide method from your client app.
    curl https://checkout-test.adyen.com/v51/payments/details \
    -H "x-API-key: YOUR_X-API-KEY" \
    -H "content-type: application/json" \
    -d '{hint:data.details from didProvide}data.details{/hint}'
    # Set your X-API-KEY with the API key from the Customer Area.
    adyen = Adyen::Client.new
    adyen.env = :test
    adyen.api_key = "YOUR_X-API-KEY"
    
    request = COMPONENT_DATA_DETAILS
    # Data object passed from didProvide method from the client app, parsed from JSON to a Hash.
    
    response = adyen.checkout.payments.details(request)
    
    # Check if further action is needed.
    if response.body.has_key(:action)
       # Pass the action object to your frontend
       puts response.body[:action]
    else
       # No further action needed, pass the resultCode to your frontend
       puts response.body[:resultCode]
    end
    // Set your X-API-KEY with the API key from the Customer Area.
    String apiKey = "YOUR_X-API-KEY";
    
    String paymentData = "Ab02b4c0!BQABAgAKspbjN8+5...";
    String fingerPrint = "eyJ0aHJlZURTQ29tcEluZCI6IlkifQ==";
    
    Client client = new Client(apiKey,Environment.TEST);
    Checkout checkout = new Checkout(client);
    PaymentDetailsRequest paymentDetailsRequest = new PaymentDetailsRequest();
    paymentDetailsRequest.setFingerPrint();
    PaymentsResponse paymentsResponse = checkout.paymentDetails(PaymentDetailsRequest);
    // Set your X-API-KEY with the API key from the Customer Area.
    $client = new \Adyen\Client();
    $client->setXApiKey("YOUR_X-API-KEY");
    $service = new \Adyen\Service\Checkout($client);
    
    $params = COMPONENT_DATA_DETAILS;
    // Data object passed from didProvide method from the client app, parsed from JSON to an array
    
    $result = $service->paymentDetails($params);
    
    // Check if further action is needed
    if (array_key_exists("action", $result){
       // Pass the action object to your frontend.
       // $result["action"]
    }
    else {
       // No further action needed, pass the resultCode to your front end
       // $result['resultCode']
    }
    #Set your X-API-KEY with the API key from the Customer Area.
    adyen = Adyen.Adyen()
    adyen.client.xapikey = 'YOUR_X-API-KEY'
    
    request = COMPONENT_DATA_DETAILS
    # Data object passed from didProvide method from the client app, parsed from JSON to a dictionary
    
    result = adyen.checkout.payments_details(request)
    
    # Check if further action is needed.
    if 'action' in result.message:
       # Pass the action object to your front end
       # result.message['action']
    else:
       # No further action needed, pass the resultCode to your front end
       # result.message['resultCode']
    // Set your X-API-KEY with the API key from the Customer Area.
    var client = new Client ("YOUR_X-API-KEY", Environment.Test);
    var checkout = new Checkout(client);
    string paymentData = "Ab02b4c0!BQABAgCuZFJrQOjSsl\/zt+...";
    string fingerPrint = "eyJ0aHJlZURTQ29tcEluZCI6IlkifQ==";
    
    var details = new Dictionary<string, string>
    {
      { "threeds2.fingerprint": fingerPrint }
    };
    var paymentsDetailsRequest = new Model.Checkout.PaymentsDetailsRequest(Details: details);
    var paymentResponse = checkout.PaymentDetails(paymentsDetailsRequest);
    // Set your X-API-KEY with the API key from the Customer Area.
    const {Client, Config, CheckoutAPI} = require('@adyen/api-library');
    const config = new Config();
    // Set your X-API-KEY with the API key from the Customer Area.
    config.apiKey = '[API_KEY]';
    config.merchantAccount = '[MERCHANT_ACCOUNT]';
    const client = new Client({ config });
    client.setEnvironment("TEST");
    const checkout = new CheckoutAPI(client);
    checkout.paymentsDetails({
        details: {COMPONENT_DATA_DETAILS}  // Data object passed from didProvide method from the client app
    }).then(res => res);

    The response contains:

    • pspReference: Our unique identifier for the transaction.
    • action: If the issuer requires further shopper interaction in a challenge flow, you might still get this object with type threeDS2Challenge.
    • resultCode: If the response does not contain an action object, use this to present the result to your shopper.
    {
    ...
      "action":{
        "paymentMethodType":"scheme",
        "token":"eyJ0aH...",
        "type":"threeDS2Challenge"
      },
    ...
    }
  4. To handle the challenge flow, pass the action object from the /payments/details response.

    threeDS2Component.handle(action)
  5. After the Component completes the 3D Secure 2 challenge flow, the Component invokes the didProvide method from the ActionComponentDelegate. Get the contents of data.details and pass this to your server.

    func didSubmit(_ data: ActionComponentData, from component: ActionComponent)

    In case an error occurs on the app, the Component invokes the didFail method from the ActionComponentDelegate. Dismiss the Component's view controller and display an error message.

    func didFail(with error: Error, from component: ActionComponent)
  6. From your server, make a POST /payments/details request again.

    • details: This is the data.details from the didProvide method from your client app.
    curl https://checkout-test.adyen.com/v51/payments/details \
    -H "x-API-key: YOUR_X-API-KEY" \
    -H "content-type: application/json" \
    -d '{hint:data.details from didProvide}data.details{/hint}'
    # Set your X-API-KEY with the API key from the Customer Area.
    adyen = Adyen::Client.new
    adyen.env = :test
    adyen.api_key = "YOUR_X-API-KEY"
    
    request = COMPONENT_DATA_DETAILS
    # Data object passed from didProvide method from the client app, parsed from JSON to a Hash.
    
    response = adyen.checkout.payments.details(request)
    
    # Check if further action is needed.
    if response.body.has_key(:action)
       # Pass the action object to your frontend
       puts response.body[:action]
    else
       # No further action needed, pass the resultCode to your frontend
       puts response.body[:resultCode]
    end
    // Set your X-API-KEY with the API key from the Customer Area.
    String apiKey = "YOUR_X-API-KEY";
    
    String paymentData = "Ab02b4c0!BQABAgAKspbjN8+5...";
    String fingerPrint = "eyJ0aHJlZURTQ29tcEluZCI6IlkifQ==";
    
    Client client = new Client(apiKey,Environment.TEST);
    Checkout checkout = new Checkout(client);
    PaymentDetailsRequest paymentDetailsRequest = new PaymentDetailsRequest();
    paymentDetailsRequest.setFingerPrint();
    PaymentsResponse paymentsResponse = checkout.paymentDetails(PaymentDetailsRequest);
    // Set your X-API-KEY with the API key from the Customer Area.
    $client = new \Adyen\Client();
    $client->setXApiKey("YOUR_X-API-KEY");
    $service = new \Adyen\Service\Checkout($client);
    
    $params = COMPONENT_DATA_DETAILS;
    // Data object passed from didProvide method from the client app, parsed from JSON to an array
    
    $result = $service->paymentDetails($params);
    
    // Check if further action is needed
    if (array_key_exists("action", $result){
       // Pass the action object to your frontend.
       // $result["action"]
    }
    else {
       // No further action needed, pass the resultCode to your front end
       // $result['resultCode']
    }
    #Set your X-API-KEY with the API key from the Customer Area.
    adyen = Adyen.Adyen()
    adyen.client.xapikey = 'YOUR_X-API-KEY'
    
    request = COMPONENT_DATA_DETAILS
    # Data object passed from didProvide method from the client app, parsed from JSON to a dictionary
    
    result = adyen.checkout.payments_details(request)
    
    # Check if further action is needed.
    if 'action' in result.message:
       # Pass the action object to your front end
       # result.message['action']
    else:
       # No further action needed, pass the resultCode to your front end
       # result.message['resultCode']
    // Set your X-API-KEY with the API key from the Customer Area.
    var client = new Client ("YOUR_X-API-KEY", Environment.Test);
    var checkout = new Checkout(client);
    string paymentData = "Ab02b4c0!BQABAgCuZFJrQOjSsl\/zt+...";
    string fingerPrint = "eyJ0aHJlZURTQ29tcEluZCI6IlkifQ==";
    
    var details = new Dictionary<string, string>
    {
      { "threeds2.fingerprint": fingerPrint }
    };
    var paymentsDetailsRequest = new Model.Checkout.PaymentsDetailsRequest(Details: details);
    var paymentResponse = checkout.PaymentDetails(paymentsDetailsRequest);
    // Set your X-API-KEY with the API key from the Customer Area.
    const {Client, Config, CheckoutAPI} = require('@adyen/api-library');
    const config = new Config();
    // Set your X-API-KEY with the API key from the Customer Area.
    config.apiKey = '[API_KEY]';
    config.merchantAccount = '[MERCHANT_ACCOUNT]';
    const client = new Client({ config });
    client.setEnvironment("TEST");
    const checkout = new CheckoutAPI(client);
    checkout.paymentsDetails({
        details: {COMPONENT_DATA_DETAILS}  // Data object passed from didProvide method from the client app
    }).then(res => res);

    The response contains:

      {
       "resultCode": "Authorised",
       "pspReference": "88154795347618C"
     }

Customizing the UI for 3D Secure 2

The Component inherits your app's theme to ensure the UI of the challenge flow fits your app's look and feel. If you require further UI customizations, use the customization options provided in the appearanceConfiguration property.

For more information on iOS Components classes, see our reference documentation page.

Localization

Our iOS Components supports the languages listed here.

However, if you want to customize the localization, you can add new localizable.strings file for the language that you need. You can also override existing entries by using the same keys.

For example, to override the cardholder name field title, set the following on your localizable.strings file:

"adyen.card.nameItem.title" = "Your cardholder name";

The library first checks the key in the main application bundle and then in the internal bundle.

Check all available strings on GitHub.

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 Transactions > Payments.

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

  1. Complete additional steps before you can accept live payments from shoppers. Refer to Getting started with Adyen for more information. 
  2. Switch from test to our live endpoints.
  3. Load Drop-in from one of our live environments closest to where your shoppers are. Set the dropInComponent.environment to any of the following values:

    • Europe: liveEurope
    • Australia: liveAustralia
    • US: liveUnitedStates

Supported payment methods

We have Components for the following payment methods. If you have questions about payment methods not on the list below or those that do not have linked pages, contact Support Team.

Payment method Web iOS Android
AfterPay -white_check_mark-
Apple Pay -white_check_mark- -white_check_mark-
Bancontact Mobile (Payconiq) -white_check_mark- -white_check_mark-
Boleto Bancário -white_check_mark-
Cards, including 3D Secure 1 and 3D Secure 2
authentication
-white_check_mark- -white_check_mark- -white_check_mark-
Stored card details -white_check_mark- -white_check_mark- -white_check_mark-
Dragonpay -white_check_mark-
Dotpay -white_check_mark- -white_check_mark- -white_check_mark-
Entercash -white_check_mark- -white_check_mark- -white_check_mark-
EPS -white_check_mark- -white_check_mark- -white_check_mark-
giropay -white_check_mark-
Google Pay -white_check_mark- -white_check_mark-
iDEAL -white_check_mark- -white_check_mark- -white_check_mark-
Japanese convenience stores (Konbini)/
7-Eleven Japan
-white_check_mark-
Klarna -white_check_mark- -white_check_mark- -white_check_mark-
MOLPay -white_check_mark- -white_check_mark- -white_check_mark-
Multibanco -white_check_mark-
Open banking -white_check_mark- -white_check_mark- -white_check_mark-
Online banking India -white_check_mark-
Online banking Japan -white_check_mark-
QiwiWallet -white_check_mark-
Redirect payment methods
(For example, UnionPay)
-white_check_mark- -white_check_mark- -white_check_mark-
SEPA Direct Debit -white_check_mark- -white_check_mark- -white_check_mark-
Vipps -white_check_mark-
Wallets India -white_check_mark-
WeChat Pay -white_check_mark- -white_check_mark-

We're actively building Components for more payment methods. To check the latest on Components, see our release notes.

See also

Next steps