Search

Are you looking for test card numbers?

Would you like to contact support?

Online-payment icon

Android Components integration guide

Build your checkout form with our Android Components.

Components are building blocks that you can use to render UI for individual payment methods: from collecting payment details to handling additional shopper interaction.

We recommend that you integrate Components if you want some degree of customization and flexibility on your payments form.

Supported payment methods

Components are available for cards, wallets, and most local payment methods. For a list of all payment methods with an available component, refer to Supported payment methods.

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

How it works

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 to complete the payment.
  5. From your server, submit additional payment details.
  6. Present the payment result to the shopper.

Whenever you want to offer a new payment method, you need to add the specific Component on your checkout page. The steps for integrating are similar regardless of the payment method, but some require additional configuration. For more information, refer to our payment method integration guides.

Before you begin

If you haven't done so already, follow our Get started guide to set up your test account, get your API key, and install a server-side library.

Install the Adyen Android client-side library

Our Android Components are available through jcenter. You only need to add the build dependency for the specific Android Component on Gradle. To know the specific Component name, refer to the payment method pages.

For example, to use the Card Component and the Redirect Component, add the following to your build.gradle (Module) file. To get the latest version, check our GitHub repository.

implementation "com.adyen.checkout:card-ui:<latest-version>"
implementation "com.adyen.checkout:redirect:<latest-version>"

Get your client encryption public key

For accepting card payments, you'll need a client encryption public key. To get your Client Encryption Public Key:

  1. Sign in to your Customer Area using your company-level account.
  2. Navigate to Account > Users.
  3. Click on your web service user (ws@Company.[YourCompanyAccount]) in the users list.
    This opens the Edit Web Service User page.
  4. In the Client-Side Encryption panel, copy the Client Encryption Public Key.

Step 1: Get available payment methods

When your shopper is ready to pay, get a list of the available payment methods based on their country, device, and the payment amount.

  1. From your server, make a POST /paymentMethods request, providing the following parameters. While most parameters are optional, we recommend that you include them because Adyen uses these to tailor the list of payment methods for your shopper.

    We use the optional parameters to tailor the list of available payment methods to your shopper.

    Parameter name Required Description
    merchantAccount -white_check_mark- Your merchant account name.
    amount The currency and value of the payment (in minor units). For more information, see Currency codes.
    channel The platform where the payment is taking place. Use Android. Adyen returns only the payment methods available for Android.
    countryCode The shopper's country code. Adyen returns only the payment methods available in this country.
    shopperLocale By default, the shopperlocale is set to en-US. To change the language, set this to the shopper's language and country code. You also need to set the same ShopperLocale within your Component configuration.
    curl https://checkout-test.adyen.com/v52/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": "Android",
      "shopperLocale": "nl-NL"
    }'
    # 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',
      :shopperLocale => 'nl_NL',
      :amount => {
        :currency => 'EUR',
        :value => 1000
      },
      :channel => 'Android'
    })
    // 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");
    paymentMethodsRequest.setShopperLocale("nl-NL");
    Amount amount = new Amount();
    amount.setCurrency("EUR");
    amount.setValue(1000L);
    paymentMethodsRequest.setAmount(amount);
    paymentMethodsRequest.setChannel(PaymentMethodsRequest.ChannelEnum.Android);
    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",
      "shopperLocale" => "nl-NL",
      "amount" => array(
        "currency" => "EUR",
        "value" => 1000
      ),
      "channel" => "Android"
    );
    $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',
      'shopperLocale': 'nl-NL',
      'amount': {
        'value': 1000,
        'currency': 'EUR'
      },
      'channel': 'Android'
    })
    // 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",
       ShopperLocale = "nl-NL",
       Amount = amount,
       Channel = PaymentMethodsRequest.ChannelEnum.Android
    };
    
    var paymentMethodsResponse = checkout.PaymentMethods(paymentMethodsRequest).ToJson();
    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);
    const paymentsResponse = checkout.paymentMethods({
        amount: {
            currency: "EUR",
            value: 1000,
        },
        countryCode: "NL",
        shopperLocale: "nl-NL",
        channel: "Android",
        merchantAccount: config.merchantAccount
    }).then(res => res);
    import (
        "github.com/adyen/adyen-go-api-library/v2/src/checkout"
        "github.com/adyen/adyen-go-api-library/v2/src/common"
        "github.com/adyen/adyen-go-api-library/v2/src/adyen"
    )
    
    // Set your X-API-KEY with the API key from the Customer Area.
    client := adyen.NewClient(&common.Config{
        ApiKey:      "[API_KEY]",
        Environment: common.TestEnv,
    })
    
    res, httpRes, err := client.Checkout.PaymentMethods(&checkout.PaymentMethodsRequest{
        Amount: checkout.Amount{
            Value:    1000,
            Currency: "EUR",
        },
        CountryCode: "NL",
        ShopperLocale: "nl-NL",
        Channel: "Android",
        MerchantAccount: "[MERCHANT_ACCOUNT]",
    })

    The response includes the list of available paymentMethods:

    /paymentMethods response
    {
     "paymentMethods":[
      {
        "details":[...],
        "name":"Credit Card",
        "type":"scheme"
        ...
      },
      {
        "details":[...],
        "name":"SEPA Direct Debit",
        "type":"sepadirectdebit"
      },
      ...
      ]
    }
  2. Pass the response to your client app. You will use this in the next step to present which payment methods are available to the shopper.

