Search

Are you looking for test card numbers?

Would you like to contact support?

Online-payment icon

iOS Drop-in integration guide

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

  Check out Adyen iOS on GitHub.

Use Drop-in, our all-in-one UI solution, to accept payments on your iOS app using a single client-side implementation. We recommend that you use Drop-in if you want a quick way to start accepting payments in your app, with little to no customization.

Supported payment methods

Drop-in readily supports cards, wallets, and most local payment methods. For a list of supported payment methods, refer to Supported payment methods.

Adding new payment methods usually requires no additional implementation effort, however some payment methods require additional configuration. For more information, refer to our payment method integration guides.

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

How Drop-in looks


 


How Drop-in works

The following 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. Determine from the response if you need to perform additional actions on your client app.
  5. From your server, submit additional payment details with the data returned by Drop-in.
  6. Present the payment result to the shopper.

When you have finished integrating with our Drop-in solution, proceed to test your integration.

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 iOS client-side library

To install iOS Drop-in from CocoaPods:

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

To install iOS Drop-in from Carthage:

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

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 iOS. Adyen returns only the payment methods available for iOS.
    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 Drop-in configuration.

    Here's an example of how you would get the available payment methods for a shopper in the Netherlands, for a payment of 10 EUR:

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

Next, use Drop-in to show the available payment methods and to collect payment details from your shopper.

  1. Decode the /paymentMethods response with the PaymentMethods structure.

    let paymentMethods = try JSONDecoder().decode(PaymentMethods.self, from: paymentMethodsResponse)
  2. Include additional configuration in an instance of DropInComponent.PaymentMethodsConfiguration. Check specific payment method pages to confirm if you need to include additional required parameters.

    For example, for Cards, you need to include a public key.

    let configuration = DropInComponent.PaymentMethodsConfiguration()
    configuration.card.publicKey = "..." // Your public key, retrieved from the Customer Area.
    // Check specific payment method pages to confirm if you need to configure additional required parameters.
    // For example, to enable the Card form, you need to provide your Client Encryption Public Key.
  3. Initialize the DropInComponent class.

    Parameter name Required Description
    paymentMethods -white_check_mark- The full, decoded /paymentMethods response.
    paymentMethodsConfiguration Contains required or optional configuration for specific payment methods. For more information, refer to supported payment methods.
    environment -white_check_mark- Use test. When you're ready to accept live payments, change the value to one of our live environments
    payment Show the amount a shopper has to pay on the Pay button. To do this, you include the currency and the amount (in minor units) that the shopper has to pay.
    let dropInComponent = DropInComponent(paymentMethods: paymentMethods,
    paymentMethodsConfiguration: configuration)
    dropInComponent.delegate = self
    dropInComponent.environment = .test
    // When you're ready to go live, change this to .live
    // or to other environment values described in https://adyen.github.io/adyen-ios/Docs/Structs/Environment.html
    dropInComponent.payment = Payment(amount: Payment.Amount(value: 1000,
                                                             currencyCode: "EUR"))
    // Optional. In this example, the Pay button will display 10 EUR.
    present(dropInComponent.viewController, animated: true)
  4. After the shopper selects a payment method and provides payment details, Drop-in invokes the didSubmit method. Get the contents of data.paymentMethod and pass this to your server.

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

    In case an error occurs on the app, Drop-in invokes the didFail method. Dismiss Drop-in's view controller and display an error message.

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

For more information on iOS Drop-in classes, see our reference documentation page.

Localization

