Search

Are you looking for test card numbers?

Would you like to contact support?

Android Drop-in

Accept popular payment methods with a single client-side implementation.

See sample code

  Explore Drop-in for Android on GitHub.

Drop-in is our all-in-one UI solution that you can use on your checkout page so you can start accepting transactions for key payment methods using a single front-end implementation. To see a complete list of all payment methods supported in Drop-in, see Drop-in payment methods.

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

Drop-in is supported from v49 and later of the /paymentMethods, /payments, and /payments/details endpoints.

How Drop-in works

First you have to submit API requests from your server, then pass parts of the responses to your client app. Drop-in takes the responses as input, renders the UI for the corresponding shopper action, and provides the data that you will need to pass on your next API request.

The following general flow applies for each payment method supported in Drop-in:

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. Create an instance of Drop-in.
  3. From your server, submit a payment request with the data returned by Drop-in.
  4. If Drop-in performs additional actions on your app, submit the resulting additional payment details with the data returned by Drop-in.
  5. Present the payment result to the shopper.

When you have completed the integration, proceed to test your integration.

Before you begin

Before you start integrating with our online payments API and Drop-in for Android, make sure that you have performed the following steps:

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

Installing Drop-in for Android

Android Components are available through jcenter, you only need to add the Gradle dependency.

Import the Android Drop-in by adding it to your build.gradle file.

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

Check the latest version on GitHub.

Step 1: Get available payment methods