Step 2: Add Components to your payment form

Next, use the Component to collect payment details from your shopper.

  1. Deserialize the /paymentMethods response with the SERIALIZER object.

    val paymentMethodsApiResponse = PaymentMethodsApiResponse.SERIALIZER.deserialize(paymentMethodsResponse)
  2. From the result, get the object containing the payment method type for the Component. For example, to initialize the Card Component, get the object containing paymentMethods.type scheme.

  3. Initialize the Component. To do this, you need the deserialized payment method object, and any other configuration for the specific payment method.

    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.
    Name Required Description
    Environment -white_check_mark- Use TEST. When you're ready to accept live payments, change the value to one of our live environments
    ShopperLocale By default, the Component is rendered in the language set for the device. To change the language, set the shopper locale to the required language code. You also need to set the shopper locale in step 1 where you make the /paymentMethods call.
    Other configuration Include required or optional configuration for the specific payment method. For example, for Cards, you need to provide your public key so that the Component can encrypt the shopper's card details.
    paymentMethod -white_check_mark- The payment method object. For Cards, this is the object containing paymentMethods.type scheme.
    val cardConfiguration =
          CardConfiguration.Builder(context, "<publicKey>")
          // When you're ready to accept live payments, change the value to one of our live environments.
          .setEnvironment(Environment.TEST)
          // Optional. Use to set the language rendered in Component, overriding the default device language setting. See list of Supported languages at https://github.com/Adyen/adyen-android/tree/master/card-ui-core/src/main/res
          .setShopperLocale(Locale("nl", "NL"))
          // Create the configuration for the payment method that you want to add.
          .build()
    
    // Replace CardComponent with the payment method Component that you want to add.
    // See list of Supported payment methods at https://docs.adyen.com/checkout/android/components#supported-payment-methods
    val cardComponent = CardComponent.PROVIDER.get(this@YourActivity, paymentMethod, cardConfiguration)
  4. Add the Component view to your layout.

    // Replace card with the Component view that you want to add.
    // See list of Supported payment methods at https://docs.adyen.com/checkout/supported-payment-methods
    <com.adyen.checkout.card.CardView
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"/>
  5. Attach the Component to the view to start getting your shopper's payment details.

    // Replace CardComponent with the payment method Component that you want to add.
    // See list of Supported payment methods at https://docs.adyen.com/checkout/supported-payment-methods
    cardView.attach(cardComponent, this@YourActivity)
  6. You start receiving updates when the shopper enters their payment details. Check if isValid is true, and if the shopper proceeds to pay, pass the paymentComponentState.data.paymentMethod to your server.

    // Replace CardComponent with the payment method Component that you want to add.
    // See list of Supported payment methods at https://docs.adyen.com/checkout/supported-payment-methods
    cardComponent.observe(this@MainActivity, Observer {
        if (it?.isValid == true) {
            // When the shopper proceeds to pay, pass the `it.data` to your server to send a /payments request
        }
    })

Step 3: Make a payment