iOS Drop-in supports the languages listed here. However, if you want to customize the localization, you can add new localizable.strings file for the language that you need. You can also override existing entries by using the same keys. Check all available strings here.

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

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

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

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 URL to where the shopper should be taken back to after a redirection. This URL can have a maximum of 1024 characters. For more information on setting a custom URL scheme for your app, read the Apple Developer documentation.
    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.

    Here's an example of how you would make a payment request for 10 EUR:

    curl https://checkout-test.adyen.com/v53/payments \
    -H "x-API-key: YOUR_X-API-KEY" \
    -H "content-type: application/json" \
    -d '{
      "amount":{
        "currency":"EUR",
        "value":1000
      },
      "reference":"YOUR_ORDER_NUMBER",
      "paymentMethod": {hint:data.paymentMethod from the didSubmit}data.paymentMethod{/hint},
      "returnUrl":"my-app://",
      "merchantAccount":"YOUR_MERCHANT_ACCOUNT"
    }'
    # Set your X-API-KEY with the API key from the Customer Area.
    adyen = Adyen::Client.new
    adyen.env = :test
    adyen.api_key = "YOUR_X-API-KEY"
     
    paymentMethod = DROPIN_DATA_PAYMENTMETHOD
    # Data object passed from didSubmit method of the client app, parsed from JSON to a Hash.
    
    response = adyen.checkout.payments({
      :amount => {
        :currency => "EUR",
        :value => 1000
      },
      :reference => "YOUR_ORDER_NUMBER",
      :paymentMethod => paymentMethod,
      :returnUrl => "https://your-company.com/checkout?shopperOrder=12xy..",
      :merchantAccount => "YOUR_MERCHANT_ACCOUNT"
    })
    
    # Check if further action is needed.
    if response.body.has_key(:action)
       # Pass the action object to your front end
       # response.body[:action]
    else
       # No further action needed, pass the resultCode object to your front end
       # response.body[:resultCode]
    // Set your X-API-KEY with the API key from the Customer Area.
    Client client = new Client(xApiKey,Environment.TEST);
     
    Checkout checkout = new Checkout(client);
    Amount amount = new Amount();
    amount.setCurrency("EUR");
    amount.setValue(15000L);
    PaymentMethodDetails paymentMethod = DROPIN_PAYMENT_COMPONENT_DATA;
    
    PaymentsRequest paymentsRequest = new PaymentsRequest();
    paymentsRequest.setAmount(amount);
    paymentsRequest.setMerchantAccount("YOUR_MERCHANT_ACCOUNT");
    paymentsRequest.setReference("Your order number");
    paymentsRequest.setPaymentMethod(paymentMethod);
    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 = DROPIN_DATA_PAYMENTMETHOD;
    // Data object passed from didSubmit method of the client app, parsed from JSON to an array
    
    $params = array(
      "amount" => array(
        "currency" => "EUR",
        "value" => 1000
      ),
      "reference" => "YOUR_ORDER_NUMBER",
      "paymentMethod" => $paymentMethod,
      "returnUrl" => "https://your-company.com/checkout?shopperOrder=12xy..",
      "merchantAccount" => "YOUR_MERCHANT_ACCOUNT"
    );
    
    $result = $service->payments($params);
    
    // Check if further action is needed
    if (array_key_exists("action", $result){
       // Pass the action object to your front end
       // $result["action"]
    }
    else {
       // No further action needed, pass the resultCode to your front end
       // $result['resultCode']
    }
    # Set your X-API-KEY with the API key from the Customer Area.
    adyen = Adyen.Adyen()
    adyen.client.xapikey = 'YOUR_X-API-KEY'
    
    paymentMethod = DROPIN_DATA_PAYMENTMETHOD
    # Data object passed from didSubmit method of the client app, parsed from JSON to a dictionary
    
    result = adyen.checkout.payments({
       'amount': {
          'value': 1000,
          'currency': 'EUR'
       },
       'reference': 'YOUR_ORDER_NUMBER',
       'paymentMethod': paymentMethod,
       'returnUrl': 'https://your-company.com/checkout?shopperOrder=12xy..',
       'merchantAccount': 'YOUR_MERCHANT_ACCOUNT'
    })
    
    # Check if further action is needed
    if 'action' in result.message:
       # Pass the action object to your front end
       # result.message['action']
    else:
       # No further action needed, pass the resultCode to your front end
       # result.message['resultCode']
    // Set your X-API-KEY with the API key from the Customer Area.
    var client = new Client ("YOUR_X-API-KEY", Environment.Test);
    var checkout = new Checkout(client);
    
    var amount = new Model.Checkout.Amount("EUR", 1000);
    var details = new Model.Checkout.DefaultPaymentMethodDetails{
      Type = "scheme",
      EncryptedCardNumber = "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
      EncryptedExpiryMonth = "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
      EncryptedExpiryYear = "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
      EncryptedSecurityCode = "adyenjs_0_1_18$MT6ppy0FAMVMLH..."
    };
    var paymentRequest = new Adyen.Model.Checkout.PaymentRequest
    {
      Reference = "YOUR_ORDER_NUMBER",
      Amount = amount,
      ReturnUrl = @"my-app://",
      MerchantAccount = "YOUR_MERCHANT_ACCOUNT",
      PaymentMethod = details
    };
    
    var paymentResponse = checkout.Payments(paymentsRequest);
    // Set your X-API-KEY with the API key from the Customer Area.
    const {Client, Config, CheckoutAPI} = require('@adyen/api-library');
    const config = new Config();
    // Set your X-API-KEY with the API key from the Customer Area.
    config.apiKey = '[API_KEY]';
    config.merchantAccount = '[YOUR_MERCHANT_ACCOUNT]';
    const client = new Client({ config });
    client.setEnvironment("TEST");
    const checkout = new CheckoutAPI(client);
    checkout.payments({
        amount: { currency: "EUR", value: 1000 },
        paymentMethod: {DROPIN_DATA_PAYMENTMETHOD}, // Data object passed from didSubmit method of the client app
        reference: "YOUR_ORDER_NUMBER",
        merchantAccount: config.merchantAccount,
        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 didSubmit method of the client app
    paymentMethod := DROPIN_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",
        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.
    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.
    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, Drop-in uses the action object from the previous step. You should also use the action.type to determine your next steps.

  1. Use dropInComponent.handle(action) to trigger Drop-in to perform additional actions.

    let action = try JSONDecoder().decode(Action.self, from: actionData)
    dropInComponent.handle(action)
  2. Drop-in performs additional client app actions depending on the action.type. Your next steps depend on the type of action that Drop-in performs.

    action.type Description Next steps
    redirect Drop-in redirects the shopper to another website or app
    to complete the payment.
    1. When the shopper returns to your website, you need to handle the redirect result.
    2. Proceed to step 5 to check the payment result.
    threeDS2Fingerprint The payment qualifies for 3D Secure 2, and will go through either the frictionless or the challenge flow.

    Drop-in performs the authentication flow, and calls the didProvide method.
    1. Get thedata.details from the didProvide method and pass it your server. Dismiss the dropInComponent immediately, or wait until you have submitted the details to your server.
    2. Proceed to step 5 to submit additional payment details.
    threeDS2Challenge The payment qualifies for 3D Secure 2, and the issuer is initiating a challenge flow.

    Drop-in performs the authentication flow, and calls the didProvide method.
    1. Get the data.details from the didProvide method and pass it your server. Dismiss the dropInComponent immediately, or wait until you have submitted the details to your server.
    2. Proceed to step 5 to submit additional payment details.
    **SDK

    **The type can sometimes include the payment method name. For example, wechatpaySDK.
    Drop-in triggers the app switch from your app to the payment method's app, if installed in the shopper's device.

    When the shopper is redirected back to your app, Drop-in calls the didProvide method.
    1. Get the data.details from the didProvide method and pass it your server. Dismiss the dropInComponent immediately, or wait until you have submitted the details to your server.
    2. Proceed to step 5 to check the payment result.

Handle the redirect result

If the Action class returns .redirect, the shopper is redirected to an external site or to another application to complete the payment. You then need to inform Drop-in when the shopper returns to your app. To do this, implement the following in your UIApplicationDelegate:

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

       return true
   }

Step 5: Submit additional payment details

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

From your server, make a POST /payments/details request with the following:

  • details: Thedata.details from the didProvide method from your client app.
  • paymentData: The data.paymentData from the didProvide method from your client app, or for a payment method that required an app switch, the value that you saved in your server.

The example below shows how you would submit additional payment details in case you received a threeDS2Fingerprint action.type.

curl https://checkout-test.adyen.com/v53/payments/details \
-H "x-API-key: YOUR_X-API-KEY" \
-H "content-type: application/json" \
-d '{
  "{hint:data.details from didProvide}details{/hint}": {
    "threeds2.fingerprint":"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 fingerPrint = "eyJ0aHJlZURTQ29tcEluZCI6IlkifQ==";

Client client = new Client(apiKey,Environment.TEST);
Checkout checkout = new Checkout(client);
PaymentsDetailsRequest paymentsDetailsRequest = new PaymentsDetailsRequest();
paymentDetailsRequest.setFingerPrint();
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 fingerPrint = "eyJ0aHJlZURTQ29tcEluZCI6IlkifQ==";

var details = new Dictionary<string, string>
{
  { "threeds2.fingerprint": fingerPrint }
};
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. Use the resultCode to present the payment result to your shopper.
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.
3. Perform step 4 again.
Successful payment response
 {
   "pspReference": "88154795347618C",
   "resultCode": "Authorised"
 }
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 Drop-in from one of our live environments closest to where your shoppers are. Set the dropInComponent.environment to any of the following values:

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

See also

Next steps