First, you need to get a list of payment methods available to your shopper:

  1. Make a POST /paymentMethods request, providing:

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

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

    curl https://checkout-test.adyen.com/v49/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"
    }'
    # Set your X-API-KEY with the API key from the Customer Area.
    adyen = Adyen::Client.new
    adyen.api_key = "YOUR_X-API-KEY"
    
    response = adyen.checkout.payment_methods({
      :merchantAccount => 'YOUR_MERCHANT_ACCOUNT',
      :countryCode => 'NL',
      :amount => {
        :currency => 'EUR',
        :value => 1000
      },
      :channel => '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");
    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",
      "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',
      '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",
       Amount = amount,
       Channel = "Android"
    };

    A list of available paymentMethods is returned in the response, including the required fields if there are any. If you want to know more about the properties returned in the response, see the response parameters in our API Explorer.

    {
     "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 specify which payment methods are available for the shopper.

Next, initialize Drop-in on your client app.

Step 2: Initialize Drop-in

To use Drop-in on your app, you need to:

  1. Provide the /paymentMethods response to the SERIALIZER object to deserialize the data.

    val paymentMethodsApiResponse = PaymentMethodsApiResponse.SERIALIZER.deserialize(paymentMethodsResponse)
  2. Extend the DropInService class and handle the process of passing data between your client app and your server to make a payment request and to submit additional payment details.

    class YourDropInService : DropInService() {
       // Handling for submitting a payment request
       override fun makePaymentsCall(paymentComponentData: JSONObject): CallResult {
           ...
           // Your server should make a /payments call containing the `paymentComponentData`
           // Create the `CallResult` based on the /payments response
           return CallResult(CallResult.ResultType.ACTION, "action JSON object")
       }
       // Handling for submitting additional payment details
       override fun makeDetailsCall(actionComponentData: JSONObject): CallResult {
           ...
           // Your server should make a /payments/details call containing the `actionComponentData`
           // Create the `CallResult` based on the /payments/details response
           return CallResult(CallResult.ResultType.FINISHED, "Success")
       }
    }

    Both makePaymentsCall and makeDetailsCall functions return the CallResult. Drop-in uses the CallResult to determine how to handle the payment flows.

    The CallResult class can contain any of the following ResultType values:

    • ACTION: Return this when you get an action object from the /payments or /payments/details API response along with the action JSON object.
    • FINISHED: Return this when you did not get an action object from the /payments or /payments/details response.
    • ERROR: Return this if an error happened during the connection.

    We'll discuss the API requests later in step 3 to make a payment and step 4 to submit additional payment details.

    Make sure to add the service to your manifest file.

    <service
       android:name=".YourDropInService"
       android:permission="android.permission.BIND_JOB_SERVICE"/>
  3. Check specific payment method pages to confirm if you need additional required configuration. For example, to enable the Card form, Drop-in needs your public key to use for encryption. Include additional configuration in the DropInConfiguration:

    val cardConfiguration =
       CardConfiguration.Builder(Locale.getDefault(), resources.displayMetrics, Environment.TEST, "<publicKey>")
       .build()
    
    val dropInConfiguration = DropInConfiguration.Builder(this@MainActivity, YourDropInService::class.java)
       .addCardConfiguration(cardConfiguration)
       .build()
  4. Next, initialize Drop-in by calling the .startPayment() method. Drop-in will call the resultIntent when the payment flow is finished.

    DropIn.INSTANCE.startPayment(this@YourActivity, mPaymentMethodsApiResponse, dropInConfiguration, resultIntent)

In the next steps, we talk about how you can make the API requests from your server.

Step 3: Make a payment

The makePaymentsCall described in step 2 is where you should submit the shopper's payment details from the app to your server to make an API request.

  1. From your server, make a POST /payments request specifying the parameters described below, along with other parameters that might be required for your integration.

    For example, you need to include additional fields if you are implementing 3D Secure 2 native or 3D Secure redirect authentication.

    • amount
    • reference: Your unique reference for this payment.
    • paymentMethod: The paymentComponentData.paymentMethod from Drop-in.
    • returnUrl: In case of a redirection, this is the URL to where your shopper will be redirected back to after they complete the payment. Get this URL from Drop-in in the RedirectComponent.getReturnUrl(context).
    • merchantAccount: Your merchant account name.

      curl https://checkout-test.adyen.com/v49/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": "DROPIN_PAYMENT_COMPONENT_DATA"
        "returnUrl":"https://your-company.com/checkout/",
        "merchantAccount":"YOUR_MERCHANT_ACCOUNT"
      }'
      # 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.payments({
        :amount => {
          :currency => "EUR",
          :value => 1000
        },
        :reference => "YOUR_ORDER_NUMBER",
        :paymentMethod => "COMPONENT_DATA_PAYMENTMETHOD",
        :returnUrl => "https://your-company.com/checkout/",
        :merchantAccount => "YOUR_MERCHANT_ACCOUNT"
      })
      // 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("https://your-company.com/...");
      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);
      
      $params = array(
        "amount" => array(
          "currency" => "EUR",
          "value" => 1000
        ),
        "reference" => "YOUR_ORDER_NUMBER",
        "paymentMethod" => "COMPONENT_DATA_PAYMENTMETHOD",
        "returnUrl" => "https://your-company.com/checkout/",
        "merchantAccount" => "YOUR_MERCHANT_ACCOUNT"
      );
      $result = $service->payments($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.payments({
         'amount': {
            'value': 1000,
            'currency': 'EUR'
         },
         'reference': 'YOUR_ORDER_NUMBER',
         'paymentMethod': 'COMPONENT_DATA_PAYMENTMETHOD',
         'returnUrl': 'https://your-company.com/...',
         'merchantAccount': 'YOUR_MERCHANT_ACCOUNT'
      })
      // 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{DROPIN_DATA_PAYMENTMETHOD};
      var paymentsRequest = new Model.Checkout.PaymentRequest
      {
        Reference = "YOUR_ORDER_NUMBER",
        Amount = amount,
        ReturnUrl = @"https://your-company.com/...",
        MerchantAccount = "YOUR_MERCHANT_ACCOUNT",
        PaymentMethod = details
      };
      
      var paymentResponse = checkout.Payments(paymentsRequest);

    Response

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

    • resultCode: If the payment was successful, you will get an Authorised result code. For other possible resultCode values and the actions that you need to take, see Result codes.
    • action: If you get this object in the response, this means that you need to perform additional action on your client app to complete the payment.
    • pspReference: Our unique identifier for the transaction.
    • refusalReason: Returned with resultCode Error or Refused. See refusal reasons for possible values.

      {
      "resultCode":"IdentifyShopper",
      "action":{
       "paymentMethodType":"scheme",
       "token":"eyJ0aHJlZURTTWV0aG9kTm90aWZpY...",
       "type":"threeDS2Fingerprint"
      },
      "authentication":{
       "threeds2.fingerprintToken":"eyJ0aHJlZURTTWV0aG9kTm90aWZpY..."
      },
      "details":[
       {
         "key":"threeds2.fingerprint",
         "type":"text"
       }
      ],
      "paymentData":"Ab02b4c0!BQABAgCuZFJrQOjSsl\/zt+..."
      }
  2. The next steps depend on if you received an action object in the response.
    • If you received an action object, create a CallResult with ResultType ACTION and pass the action JSON object. Drop-in will use this CallResult to perform additional actions in the app, for example, to redirect your shopper to an issuer's site or to another app.
    • If you did not get an action object, create a CallResult with ResultType FINISHED and a corresponding message. You can then proceed to step 5 to present the payment result to your shopper.

Step 4: Submit additional payment details

Drop-in performs the makeDetailsCall described in step 2 after it completes additional actions in the app, for example, shopper redirection. In this function, you should submit the results from the app to your server to make an API request.

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

    • details: This is in the actionComponentData.details from Drop-in.

      curl https://checkout-test.adyen.com/v49/payments/details \
      -H "x-API-key: YOUR_X-API-KEY" \
      -H "content-type: application/json" \
      -d 'DROPIN_ACTION_COMPONENT_DATA'
      }'
      # 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.payments.details({
        :details => {
          :payload => "sdfsdfsdf..."
        }
      })
      // 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);
      PaymentDetailsRequest paymentDetailsRequest = new PaymentDetailsRequest();
      HashMap<String, String> details = new HashMap<>();
      details.put("payload", "sdfsdfsdf...");
      paymentsDetailsRequest.setDetails(details);
      PaymentsResponse paymentsResponse = checkout.paymentDetails(PaymentDetailsRequest);
      // Set your X-API-KEY with the API key from the Customer Area.
      $client = new \Adyen\Client();
      $client->setXApiKey("YOUR_X-API-KEY");
      $service = new \Adyen\Service\Checkout($client);
      
      $params = array(
        "details" => array(
          "payload" => "sdfsdfsdf..."
        )
      );
      $result = $service->paymentDetails($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.payments_details({
         'details': {
            'payload': 'sdfsdfsdf...'
         }
      })
      // 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 details = new Dictionary<string, string>
      {
        { "payload", "Ab02b4c0..." }
      };
      var paymentsDetailsRequest = new Model.Checkout.PaymentsDetailsRequest(Details: details);
      var paymentResponse = checkout.PaymentDetails(paymentsDetailsRequest);

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

    • resultCode: If the payment was successful, you will get an Authorised result code. For other possible resultCode values and the actions that you need to take, see Result codes.
    • action: If you get this object in the response, Drop-in will perform additional actions again.
    • pspReference: Our unique identifier for the transaction.
    • refusalReason: Returned with resultCode Error or Refused. See refusal reasons for possible values.

      {
      "pspReference": "88154795347618C",
      "resultCode": "Authorised"
      }
      {
      "pspReference": "89783918347627F",
      "refusalReason": "Not enough balance",
      "resultCode": "Refused"
      }
  2. The next steps depend on if you received an action object in the response.
    • If you received an action object, you need to perform step 4 again.
    • If you did not get an action object, create a CallResult with ResultType FINISHED and a corresponding message. You can then proceed to step 5 to present the payment result to your shopper.

Step 5: Present the payment result

If you do not receive an action object from your last API request, this means that the payment has been completed.

To present the result to the shopper, you can include the resultCode in the message of the CallResult.FINISHED. You can then get the message from the resultIntent in intent.getStringExtra(DropIn.RESULT_KEY).

When the resultIntent is pointing to an Activity responsible for showing the payment results to the shopper, you can check for the resultCode inside DropIn.RESULT_KEY and present a corresponding message to the shopper.

For example:

  • If you get an Authorised result code, inform the shopper that the payment was successful.
  • If you get an Error or Refused result code, inform the shopper that the payment failed.
  • If you get a Pending or Received resultCode, inform the shopper that you've received their order, and are waiting for the payment to be processed. To receive payment status updates, set up your notification webhooks to receive payment status updates.

Check out your specific payment method page for the possible result codes that you might receive, or see this list of Result codes for recommended messages that you can present to your shopper.

Notification webhooks

Although in most cases the resultCode you received from the /payments or /payments/details endpoints already indicate the payment result, notifications are the only way to know about the outcome of a payment in cases where:

  • The resultCode is Pending or Received.
  • The shopper failed to return to your website or app.

Make sure that you set up your notification webhooks so you can receive payment status updates.

After we know the outcome of a payment, we will send you a notification containing:

  • eventCode: AUTHORISATION
  • success: Indicates the outcome of the payment. Possible values:

    • true: The payment was successful.
    • false: The payment failed.

Check out Notification request item to see all the information returned in a notification.

Testing and going 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've completed testing, there are some additional steps you need to complete before you can accept live payments from shoppers. Refer to Getting started with Adyen for more information.

When you're ready to move to production, you'll have to switch from test to our live endpoints. See Live endpoints for more information.

Supported payment methods in Drop-in

The following payment methods are supported in Drop-in. If you have questions about payment methods not on the list below or those that do not have linked pages, contact Support Team.

Payment method
 Web 
  iOS  
  Android  
AfterPay
-white_check_mark-
Apple Pay
-white_check_mark-
BCMC Mobile
-white_check_mark-
Cards, including 3D Secure 1 and 3D Secure 2
authentication
-white_check_mark-
-white_check_mark-
-white_check_mark-
Stored card details
-white_check_mark-
-white_check_mark-
Dragonpay
-white_check_mark-
Dotpay
-white_check_mark-
-white_check_mark-
-white_check_mark-
Entercash
-white_check_mark-
-white_check_mark-
-white_check_mark-
EPS
-white_check_mark-
-white_check_mark-
-white_check_mark-
giropay
-white_check_mark-
Google Pay
-white_check_mark-
iDEAL
-white_check_mark-
-white_check_mark-
-white_check_mark-
MOLPay
-white_check_mark-
-white_check_mark-
-white_check_mark-
Open banking
-white_check_mark-
-white_check_mark-
-white_check_mark-
QiwiWallet
-white_check_mark-
Redirect payment methods
(For example, UnionPay)
-white_check_mark-
-white_check_mark-
-white_check_mark-
SEPA Direct Debit
-white_check_mark-
-white_check_mark-
WeChat Pay
-white_check_mark-

We're actively adding payment methods to Drop-in. To check the latest on Drop-in and Components, see our release notes.

See also

Next steps