After the shopper submits their payment details or chooses to pay with a payment method that requires a redirection, you need to make a payment request to Adyen.

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

    Parameter name Required Description
    merchantAccount -white_check_mark- Your merchant account name.
    amount -white_check_mark- The currency and value of the payment (in minor units). For more information, see Currency codes.
    reference -white_check_mark- Your unique reference for this payment.
    paymentMethod -white_check_mark- The data.paymentMethod from the didSubmit method from your client app.
    returnUrl -white_check_mark- The URL where the shopper is taken back to in case of a redirection. Get this URL from the Component in the RedirectComponent.getReturnUrl(context). This URL can have a maximum of 1024 characters.
    applicationInfo If you're building an Adyen solution for multiple merchants, include some basic identifying information, so that we can offer you better support. For more information, refer to Building Adyen solutions.

    Additional parameters are required for some payment methods, cards with native 3D Secure 2 authentication, and recurring payments. For more information, refer to our payment method integration guides.

    A sample request for a payment of 10 euros:

    curl https://checkout-test.adyen.com/v52/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:paymentComponentState.data.paymentMethod from app}paymentComponentState.data.paymentMethod{/hint},
      "returnUrl":"adyencheckout://your.package.name",
      "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 paymentComponentState.data.paymentMethod from 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("adyencheckout://your.package.name");
    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 paymentComponentState.data.paymentMethod from 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 paymentComponentState.data.paymentMethod from 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 paymentRequest = new Adyen.Model.Checkout.PaymentRequest
    {
      Reference = "YOUR_ORDER_NUMBER",
      Amount = amount,
      ReturnUrl = @"adyencheckout://your.package.name",
      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 paymentComponentState.data.paymentMethod from client app
        reference: "YOUR_ODRER_NUMBER",
        merchantAccount: config.merchantAccount,
        shopperReference: "shopperReference",
        returnUrl: "https://your-company.com/checkout?shopperOrder=12xy.."
    }).then(res => res);
    import (
        "github.com/adyen/adyen-go-api-library/v2/src/checkout"
        "github.com/adyen/adyen-go-api-library/v2/src/common"
        "github.com/adyen/adyen-go-api-library/v2/src/adyen"
    )
    
    // Set your X-API-KEY with the API key from the Customer Area.
    client := adyen.NewClient(&common.Config{
        ApiKey:      "[API_KEY]",
        Environment: common.TestEnv,
    })
    
    // Data object passed from paymentComponentState.data.paymentMethod from client app
    paymentMethod := COMPONENT_DATA_PAYMENTMETHOD
    
    res, httpRes, err := client.Checkout.Payments(&checkout.PaymentRequest{
        Amount: checkout.Amount{
            Value:    1000,
            Currency: "EUR",
        },
        MerchantAccount: "[MERCHANT_ACCOUNT]",
        PaymentMethod: paymentMethod,
        Reference: "YOUR_ORDER_NUMBER",
        ShopperReference: "shopperReference",
        ReturnUrl: "https://your-company.com/checkout?shopperOrder=12xy..",
    })

    Your next steps depend on whether the /payments response contains an action object:

    Description Next steps
    No action object No additional steps are needed to complete the payment. Use the resultCode to present the payment result to your shopper.
    With action object The shopper needs to do additional actions to complete the payment. 1. Store the action.paymentData in your server.
    2. Pass the action object to your client app. Make sure that you only pass the action object and not the full response.
    3. Proceed to step 4.

    The following example shows a /payments response with action.type: threeDS2Fingerprint:

    /payments response
    {
    "resultCode":"IdentifyShopper",
    "action":{
       "paymentData":"Ab02b4c0!BQABAgCuZFJrQOjSsl\/zt+...",
       "paymentMethodType":"scheme",
       "token":"eyJ0aHJlZURTTWV0aG9kTm90aWZpY...",
       "type":"threeDS2Fingerprint"
     },
     "authentication":{
       "threeds2.fingerprintToken":"eyJ0aHJlZURTTWV0aG9kTm90aWZpY..."
     },
     "details":[
       {
         "key":"threeds2.fingerprint",
         "type":"text"
       }
     ],
     ...
    }

Step 4: Perform additional client-side actions

Some payment methods require additional action from the shopper such as: to authenticate a payment with 3D Secure, or to switch to another app to complete the payment.

To handle these additional client app actions, use the action.type to determine which Action Component you should initialize.

action.type Next steps
redirect 1. Use the Redirect Component.
2. Proceed to step 5 to check the payment result or submit additional details.
threeDS2Fingerprint Use the 3D Secure 2 Component to perform 3D Secure 2 device fingerprinting.
threeDS2Challenge Use the 3D Secure 2 Component to present the 3D Secure 2 challenge to the shopper.
**SDK

**The type can sometimes include the payment method name. For example, wechatpaySDK.
Use the specific payment method action Component to trigger the app switch from your app to the payment method's app. For example, refer to WeChat Pay Component.

Redirect Component

