--- title: "Redirect 3DS Drop-in integration" description: "Support cards with 3D Secure authentication through a redirect in your Android app." url: "https://docs.adyen.com/online-payments/3d-secure/redirect-3ds2/android-drop-in" source_url: "https://docs.adyen.com/online-payments/3d-secure/redirect-3ds2/android-drop-in.md" canonical: "https://docs.adyen.com/online-payments/3d-secure/redirect-3ds2/android-drop-in" last_modified: "2021-05-11T17:35:00+02:00" language: "en" --- # Redirect 3DS Drop-in integration Support cards with 3D Secure authentication through a redirect in your Android app. [View source](/online-payments/3d-secure/redirect-3ds2/android-drop-in.md) Our [Android Drop-in](/online-payments/build-your-integration/sessions-flow?platform=Android\&integration=Drop-in) renders the available cards in your payment form, and securely collects any sensitive card information, so it doesn't touch your server. Drop-in also redirects 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. [Configure Drop-in](#key) to collect the card holder name. 2. [Provide the required 3D Secure parameters](#make-a-payment) when making a payment request. 3. [Handle the redirect](#handle-the-redirect) after the shopper returns to your website. This page describes the integration steps for [Android Drop-in v4.0.0 or later](/online-payments/release-notes). ## Requirements This page explains how to add cards with redirect 3D Secure authentication to your existing Android Drop-in integration. The Android Drop-in integration works the same way for all payment methods. If you haven't done this integration yet, refer to our [Drop-in integration guide](/online-payments/build-your-integration/sessions-flow?platform=Android\&integration=Drop-in). Before you begin your integration: 1. Make sure that you have [set up your back end implementation](/online-payments/build-your-integration/sessions-flow?platform=Android\&integration=Drop-in), and [added Drop-in to your payment form](/online-payments/build-your-integration/sessions-flow/?platform=Android\&integration=Drop-in#set-up). 2. [Add the cards that you want to accept in your test Customer Area](/payment-methods/add-payment-methods). 3. 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 parameters in your payment form For higher authentication rates, we strongly recommend that you collect the shopper's billing address and email address in advance in your payment form. Deliver these parameters to your backend when [making a payment](#make-a-payment) as they are required by the card schemes. ## Show the available cards in your payment form For information about the supported countries/regions and currencies for each card, refer to [Payment methods](https://www.adyen.com/payment-methods). To show cards in your payment form: 1. Specify in your [/paymentMethods](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods) request a combination of [countryCode](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods) and [amount.currency](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods#request-amount). Drop-in uses this information to show the available cards to your shopper. 2. []()When [creating an instance of Drop-in](/online-payments/build-your-integration/sessions-flow/?platform=Android\&integration=Drop-in#launch-and-show), create a configuration object, and pass your [client key](/development-resources/client-side-authentication/#get-your-client-key). To make sure you collect the cardholder name, set `holderNameRequired` to **true**. ```kotlin val cardConfiguration = CardConfiguration.Builder(context, "YOUR_CLIENT_KEY") // Makes the cardholder name required .setHolderNameRequired(true) // When you are ready to accept live payments, change the value to one of our live environments. .setEnvironment(Environment.TEST) .build() val dropInConfiguration = DropInConfiguration.Builder(context, YourDropInService::class.java, "YOUR_CLIENT_KEY") // When you are ready to accept live payments, change the value to one of our live environments. .setEnvironment(Environment.TEST) .addCardConfiguration(cardConfiguration) .build() ``` ## Make a payment When the shopper proceeds to pay, Drop-in returns the `paymentComponentData.paymentMethod`. 1. Pass the `paymentComponentData.paymentMethod` object to your server. 2. When you [make a payment request](/online-payments/build-your-integration/advanced-flow?platform=Android\&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. The `paymentComponentData.paymentMethod` object from your client app. | | [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 **Android**. | | [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. Get this URL from Drop-in in the `RedirectComponent.getReturnUrl(context)`. **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 [`WebSettings.getDefaultUserAgent(Context);` ](https://developer.android.com/reference/android/webkit/WebSettings#getDefaultUserAgent\(android.content.Context\)). | | [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 (Linux; Android 6.0.1; Nexus 6P Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36", "acceptHeader":"text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8" }, "shopperEmail":"s.hopper@example.com", "channel":"Android", "returnUrl":"adyencheckout://your.package.name", "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 (Linux; Android 6.0.1; Nexus 6P Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36"); 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("adyencheckout://your.package.name") .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 (Linux; Android 6.0.1; Nexus 6P Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36"); $paymentRequest = new PaymentRequest(); $paymentRequest ->setReference("YOUR_ORDER_NUMBER") ->setAmount($amount) ->setMerchantAccount("YOUR_MERCHANT_ACCOUNT") ->setChannel("Android") ->setPaymentMethod($checkoutPaymentMethod) ->setShopperEmail("s.hopper@example.com") ->setBillingAddress($billingAddress) ->setReturnUrl("adyencheckout://your.package.name") ->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 (Linux; Android 6.0.1; Nexus 6P Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36" }; PaymentRequest paymentRequest = new PaymentRequest { Reference = "YOUR_ORDER_NUMBER", Amount = amount, MerchantAccount = "YOUR_MERCHANT_ACCOUNT", Channel = PaymentRequest.ChannelEnum.Android, PaymentMethod = new CheckoutPaymentMethod(cardDetails), ShopperEmail = "s.hopper@example.com", BillingAddress = billingAddress, ReturnUrl = "adyencheckout://your.package.name", 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 (Linux; Android 6.0.1; Nexus 6P Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36", acceptHeader: "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" }, shopperEmail: "s.hopper@example.com", channel: "Android", returnUrl: "adyencheckout://your.package.name", 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 (Linux; Android 6.0.1; Nexus 6P Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36", } paymentRequest := checkout.PaymentRequest{ Reference: "YOUR_ORDER_NUMBER", Amount: amount, MerchantAccount: "YOUR_MERCHANT_ACCOUNT", Channel: common.PtrString("Android"), PaymentMethod: checkout.CardDetailsAsCheckoutPaymentMethod(&cardDetails), ShopperEmail: common.PtrString("s.hopper@example.com"), BillingAddress: &billingAddress, ReturnUrl: "adyencheckout://your.package.name", 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 (Linux; Android 6.0.1; Nexus 6P Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36", "acceptHeader": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" }, "shopperEmail": "s.hopper@example.com", "channel": "Android", "returnUrl": "adyencheckout://your.package.name", "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 (Linux; Android 6.0.1; Nexus 6P Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36', :acceptHeader => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' }, :shopperEmail => 's.hopper@example.com', :channel => 'Android', :returnUrl => 'adyencheckout://your.package.name', :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 (Linux; Android 6.0.1; Nexus 6P Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.83 Mobile Safari/537.36" }; const paymentRequest: Types.checkout.PaymentRequest = { reference: "YOUR_ORDER_NUMBER", amount: amount, merchantAccount: "YOUR_MERCHANT_ACCOUNT", channel: Types.checkout.PaymentRequest.ChannelEnum.Android, paymentMethod: cardDetails, shopperEmail: "s.hopper@example.com", billingAddress: billingAddress, returnUrl: "adyencheckout://your.package.name", browserInfo: browserInfo, shopperReference: "YOUR_UNIQUE_SHOPPER_ID" }; // Send the request const checkoutAPI = new CheckoutAPI(client); const response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: "UUID" }); ``` 3. In the response, check if there is an `action` object. ### Tab: Checkout API v67 and later 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 2 authentication. | 1. Return `DropInServiceResult.Finished`, and the `resultCode` from the `/payments` response. 2. 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. Return `DropInServiceResult.Action`, and the `action` object. 2. [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": { "paymentMethodType": "scheme", "url": "https://checkoutshopper-test.adyen.com/checkoutshopper/threeDS/redirect?MD=M2R...", "method": "GET", "type": "redirect" } } ``` ### Tab: Checkout API v66 and earlier 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 2 authentication. | 1. Return `DropInServiceResult.Finished`, and the `resultCode` from the `/payments` response. 2. 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. Store the `action.paymentData` on your server. 2. Return `DropInServiceResult.Action`, and the `action` object. 3. [Handle the redirect](#handle-the-redirect). | A sample [/payments](https://docs.adyen.com/api-explorer/Checkout/66/post/payments) response with `action.type`: **redirect**: **/payments response** ```json { "resultCode":"RedirectShopper", "action":{ "method":"GET", "paymentData":"Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...", "paymentMethodType":"scheme", "type":"redirect", "url":"https://checkoutshopper-test.adyen.com/checkoutshopper/threeDS/redirect?MD=M2R..." }, "details":[ { "key":"MD", "type":"text" }, { "key":"PaRes", "type":"text" } ], ... } ``` ## Handle the redirect Drop-in redirects the shopper to perform the 3D Secure authentication. When the shopper returns back to your app, Drop-in provides the `actionComponentData` object. 1. Pass the `actionComponentData.details` to your server. 2. From your server, make a POST [/payments/details](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/details) request specifying: * `details`: This is the `actionComponentData.details` from the Component. * `paymentData`: Required if using Checkout API version 66 or earlier: the value from the last API response that you stored locally in the client-side 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. * `pspReference`: Our unique identifier for the transaction. **/payments/details response** ```json { "resultCode": "Authorised", "pspReference": "V4HZ4RBFJGXXGN82" } ``` For more information and detailed instructions, refer to our [Android Drop-in integration guide](/online-payments/build-your-integration/advanced-flow/?platform=Android\&integration=Drop-in#send-additional-payment-details). ## 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 * [Android Drop-in integration guide](/online-payments/build-your-integration/sessions-flow/?platform=Android\&integration=Drop-in) * [3D Secure 2 API Reference](/online-payments/3d-secure/api-reference) * [Webhooks](/development-resources/webhooks) * [Payment methods](/payment-methods)