---
title: "Redirect 3DS Components integration"
description: "Support cards with 3D Secure authentication through a redirect in your iOS app"
url: "https://docs.adyen.com/online-payments/3d-secure/redirect-3ds2/ios-component"
source_url: "https://docs.adyen.com/online-payments/3d-secure/redirect-3ds2/ios-component.md"
canonical: "https://docs.adyen.com/online-payments/3d-secure/redirect-3ds2/ios-component"
last_modified: "2021-05-11T17:34:00+02:00"
language: "en"
---

# Redirect 3DS Components integration

Support cards with 3D Secure authentication through a redirect in your iOS app

[View source](/online-payments/3d-secure/redirect-3ds2/ios-component.md)

Use our Redirect Component to redirect the shopper to perform 3D Secure 2 authentication.

When adding card payments with redirect 3D Secure authentication to your integration, you additionally need to:

1. [Collect additional parameters in your payment form](#collect-additional-parameters).
2. [Provide the required 3D Secure parameters](#make-a-payment) when making a payment request.
3. [Use the Redirect Component](#handle-the-redirect) to handle the redirect.

## Requirements

Before starting your integration:

1. Make sure that you have integrated our [Card Component](/payment-methods/cards/ios-component), or [built your own UI](/payment-methods/cards/api-only) for collecting shopper's card details.
2. If you are using 3D Secure for PSD2 compliance, read our [comprehensive PSD2 SCA guide](/online-payments/psd2-sca-compliance-and-implementation-guide).

## Collect additional information at checkout

For higher authentication rates, we strongly recommend that you collect the cardholder name for payments with 3D Secure authentication.

To collect the cardholder name using our [Card Component](/payment-methods/cards/ios-component), specify the following when [adding the Card Component](/payment-methods/cards/ios-component/#optional-configuration):

* `showsHolderNameField`: **true**

```swift
let configuration = CardComponent.Configuration(showsHolderNameField: true)
let component =  CardComponent(paymentMethod: paymentMethod,
                                   apiContext: apiContext,
                                   configuration: configuration)
component.delegate = self
self.cardComponent = component
present(component.viewController, animated: true)
```

We also recommend that you collect the shopper billing address in advance in your payment form. Deliver this parameter to your backend when [making a payment](#make-a-payment) as it is required by the card schemes.

## Make a payment

1. When you [make a payment request](/online-payments/build-your-integration/advanced-flow?platform=iOS\&integration=Drop-in\&version=latest#make-a-payment), include the following additional 3D Secure 2 parameters.

   See additional 3D Secure 2 parameters that we recommend to include in your request to increase authentication performance in our [API reference](/online-payments/3d-secure/api-reference).

   | Parameter name                                                                                                                             | Required                                                                                                                                                | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
   | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- |   |
   | [paymentMethod](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-paymentMethod)                                   | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto)                                           | The type and required details for a card payment method. When using the [Card Component](/payment-methods/cards/ios-component), pass the `data.paymentMethod` from the `didSubmit` event from your client app. When submitting raw card data, refer to [Raw card data](/payment-methods/cards/raw-card-data#make-a-payment) for the fields that you need to pass.                                                                                                                                                                                  |
   | [paymentMethod.holderName](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-paymentMethod-CardDetails-holderName) | ![Conditionally required](/user/pages/reuse/image-library/01.icons/conditionally-required/conditionally-required.svg?decoding=auto\&fetchpriority=auto) | **Use case**: required for Visa and JCB transactions. The cardholder's name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
   | [channel](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-channel)                                               | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto)                                           | The platform where the transaction takes place. Set to **iOS**.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
   | [returnUrl](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-returnUrl)                                           | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto)                                           | The URL where the shopper will be redirected back to after completing 3D Secure authentication. Use the custom URL for your app, for example, `my-app://`. For more information on setting custom URL schemes, refer to the [Apple Developer documentation](https://developer.apple.com/documentation/uikit/inter-process_communication/allowing_apps_and_websites_to_link_to_your_content/defining_a_custom_url_scheme_for_your_app). **Format**:- Maximum characters: 1024.
   - Must not include `//` (double slash) after the top-level domain.   |
   | [browserInfo](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-browserInfo)                                       | ![Required](/user/pages/reuse/image-library/01.icons/required/required.svg?decoding=auto\&fetchpriority=auto)                                           | The shopper's browser information. The following sub-fields are required:- [acceptHeader](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-browserInfo-acceptHeader): The accept header value of the shopper's browser. You can use a dummy value.
   - [userAgent](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-browserInfo-userAgent): Get it using [`BrowserInfo.initialize` ](https://adyen.github.io/adyen-ios/5.3.0/documentation/adyen/browserinfo).                                     |
   | [shopperIP](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperIP)                                           | ![Conditionally required](/user/pages/reuse/image-library/01.icons/conditionally-required/conditionally-required.svg?decoding=auto\&fetchpriority=auto) | **Use case**: required for Visa and JCB transactions. The shopper's IP address.                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
   | [shopperEmail](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-shopperEmail)                                     | ![Conditionally required](/user/pages/reuse/image-library/01.icons/conditionally-required/conditionally-required.svg?decoding=auto\&fetchpriority=auto) | **Use case**: required for Visa and JCB transactions. The cardholder's email address. If you do not include the shopper email, you must include the shopper's phone number in your request.                                                                                                                                                                                                                                                                                                                                                        |
   | [telephoneNumber](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#request-telephoneNumber)                               | ![Conditionally required](/user/pages/reuse/image-library/01.icons/conditionally-required/conditionally-required.svg?decoding=auto\&fetchpriority=auto) | **Use case**: required for Visa and JCB transactions if you did not include the `shopperEmail` field. The shopper's phone number. To be more specific, you can use the `mobilePhone`, `homePhone`, and `workPhone` fields in the `threeDS2RequestData` object. **Format**: The phone number must include a plus sign (+) and a country code (1-3 digits), followed by the number (4-15 digits). **Example**: **+4912345678901**If the value you provide does not follow the guidelines, we drop the value and do not submit it for authentication. |

   ![This is the required icon.](/user/pages/reuse/image-library/01.icons/requirements-legend/required.svg?decoding=auto\&fetchpriority=auto) Required for all transactions.\
   ![This is the conditionally required icon.](/user/pages/reuse/image-library/01.icons/requirements-legend/conditionally-required.svg?decoding=auto\&fetchpriority=auto) Required for particular setups, or issuers and card schemes.\
   ![This is the recommended icon.](/user/pages/reuse/image-library/01.icons/requirements-legend/recommended.svg?decoding=auto\&fetchpriority=auto) Recommended for all transactions, but not required.

   #### curl

   ```bash
   curl https://checkout-test.adyen.com/v72/payments \
   -H 'x-api-key: ADYEN_API_KEY' \
   -H 'content-type: application/json' \
   -d '{
      "amount":{
         "currency":"EUR",
         "value":1000
      },
      "reference":"YOUR_ORDER_NUMBER",
      "shopperReference":"YOUR_UNIQUE_SHOPPER_ID",
      "{hint:state.data.paymentMethod from didSubmit}paymentMethod{/hint}":{
         "type":"scheme",
         "encryptedCardNumber":"adyenjs_0_1_18$k7s65M5V0KdPxTErhBIPoMPI8HlC..",
         "encryptedExpiryMonth":"adyenjs_0_1_18$p2OZxW2XmwAA8C1Avxm3G9UB6e4..",
         "encryptedExpiryYear":"adyenjs_0_1_18$CkCOLYZsdqpxGjrALWHj3QoGHqe+..",
         "encryptedSecurityCode":"adyenjs_0_1_24$XUyMJyHebrra/TpSda9fha978+..",
         "holderName":"S. Hopper"
      },
      "{hint:state.data.billingAddress from onSubmit}billingAddress{/hint}": {
         "street": "Infinite Loop",
         "houseNumberOrName": "1",
         "postalCode": "1011DJ",
         "city": "Amsterdam",
         "country": "NL"
      },
      "browserInfo": {
         "userAgent":"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A5370a Safari/604.1",
         "acceptHeader":"text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8"
      },
      "shopperEmail":"s.hopper@example.com",
      "channel":"iOS",
      "returnUrl":"my-app://adyen",
      "merchantAccount":"YOUR_MERCHANT_ACCOUNT"
   }'
   ```

   #### Java

   ```java
   // Adyen Java API Library v27.0.0
   import com.adyen.Client;
   import com.adyen.enums.Environment;
   import com.adyen.model.checkout.*;
   import java.time.OffsetDateTime;
   import java.util.*;
   import com.adyen.model.RequestOptions;
   import com.adyen.service.checkout.*;

   // For the live environment, additionally include your liveEndpointUrlPrefix.
   Client client = new Client("ADYEN_API_KEY", Environment.TEST);

   // Create the request object(s)
   Amount amount = new Amount()
     .currency("EUR")
     .value(1000L);

   CardDetails cardDetails = new CardDetails()
     .encryptedCardNumber("adyenjs_0_1_18$k7s65M5V0KdPxTErhBIPoMPI8HlC..")
     .holderName("S. Hopper")
     .encryptedSecurityCode("adyenjs_0_1_24$XUyMJyHebrra/TpSda9fha978+..")
     .encryptedExpiryYear("adyenjs_0_1_18$CkCOLYZsdqpxGjrALWHj3QoGHqe+..")
     .encryptedExpiryMonth("adyenjs_0_1_18$p2OZxW2XmwAA8C1Avxm3G9UB6e4..")
     .type(CardDetails.TypeEnum.SCHEME);

   BillingAddress billingAddress = new BillingAddress()
     .country("NL")
     .city("Amsterdam")
     .street("Infinite Loop")
     .houseNumberOrName("1")
     .postalCode("1011DJ");

   BrowserInfo browserInfo = new BrowserInfo()
     .acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8")
     .userAgent("Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A5370a Safari/604.1");

   PaymentRequest paymentRequest = new PaymentRequest()
     .reference("YOUR_ORDER_NUMBER")
     .amount(amount)
     .merchantAccount("YOUR_MERCHANT_ACCOUNT")
     .channel(PaymentRequest.ChannelEnum.)
     .paymentMethod(new CheckoutPaymentMethod(cardDetails))
     .shopperEmail("s.hopper@example.com")
     .billingAddress(billingAddress)
     .returnUrl("my-app://adyen")
     .browserInfo(browserInfo)
     .shopperReference("YOUR_UNIQUE_SHOPPER_ID");

   // Send the request
   PaymentsApi service = new PaymentsApi(client);
   PaymentResponse response = service.payments(paymentRequest, new RequestOptions().idempotencyKey("UUID"));
   ```

   #### PHP

   ```php
   // Adyen PHP API Library v19.0.0
   use Adyen\Client;
   use Adyen\Environment;
   use Adyen\Model\Checkout\Amount;
   use Adyen\Model\Checkout\CheckoutPaymentMethod;
   use Adyen\Model\Checkout\BillingAddress;
   use Adyen\Model\Checkout\BrowserInfo;
   use Adyen\Model\Checkout\PaymentRequest;
   use Adyen\Service\Checkout\PaymentsApi;

   $client = new Client();
   $client->setXApiKey("ADYEN_API_KEY");
   // For the live environment, additionally include your liveEndpointUrlPrefix.
   $client->setEnvironment(Environment::TEST);


   // Create the request object(s)
   $amount = new Amount();
   $amount
     ->setCurrency("EUR")
     ->setValue(1000);

   $checkoutPaymentMethod = new CheckoutPaymentMethod();
   $checkoutPaymentMethod
     ->setEncryptedCardNumber("adyenjs_0_1_18\$k7s65M5V0KdPxTErhBIPoMPI8HlC..")
     ->setHolderName("S. Hopper")
     ->setEncryptedSecurityCode("adyenjs_0_1_24\$XUyMJyHebrra/TpSda9fha978+..")
     ->setEncryptedExpiryYear("adyenjs_0_1_18\$CkCOLYZsdqpxGjrALWHj3QoGHqe+..")
     ->setEncryptedExpiryMonth("adyenjs_0_1_18\$p2OZxW2XmwAA8C1Avxm3G9UB6e4..")
     ->setType("scheme");

   $billingAddress = new BillingAddress();
   $billingAddress
     ->setCountry("NL")
     ->setCity("Amsterdam")
     ->setStreet("Infinite Loop")
     ->setHouseNumberOrName("1")
     ->setPostalCode("1011DJ");

   $browserInfo = new BrowserInfo();
   $browserInfo
     ->setAcceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8")
     ->setUserAgent("Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A5370a Safari/604.1");

   $paymentRequest = new PaymentRequest();
   $paymentRequest
     ->setReference("YOUR_ORDER_NUMBER")
     ->setAmount($amount)
     ->setMerchantAccount("YOUR_MERCHANT_ACCOUNT")
     ->setChannel("iOS")
     ->setPaymentMethod($checkoutPaymentMethod)
     ->setShopperEmail("s.hopper@example.com")
     ->setBillingAddress($billingAddress)
     ->setReturnUrl("my-app://adyen")
     ->setBrowserInfo($browserInfo)
     ->setShopperReference("YOUR_UNIQUE_SHOPPER_ID");

   $requestOptions['idempotencyKey'] = 'UUID';

   // Send the request
   $service = new PaymentsApi($client);
   $response = $service->payments($paymentRequest, $requestOptions);
   ```

   #### C\#

   ```cs
   // Adyen .net API Library v17.0.0
   using Adyen;
   using Environment = Adyen.Model.Environment;
   using Adyen.Model;
   using Adyen.Model.Checkout;
   using Adyen.Service.Checkout;

   // For the live environment, additionally include your liveEndpointUrlPrefix.
   var config = new Config()
   {
       XApiKey = "ADYEN_API_KEY",
       Environment = Environment.Test
   };
   var client = new Client(config);

   // Create the request object(s)
   Amount amount = new Amount
   {
     Currency = "EUR",
     Value = 1000
   };

   CardDetails cardDetails = new CardDetails
   {
     EncryptedCardNumber = "adyenjs_0_1_18$k7s65M5V0KdPxTErhBIPoMPI8HlC..",
     HolderName = "S. Hopper",
     EncryptedSecurityCode = "adyenjs_0_1_24$XUyMJyHebrra/TpSda9fha978+..",
     EncryptedExpiryYear = "adyenjs_0_1_18$CkCOLYZsdqpxGjrALWHj3QoGHqe+..",
     EncryptedExpiryMonth = "adyenjs_0_1_18$p2OZxW2XmwAA8C1Avxm3G9UB6e4..",
     Type = CardDetails.TypeEnum.Scheme
   };

   BillingAddress billingAddress = new BillingAddress
   {
     Country = "NL",
     City = "Amsterdam",
     Street = "Infinite Loop",
     HouseNumberOrName = "1",
     PostalCode = "1011DJ"
   };

   BrowserInfo browserInfo = new BrowserInfo
   {
     AcceptHeader = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
     UserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A5370a Safari/604.1"
   };

   PaymentRequest paymentRequest = new PaymentRequest
   {
     Reference = "YOUR_ORDER_NUMBER",
     Amount = amount,
     MerchantAccount = "YOUR_MERCHANT_ACCOUNT",
     Channel = PaymentRequest.ChannelEnum.iOS,
     PaymentMethod = new CheckoutPaymentMethod(cardDetails),
     ShopperEmail = "s.hopper@example.com",
     BillingAddress = billingAddress,
     ReturnUrl = "my-app://adyen",
     BrowserInfo = browserInfo,
     ShopperReference = "YOUR_UNIQUE_SHOPPER_ID"
   };

   // Send the request
   var service = new PaymentsService(client);
   var response = service.Payments(paymentRequest, requestOptions: new RequestOptions { IdempotencyKey = "UUID"});
   ```

   #### NodeJS (JavaScript)

   ```js
   // Adyen Node API Library v18.0.0
   // Require the parts of the module you want to use
   const { Client, CheckoutAPI } = require('@adyen/api-library');
   // Initialize the client object
   // For the live environment, additionally include your liveEndpointUrlPrefix.
   const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});

   // Create the request object(s)
   const paymentRequest = {
     amount: {
       currency: "EUR",
       value: 1000
     },
     reference: "YOUR_ORDER_NUMBER",
     shopperReference: "YOUR_UNIQUE_SHOPPER_ID",
     paymentMethod: {
       type: "scheme",
       encryptedCardNumber: "adyenjs_0_1_18$k7s65M5V0KdPxTErhBIPoMPI8HlC..",
       encryptedExpiryMonth: "adyenjs_0_1_18$p2OZxW2XmwAA8C1Avxm3G9UB6e4..",
       encryptedExpiryYear: "adyenjs_0_1_18$CkCOLYZsdqpxGjrALWHj3QoGHqe+..",
       encryptedSecurityCode: "adyenjs_0_1_24$XUyMJyHebrra/TpSda9fha978+..",
       holderName: "S. Hopper"
     },
     billingAddress: {
       street: "Infinite Loop",
       houseNumberOrName: "1",
       postalCode: "1011DJ",
       city: "Amsterdam",
       country: "NL"
     },
     browserInfo: {
       userAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A5370a Safari/604.1",
       acceptHeader: "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
     },
     shopperEmail: "s.hopper@example.com",
     channel: "iOS",
     returnUrl: "my-app://adyen",
     merchantAccount: "YOUR_MERCHANT_ACCOUNT"
   }

   // Send the request
   const checkoutAPI = new CheckoutAPI(client);
   const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" });
   ```

   #### Go

   ```go
   // Adyen Go API Library v10.4.0
   import (
     "context"
     "github.com/adyen/adyen-go-api-library/v9/src/common"
     "github.com/adyen/adyen-go-api-library/v9/src/adyen"
     "github.com/adyen/adyen-go-api-library/v9/src/checkout"
   )
   // For the live environment, additionally include your liveEndpointUrlPrefix.
   client := adyen.NewClient(&common.Config{
     ApiKey:      "ADYEN_API_KEY",
     Environment: common.TestEnv,
   })

   // Create the request object(s)
   amount := checkout.Amount{
     Currency: "EUR",
     Value: 1000,
   }

   cardDetails := checkout.CardDetails{
     EncryptedCardNumber: common.PtrString("adyenjs_0_1_18$k7s65M5V0KdPxTErhBIPoMPI8HlC.."),
     HolderName: common.PtrString("S. Hopper"),
     EncryptedSecurityCode: common.PtrString("adyenjs_0_1_24$XUyMJyHebrra/TpSda9fha978+.."),
     EncryptedExpiryYear: common.PtrString("adyenjs_0_1_18$CkCOLYZsdqpxGjrALWHj3QoGHqe+.."),
     EncryptedExpiryMonth: common.PtrString("adyenjs_0_1_18$p2OZxW2XmwAA8C1Avxm3G9UB6e4.."),
     Type: common.PtrString("scheme"),
   }

   billingAddress := checkout.BillingAddress{
     Country: "NL",
     City: "Amsterdam",
     Street: "Infinite Loop",
     HouseNumberOrName: "1",
     PostalCode: "1011DJ",
   }

   browserInfo := checkout.BrowserInfo{
     AcceptHeader: "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
     UserAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A5370a Safari/604.1",
   }

   paymentRequest := checkout.PaymentRequest{
     Reference: "YOUR_ORDER_NUMBER",
     Amount: amount,
     MerchantAccount: "YOUR_MERCHANT_ACCOUNT",
     Channel: common.PtrString("iOS"),
     PaymentMethod: checkout.CardDetailsAsCheckoutPaymentMethod(&cardDetails),
     ShopperEmail: common.PtrString("s.hopper@example.com"),
     BillingAddress: &billingAddress,
     ReturnUrl: "my-app://adyen",
     BrowserInfo: &browserInfo,
     ShopperReference: common.PtrString("YOUR_UNIQUE_SHOPPER_ID"),
   }

   // Send the request
   service := client.Checkout()
   req := service.PaymentsApi.PaymentsInput().IdempotencyKey("UUID").PaymentRequest(paymentRequest)
   res, httpRes, err := service.PaymentsApi.Payments(context.Background(), req)
   ```

   #### Python

   ```py
   # Adyen Python API Library v12.5.1
   import Adyen

   adyen = Adyen.Adyen()
   adyen.client.xapikey = "ADYEN_API_KEY"
   # For the live environment, additionally include your liveEndpointUrlPrefix.
   adyen.client.platform = "test" # The environment to use library in.

   # Create the request object(s)
   json_request = {
     "amount": {
       "currency": "EUR",
       "value": 1000
     },
     "reference": "YOUR_ORDER_NUMBER",
     "shopperReference": "YOUR_UNIQUE_SHOPPER_ID",
     "paymentMethod": {
       "type": "scheme",
       "encryptedCardNumber": "adyenjs_0_1_18$k7s65M5V0KdPxTErhBIPoMPI8HlC..",
       "encryptedExpiryMonth": "adyenjs_0_1_18$p2OZxW2XmwAA8C1Avxm3G9UB6e4..",
       "encryptedExpiryYear": "adyenjs_0_1_18$CkCOLYZsdqpxGjrALWHj3QoGHqe+..",
       "encryptedSecurityCode": "adyenjs_0_1_24$XUyMJyHebrra/TpSda9fha978+..",
       "holderName": "S. Hopper"
     },
     "billingAddress": {
       "street": "Infinite Loop",
       "houseNumberOrName": "1",
       "postalCode": "1011DJ",
       "city": "Amsterdam",
       "country": "NL"
     },
     "browserInfo": {
       "userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A5370a Safari/604.1",
       "acceptHeader": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
     },
     "shopperEmail": "s.hopper@example.com",
     "channel": "iOS",
     "returnUrl": "my-app://adyen",
     "merchantAccount": "YOUR_MERCHANT_ACCOUNT"
   }

   # Send the request
   result = adyen.checkout.payments_api.payments(request=json_request, idempotency_key="UUID")
   ```

   #### Ruby

   ```rb
   # Adyen Ruby API Library v9.5.1
   require "adyen-ruby-api-library"

   adyen = Adyen::Client.new
   adyen.api_key = 'ADYEN_API_KEY'
   # For the live environment, additionally include your liveEndpointUrlPrefix.
   adyen.env = :test # Set to "live" for live environment

   # Create the request object(s)
   request_body = {
     :amount => {
       :currency => 'EUR',
       :value => 1000
     },
     :reference => 'YOUR_ORDER_NUMBER',
     :shopperReference => 'YOUR_UNIQUE_SHOPPER_ID',
     :paymentMethod => {
       :type => 'scheme',
       :encryptedCardNumber => 'adyenjs_0_1_18$k7s65M5V0KdPxTErhBIPoMPI8HlC..',
       :encryptedExpiryMonth => 'adyenjs_0_1_18$p2OZxW2XmwAA8C1Avxm3G9UB6e4..',
       :encryptedExpiryYear => 'adyenjs_0_1_18$CkCOLYZsdqpxGjrALWHj3QoGHqe+..',
       :encryptedSecurityCode => 'adyenjs_0_1_24$XUyMJyHebrra/TpSda9fha978+..',
       :holderName => 'S. Hopper'
     },
     :billingAddress => {
       :street => 'Infinite Loop',
       :houseNumberOrName => '1',
       :postalCode => '1011DJ',
       :city => 'Amsterdam',
       :country => 'NL'
     },
     :browserInfo => {
       :userAgent => 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A5370a Safari/604.1',
       :acceptHeader => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8'
     },
     :shopperEmail => 's.hopper@example.com',
     :channel => 'iOS',
     :returnUrl => 'my-app://adyen',
     :merchantAccount => 'YOUR_MERCHANT_ACCOUNT'
   }

   # Send the request
   result = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' => 'UUID' })
   ```

   #### NodeJS (TypeScript)

   ```ts
   // Adyen Node API Library v18.0.0
   // Require the parts of the module you want to use
   import { Client, CheckoutAPI, Types } from "@adyen/api-library";
   // Initialize the client object
   // For the live environment, additionally include your liveEndpointUrlPrefix.
   const client = new Client({apiKey: "ADYEN_API_KEY", environment: "TEST"});

   // Create the request object(s)
   const amount: Types.checkout.Amount = {
     currency: "EUR",
     value: 1000
   };

   const cardDetails: Types.checkout.CardDetails = {
     encryptedCardNumber: "adyenjs_0_1_18$k7s65M5V0KdPxTErhBIPoMPI8HlC..",
     holderName: "S. Hopper",
     encryptedSecurityCode: "adyenjs_0_1_24$XUyMJyHebrra/TpSda9fha978+..",
     encryptedExpiryYear: "adyenjs_0_1_18$CkCOLYZsdqpxGjrALWHj3QoGHqe+..",
     encryptedExpiryMonth: "adyenjs_0_1_18$p2OZxW2XmwAA8C1Avxm3G9UB6e4..",
     type: Types.checkout.CardDetails.TypeEnum.Scheme
   };

   const billingAddress: Types.checkout.BillingAddress = {
     country: "NL",
     city: "Amsterdam",
     street: "Infinite Loop",
     houseNumberOrName: "1",
     postalCode: "1011DJ"
   };

   const browserInfo: Types.checkout.BrowserInfo = {
     acceptHeader: "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
     userAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A5370a Safari/604.1"
   };

   const paymentRequest: Types.checkout.PaymentRequest = {
     reference: "YOUR_ORDER_NUMBER",
     amount: amount,
     merchantAccount: "YOUR_MERCHANT_ACCOUNT",
     channel: Types.checkout.PaymentRequest.ChannelEnum.iOS,
     paymentMethod: cardDetails,
     shopperEmail: "s.hopper@example.com",
     billingAddress: billingAddress,
     returnUrl: "my-app://adyen",
     browserInfo: browserInfo,
     shopperReference: "YOUR_UNIQUE_SHOPPER_ID"
   };

   // Send the request
   const checkoutAPI = new CheckoutAPI(client);
   const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" });
   ```

2. In the response, check if there is an `action` object. Your next steps depend on whether the response contains an `action` object, and on the `action.type`.

   |                                     | Description                                                                       | Next steps                                                                                                                    |
   | ----------------------------------- | --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
   | No `action` object                  | The transaction was either exempted or out-of-scope for 3D Secure authentication. | Use the `resultCode` to [present the payment result to your shopper](#present-the-payment-result).                            |
   | `action` object `type`:**redirect** | The payment qualifies for 3D Secure.                                              | 1. Pass the `action` object to your client app. 2. [Use the Redirect Component to handle the redirect](#handle-the-redirect). |

   A sample [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) response with `action.type`: **redirect**:

   **/payments response**

   ```json
   {
      "resultCode":"RedirectShopper",
      "action":{
         "method":"GET",
         "paymentMethodType":"scheme",
         "type":"redirect",
         "url":"https://checkoutshopper-test.adyen.com/checkoutshopper/threeDS/redirect?MD=M2R..."
      },
      ...
   }
   ```

## Handle the redirect

Use the Redirect Component to redirect the shopper to complete the 3D Secure authentication.

1. Create and persist an instance of the Redirect Component.

   ```swift
   let component = RedirectComponent(apiContext: apiContext)
   component.delegate = delegate
   component.presentationDelegate = presentationDelegate
   self.redirectComponent = component
   ```

   Than use it to handle the action:

   ```swift
   let action = try JSONDecoder().decode(Action.self, from: actionData)
   redirectComponent.handle(action)
   ```

2. You then need to inform the Component when shopper returns to your app. To do this, implement the following in your `UIApplicationDelegate`:

   ```swift
   func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey: Any] = [:]) -> Bool {
   RedirectComponent.applicationDidOpen(from: url)
   return true
   }
   ```

   After the Redirect Component completes the action, it invokes the `didProvide` method.

3. From your server, make a POST [/payments/details](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/details) request providing the `data` from the `didProvide` method from your client app.

   On Checkout API v67 and later, the payment is authorized after the shopper completes authentication. You make a [/payments/details](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/details) request to get the payment result. On earlier versions, you need to complete the payment by making a [/payments/details](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/details) request containing payment data.

   #### curl

   ```bash
   curl https://checkout-test.adyen.com/v72/payments/details \
   -H 'x-api-key: ADYEN_API_KEY' \
   -H 'content-type: application/json' \
   -d '{hint:object passed from the front end or client app}STATE_DATA{/hint}'
   ```

   #### Java

   ```java
   // Set your X-API-KEY with the API key from the Customer Area.
   String xApiKey = "ADYEN_API_KEY";
   Client client = new Client(xApiKey,Environment.TEST);
   Checkout checkout = new Checkout(client);
   // STATE_DATA is an object passed from the front end or client app, deserialized from JSON to a data structure.
   PaymentsDetailsRequest paymentsDetailsRequest = STATE_DATA;
   PaymentsResponse paymentsDetailsResponse = checkout.paymentsDetails(paymentsDetailsRequest);
   ```

   #### PHP

   ```php
   // Set your X-API-KEY with the API key from the Customer Area.
   $client = new \Adyen\Client();
   $client->setEnvironment(\Adyen\Environment::TEST);
   $client->setXApiKey("ADYEN_API_KEY");
   $service = new \Adyen\Service\Checkout($client);

   // STATE_DATA is an object passed from the front end or client app, deserialized from JSON to a data structure.
   $params = STATE_DATA;
   $result = $service->paymentsDetails($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']
   }
   ```

   #### C\#

   ```cs
   // Set your X-API-KEY with the API key from the Customer Area.
   string apiKey = "ADYEN_API_KEY";
   var client = new Client (apiKey, Environment.Test);
   var checkout = new Checkout(client);
   // STATE_DATA is an object passed from the front end or client app, deserialized from JSON to a data structure.
   var paymentsDetailsRequest = STATE_DATA;
   var paymentsDetailsResponse = checkout.PaymentDetails(paymentsDetailsRequest);
   ```

   #### NodeJS (JavaScript)

   ```js
   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 = '[ADYEN_API_KEY]';
   const client = new Client({ config });
   client.setEnvironment("TEST");
   const checkout = new CheckoutAPI(client);
   // STATE_DATA is an object passed from the front end or client app, deserialized from JSON to a data structure.
   checkout.paymentsDetails(STATE_DATA).then(res => res);
   ```

   #### Python

   ```py
   # Set your X-API-KEY with the API key from the Customer Area.
   adyen = Adyen.Adyen()
   adyen.payment.client.platform = "test"
   adyen.client.xapikey = 'ADYEN_API_KEY'

   # STATE_DATA is an object passed from the front end or client app, deserialized from JSON to a data structure.
   request = STATE_DATA
   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']
   ```

   #### Ruby

   ```ruby
   require 'adyen-ruby-api-library'

   # Set your X-API-KEY with the API key from the Customer Area.
   adyen = Adyen::Client.new
   adyen.env = :test
   adyen.api_key = "ADYEN_API_KEY"

   # STATE_DATA is an object passed from the front end or client app, deserialized from JSON to a data structure.
   request = STATE_DATA
   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
   ```

   You receive a response containing:

   * `resultCode`: Use this to [present the result to your shopper](#present-the-payment-result).
   * `pspReference`: Our unique identifier for the transaction.

   **/payments/details response**

   ```json
   {
     "resultCode": "Authorised",
     "pspReference": "V4HZ4RBFJGXXGN82"
   }
   ```

For more information and detailed instructions, refer to [Using the Redirect Component](/online-payments/build-your-integration/sessions-flow/?platform=iOS\&integration=Components#handle-the-redirect).

## Present the payment result

Use the  [resultCode](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments#responses-200-resultCode) from the [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) or [/payments/details](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/details) response to present the payment result to your shopper. You will also receive the outcome of the payment asynchronously in a [webhook](/development-resources/webhooks).

For card payments, you can receive the following `resultCode` values:

| resultCode     | Description                                                                                                                                               | Action to take                                                                                                                                                                                         |
| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Authorised** | The payment was successful.                                                                                                                               | Inform the shopper that the payment has been successful. If you are using [manual capture](/online-payments/capture#manual-capture), you also need to [capture](/online-payments/capture) the payment. |
| **Cancelled**  | The shopper cancelled the payment.                                                                                                                        | Ask the shopper if they want to continue with the order, or ask them to select a different payment method.                                                                                             |
| **Error**      | There was an error when the payment was being processed. For more information, check the [`refusalReason` ](/development-resources/refusal-reasons)field. | Inform the shopper that there was an error processing their payment.                                                                                                                                   |
| **Refused**    | The payment was refused. For more information, check the [`refusalReason` ](/development-resources/refusal-reasons)field.                                 | Ask the shopper to try the payment again using a different payment method.                                                                                                                             |

## Test and go live

Use our test card numbers to [test how your integration handles different 3D Secure authentication scenarios](/development-resources/testing/3d-secure-2-authentication).

When you are ready to [go live](/get-started-with-adyen/#apply-for-your-live-account), follow our [go-live checklist](/online-payments/go-live-checklist/).

When using our [live endpoints](/development-resources/live-endpoints/), make sure that all API requests you make for the same payment session use the same live endpoint region. Using different regions for [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) and [/payments/details](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/details) requests may result in errors when authenticating with 3D Secure.

## See also

* [iOS Components integration guide](/online-payments/build-your-integration/sessions-flow?platform=iOS\&integration=Components)
* [3D Secure 2 API Reference](/online-payments/3d-secure/api-reference)
* [Webhooks](/development-resources/webhooks)
* [Payment methods](/payment-methods)