If the Action type is redirect, initialize the Redirect Component.

  1. Add the following to your build.gradle file.

    implementation "com.adyen.checkout:redirect:<latest-version>"

    Check the latest version on GitHub.

  2. Initialize the Redirect Component.

       val redirectComponent = RedirectComponent.PROVIDER.get(this@YourActivity)
  3. Provide the action object from the /payments response.

    redirectComponent.handleAction(this@YourActivity, action)
  4. Add an IntentFilter to the Activity that will handle the returnUrl specified in your /payments request.

    <activity
        android:name=".YourActivity">
          <intent-filter>
             <action android:name="android.intent.action.VIEW"/>
             <category android:name="android.intent.category.DEFAULT"/>
             <category android:name="android.intent.category.BROWSABLE"/>
             <data android:host="${applicationId}" android:scheme="adyencheckout"/>
          </intent-filter>
     </activity>

    The ${applicationId} will be replaced with your.package.name at build time.

  5. Get the result of the redirect from the Activity. Pass the intent.data back to the Redirect Component.

    override fun onNewIntent(intent: Intent?) {
           super.onNewIntent(intent)
           val data = intent?.data
           if (data != null && data.toString().startsWith(RedirectUtil.REDIRECT_RESULT_SCHEME)) {
               redirectComponent.handleRedirectResponse(intent.data)
           }
       }
  6. The Component notifies the observer with the actionComponentData.details. Pass this to your server.

    redirectComponent.observe(this, Observer {
       // Send a /payments/details/ call containing the `actionComponentData.details`
    })

Step 5: Submit additional payment details

If the shopper performed additional action, you need to make another request to Adyen to either complete the payment, or to check the payment result.

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

  • details: This is the actionComponentData.details from the Component.
  • paymentData: The value from the last API response.

The following example shows a /payments/details request containing data returned by the 3D Secure 2 Component:

curl https://checkout-test.adyen.com/v52/payments/details \
-H "x-API-key: YOUR_X-API-KEY" \
-H "content-type: application/json" \
-d '{
  "{hint:data.details from didProvide}details{/hint}": {
    "threeds2.challengeResult":"eyJ0aHJlZURTQ29tcEluZCI6IlkifQ=="
  },
  "{hint:data.paymentData from didProvide}paymentData{/hint}":"Ab02b4c0!BQABAgAKspbjN8+5..."
}'
# 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
# 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 challengeResult = "eyJ0aHJlZURTQ29tcEluZCI6IlkifQ==";

Client client = new Client(apiKey,Environment.TEST);
Checkout checkout = new Checkout(client);
PaymentsDetailsRequest paymentsDetailsRequest = new PaymentsDetailsRequest();
paymentDetailsRequest.setChallengeResult();
PaymentsResponse paymentsResponse = checkout.paymentsDetails(paymentsDetailsRequest);
// 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;
// Data object passed from didProvide method from the client app, parsed from JSON to an array

$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']
}
#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
# 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 challengeResult = "eyJ0aHJlZURTQ29tcEluZCI6IlkifQ==";

var details = new Dictionary<string, string>
{
  { "threeds2.challengeResult": challengeResult }
};
var paymentsDetailsRequest = new Model.Checkout.PaymentsDetailsRequest(Details: details);
var paymentResponse = checkout.PaymentDetails(paymentsDetailsRequest);
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
    paymentData: COMPONENT_DATA_PAYMENT_DATA  // Data object passed from didProvide method from the client app
}).then(res => res);
import (
    "github.com/adyen/adyen-go-api-library/v2/src/checkout"
    "github.com/adyen/adyen-go-api-library/v2/src/common"
    "github.com/adyen/adyen-go-api-library/v2/src/adyen"
)

// Set your X-API-KEY with the API key from the Customer Area.
client := adyen.NewClient(&common.Config{
    ApiKey:      "[API_KEY]",
    Environment: common.TestEnv,
})

res, httpRes, err := client.Checkout.PaymentsDetails(&checkout.DetailsRequest{
    Details: COMPONENT_DATA_DETAILS,  // Data object passed from didProvide method from the client app
    PaymentData: COMPONENT_DATA_PAYMENT_DATA,  // Data object passed from didProvide method from the client app
})

Your next steps depend on whether the /payments/details response contains an action object:

Description Next steps
No action object No additional steps are needed to complete the payment. Proceed to step 6.
With action object The shopper needs to do additional actions to complete the payment. 1. Pass the action object to your client app.
2. Perform step 4 again.
Sample successful payment response
 {
   "pspReference": "88154795347618C",
   "resultCode": "Authorised"
 }
Sample refused response
 {
   "pspReference": "89783918347627F",
   "refusalReason": "Not enough balance",
   "resultCode": "Refused"
 }

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.

Error handling

In case you encounter errors in your integration, refer to the following:

  • API error codes: If you receive a non-HTTP 200 response, use the errorCode to troubleshoot and modify your request.
  • Payment refusals: If you receive an HTTP 200 response with an Error or Refused resultCode, check the refusal reason and, if possible, modify your request.

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. Apply for a live account.  
  2. Assess your PCI DSS compliance, and submit the Self-Assessment Questionnaire-A.
  3. Configure your live account.
  4. Switch from test to our live endpoints.
  5. Load the Component from one of our live environments closest to where your shoppers are. Set the Environment to:

    • Europe: EUROPE
    • Australia: AUSTRALIA
    • US: UNITED_STATES

See also

Next steps