Search

Are you looking for test card numbers?

Would you like to contact support?

Online-payment icon

API-only integration guide

Learn how you can use our APIs and then build your own UI.

Use our APIs and build your own payment form if you want full control over the look and feel of your checkout page. If you'd rather not build your own payment form, see our available UI solutions for web, iOS, and Android.

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

How it works

On this page we describe server-side integration and the client-side implementation that you have to build:

  1. From your server, submit a request to get a list of payment methods available to the shopper.
  2. Present your payment form and collect your shopper's payment details.
  3. From your server, submit a payment request with the data you have collected from the shopper.
  4. Check from the response if you need to perform additional actions on your front end. For example, redirecting your shopper to another website to complete the payment.
  5. From your server, submit additional payment details.
  6. Present the payment result to your shopper.

Before you begin

Before you start integrating:

  1. Contact our Sales Support to make sure you're eligible for using our API-only integration.
  2. 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.

To make sure that your 3D Secure integration works on Chrome, your cookies need to have the SameSite attribute. For more information, refer to Chrome SameSite Cookie policy.

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, specifying:

    Parameter name Required Description
    merchantAccount -white_check_mark- Your merchant account name.
    amount The currency and value of the payment, in minor units. This is used to filter the list of available payment methods to your shopper.
    channel The platform of the shopper's device: Web, iOS, or Android. This is used to filter the list of available payment methods to your shopper.
    countryCode The shopper's country code. This is used to filter the list of available payment methods to your shopper.
    shopperLocale Language and country code. This is used to translate the payment methods names in the response. By default, the shopperlocale is set to en-US.

    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": "Web"
    }'
    require 'adyen-ruby-api-library'
    
    # 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 => 'Web'
    })
    // 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.WEB);
    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" => "Web"
    );
    $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': 'Web',
    })
    // 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.Web
    };
    
    var paymentMethodsResponse = checkout.PaymentMethods(paymentMethodsRequest);
    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);
    const paymentsResponse = checkout.paymentMethods({
        amount: {
            currency: "EUR",
            value: 1000,
        },
        countryCode: "NL",
        channel: "Web",
        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: "Web",
        MerchantAccount: "[MERCHANT_ACCOUNT]",
    })

    The response includes the list of available paymentMethods, including:

    • name: Name of the payment method, which you can display to your shopper in your payment form. 
    • type: Unique payment method code. You'll need to pass this when making a payment request.
    • details: An array that contains the required fields for each payment method.
    {
      "paymentMethods":[
        {
          "details": [
            {
              "key": "number",
              "type": "text"
            },
            {
              "key": "expiryMonth",
              "type": "text"
            },
            {
              "key": "expiryYear",
              "type": "text"
            },
            {
              "key": "cvc",
              "type": "text"
            },
            {
              "key": "holderName",
              "optional": true,
              "type": "text"
            }
          ],
          "name": "Credit Card",
          "type": "scheme"
        },
        {
          "details":[
            {
              "key":"sepa.ownerName",
              "type":"text"
            },
            {
              "key":"sepa.ibanNumber",
              "type":"text"
            }
          ],
          "name":"SEPA Direct Debit",
          "type":"sepadirectdebit"
        },
        {    ...
        }
      ]
    }
  2. Get the required fields for each payment method from the details array. If a payment method does not have a details array, you do not need to collect any shopper details in your form.

    • key: The information that you need to collect from the shopper.
    • type: The input type.

      type Description
      emailAddress Email address.
      radio Radio buttons displaying the options specified within the items array.
      select A list displaying the options specified within the items array. Present each name in this array to the shopper.
      tel Telephone number.
      text Generic string. For type: scheme, if you are fully PCI compliant you can alternatively collect and submit raw card data. Otherwise, you need make a custom card integration to encrypt card data.

    For example, to pay with name SEPA Direct Debit, the details.type property indicates that you need text fields to collect the following details.key fields:

    • sepa.ownerName: Name on the shopper's bank account.
    • sepa.ibanNumber: IBAN number of this account.
    {
      "paymentMethods":[
        {
          ...
        },
        {
          "details":[
            {
              "key":"sepa.ownerName",
              "type":"text"
            },
            {
              "key":"sepa.ibanNumber",
              "type":"text"
            }
          ],
          "name":"SEPA Direct Debit",
          "type":"sepadirectdebit"
        }
      ]
    }
  3. Provide the list of payment methods and the required input fields to your front end or client app.

Step 2: Collect shopper details

For card payments, you must collect your shopper's card payment details based on your PCI compliance.

For your payment form, you can build either:

  • A hard-coded payment form: After making a /paymentMethods call in step 1 to determine the payment details you need to collect, you build a static form that collects them from the shopper.

    A hard-coded form is quicker to implement, but the payment details you need to collect from a shopper can change. You should regularly poll the /paymentMethods endpoint to check for any updates to required payment details. We recommend this approach if you're only working with a small number of payment methods or countries.

  • A dynamically generated payment form: For each transaction, you make a /paymentMethods call in step 1 to determine the payment details you need to collect.

    Then use the response to generate a form that collects them from the shopper. This takes more time to implement, but ensures that the required payment details you collect from the shopper are up-to-date.

We provide payment method and issuer logos which you can use in your payment form. For more information, refer to Downloading logos for more information.

After you have collected your shopper's payment details, pass the data and the payment method type to your server.

For example:

Shopper payment details for SEPA Direct Debit
{
  "type": "sepadirectdebit",
  "sepa.ownerName": "A Schneider",
  "sepa.ibanNumber": "NL13TEST0123456789"
}

Collecting your shopper's card details

If the shopper selects to pay with a Card payment method, you have the following options for collecting card details:

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.

From your server, make a /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.
reference -white_check_mark- Your unique reference for this payment.
paymentMethod.type -white_check_mark- The type of this payment method from the /paymentMethods response.
paymentMethod -white_check_mark- The shopper details that you collected in the previous step.
returnUrl -white_check_mark- URL to where the shopper should be taken back to after a redirection. The URL can contain a maximum of 1024 characters.
- For Web the URL should include the protocol: http:// or https://. You can also include your own additional query parameters, for example, shopper ID or order reference number.
- For iOS, use the custom URL for your app. For example, my-app://. For more information on setting custom URL schemes, refer to the Apple Developer documentation.
- For Android, use a custom URL handled by an Activity on your app. You can configure it with an intent filter. For example, configure my-app://your.package.name, and then add that to your manifest.xml file.
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": {
    "type": "scheme",
    "encryptedCardNumber": "test_4111111111111111",
    "encryptedExpiryMonth": "test_03",
    "encryptedExpiryYear": "test_2030",
    "encryptedSecurityCode": "test_737"
  },
  "returnUrl":"https://your-company.com/checkout?shopperOrder=12xy..",
  "merchantAccount":"YOUR_MERCHANT_ACCOUNT"
}'
require 'adyen-ruby-api-library'

# 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 => {
    :type => "scheme",
    :encryptedCardNumber => "test_4111111111111111",
    :encryptedExpiryMonth => "test_03",
    :encryptedExpiryYear => "test_2030",
    :encryptedSecurityCode => "test_737"
  },
  :returnUrl => "https://your-company.com/checkout?shopperOrder=12xy..",
  :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(1000L);
paymentsRequest.setAmount(amount);
String encryptedCardNumber = "test_4111111111111111";
String encryptedExpiryMonth = "test_03";
String encryptedExpiryYear = "test_2030";
String encryptedSecurityCode = "test_737";
paymentsRequest.setReference("Your order number");
paymentsRequest.addEncryptedCardData(encryptedCardNumber,encryptedExpiryMonth, encryptedExpiryYear, encryptedSecurityCode);
paymentsRequest.setReturnUrl("https://your-company.com/checkout?shopperOrder=12xy..");
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" => array(
    "type" => "scheme",
    "encryptedCardNumber" => "test_4111111111111111",
    "encryptedExpiryMonth" => "test_03",
    "encryptedExpiryYear" => "test_2030",
    "encryptedSecurityCode" => "test_737"
  ),
  "returnUrl" => "https://your-company.com/checkout?shopperOrder=12xy..",
  "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': {
      'type': 'scheme',
      'encryptedCardNumber': 'test_4111111111111111',
      'encryptedExpiryMonth': 'test_03',
      'encryptedExpiryYear': 'test_2030',
      'encryptedSecurityCode': 'test_737'
   },
   'returnUrl': 'https://your-company.com/checkout?shopperOrder=12xy..',
   '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{
  Type = "scheme",
  EncryptedCardNumber = "test_4111111111111111",
  EncryptedExpiryMonth = "test_03",
  EncryptedExpiryYear = "test_2030",
  EncryptedSecurityCode = "test_737"
};
var paymentRequest = new Adyen.Model.Checkout.PaymentRequest
{
  Reference = "YOUR_ORDER_NUMBER",
  Amount = amount,
  ReturnUrl = @"https://your-company.com/checkout?shopperOrder=12xy..",
  MerchantAccount = "YOUR_MERCHANT_ACCOUNT",
  PaymentMethod = details
};

var paymentResponse = checkout.Payments(paymentsRequest);
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: {
        type: 'scheme',
        encryptedSecurityCode: "test_4111111111111111",
        encryptedExpiryMonth: "test_03",
        encryptedExpiryYear: "test_2030",
        encryptedCardNumber: "test_737"
    },
    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,
})

res, httpRes, err := client.Checkout.Payments(&checkout.PaymentRequest{
    Amount: checkout.Amount{
        Value:    1000,
        Currency: "EUR",
    },
    MerchantAccount: "[MERCHANT_ACCOUNT]",
    PaymentMethod: map[string]interface{}{
        "type":   "scheme",
        "encryptedSecurityCode": "test_4111111111111111",
        "encryptedExpiryMonth": "test_03",
        "encryptedExpiryYear": "test_2030",
        "encryptedCardNumber": "test_737",
    },
    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 Additional steps are needed to complete the payment. 1. Pass the action object to your front end or client app.
2. Proceed to step 4.

If you received action.paymentData, store this on your server — you'll need to pass this in your next API request in step 5.

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 actions

If your server received an action object in the /payments response, your next steps depend on the action.type:

action.type Description Next steps
redirect The shopper is redirected to another website or app to complete the payment. 1. Handle the redirect.
2. Proceed to step 5 to check the payment result.
voucher The shopper gets a voucher which they will use to complete the payment later. 1. Present the voucher.
2. Proceed to step 6 and inform the shopper that you are waiting for the payment.
3. Wait for the notification webhook to know the payment result.
qrCode The shopper scans a QR code, and is redirected to an app to complete the payment. 1. Present the QR code.
2. Wait for the notification webhook to know the payment result.
await The shopper completes the payment asynchronously, for example by using an app. 1. Inform the shopper that you are waiting for the payment.
2. Proceed to step 5 to check the payment result.
sdk Applies for payment methods that require an SDK, for example WeChat Pay.
The type can sometimes include the payment method name, for example: wechatpaySDK.
1. Invoke the SDK to trigger the switch to the payment method's app.
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. 1. Use our 3D Secure 2 Components to get the device fingerprint: 2. Proceed to step 5 to complete the payment.
threeDS2Challenge The payment qualifies for 3D Secure 2, and the issuer is initiating a challenge flow. 1. Use our 3D Secure 2 Components to present the challenge to your shopper: 2. Proceed to step 5 to complete the payment.

Additional actions

If you get a voucher action.type:

  1. Get the voucher data from the action object and present this information on your front end or client app.

    For example, for Indonesian bank transfer payments, you get the following fields in the response:

    • expiresAt: The voucher expiry date.
    • initialAmount object: The amount and currency that the shopper has to pay.
    • merchantName: Your shop's name.
    • instructionsUrl: Link to where a shopper can get additional information about how to pay.
    {
    "resultCode": "PresentToShopper",
    "action": {
        "expiresAt": "2019-09-04T19:17:00",
        "initialAmount": {
            "currency": "IDR",
            "value": 10000
        },
        "instructionsUrl": "https://checkoutshopper-test.adyen.com/checkoutshopper/voucherInstructions.shtml?txVariant=doku_mandiri_va",
        "merchantName": "YOUR_SHOP_NAME",
        "paymentMethodType": "doku_alfamart",
        "reference": "8520126030105485",
        "shopperEmail": "john.smith@adyen.com",
        "shopperName": "John Smith",
        "totalAmount": {
            "currency": "IDR",
            "value": 10000
        },
        "type": "voucher"
    }
    }
  2. After you present the voucher to the shopper, proceed to step 6 and inform the shopper that you are waiting for the payment. We'll send a notification webhook to inform you of the payment result.

If you get a qrCode action.type:

  1. Get the qrCodeData from the action object. This parameter contains a URL that renders the QR code.

    For example, for WeChat Pay desktop QR payments, you get the following in the response:

    {
    "resultCode": "PresentToShopper",
    "action": {
        "paymentData": "Ab02b4c0!BQAB..",
        "paymentMethodType": "wechatpayQR",
        "qrCodeData": "weixin://wxpay/bizpayurl?pr=IM7BCOW",
        "type": "qrCode"
    }
    ...
    }
  2. Present the QR code on your checkout page.
  3. After the shopper scans the QR code and completes the payment, we'll send a notification webhook informing you of the payment result.
  4. Proceed to step 6 to present the payment result.

Step 5: Submit additional payment details

If you redirected your shopper to another website, use the /payments/details endpoint to check the payment result. If you performed 3D Secure 2 native authentication, you need to use the same endpoint to submit the authentication results.

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

    • details: This object should contain the details.key parameters you received in the /payments response. Pass either the redirect parameters from when the shopper returned to your website, or the parameters from the 3D Secure 2 Component.
    • paymentData: This is the paymentData you received in the /payments response.

    For example, if you received the payload parameter when the shopper was redirected back to your website, then you need to submit your request:

    curl https://checkout-test.adyen.com/v53/payments/details \
    -H "x-API-key: YOUR_X-API-KEY" \
    -H "content-type: application/json" \
    -d '{
         "paymentData":"Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...",
         "details":{
           "payload":"Ab02b4c0!BQABAgCW5sxB4e/=="
         }
    }'
    require 'adyen-ruby-api-library'
    
    # 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({
      :paymentData => 'Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...',
      :details => {
        :payload => 'Ab02b4c0!BQABAgCW5sxB4e/=='
      }
    })
    // 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);
    PaymentsDetailsRequest paymentsDetailsRequest = new PaymentsDetailsRequest();
    HashMap<String, String> details = new HashMap<>();
    details.put("payload", "Ab02b4c0!BQABAgCW5sxB4e/==...");
    paymentsDetailsRequest.setDetails(details);
    paymentsDetailsRequest.setPaymentData("Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...");
    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 = array(
      "paymentData" => "Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...",
      "details" => array(
        "payload" => "Ab02b4c0!BQABAgCW5sxB4e/==..."
      )
    );
    $result = $service->paymentsDetails($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({
       'paymentData' : 'Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...',
       'details': {
          'payload': 'Ab02b4c0!BQABAgCW5sxB4e/=='
       }
    })
    // 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!BQABAgCW5sxB4e/==..." }
    };
    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: { payload: "Ab02b4c0!BQABAgCW5sxB4e/==" },
        paymentData: "Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...",
    }).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{
        PaymentData: "Ab02b4c0!BQABAgAKspbjN8+5...",
        Details: map[string]interface{}{
            "payload":    "Ab02b4c0!BQABF...",
        },
    })

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

    • resultCode: Provides information about the result of the request.
    • pspReference: Our unique identifier for the transaction.
    • action: If you receive this object, this indicates that you need to perform step 4 again.

  2. The next steps depend on if you received an action object in the response.
    • If you received an action object, pass this to your front end or client app and perform step 4 again.
    • If you did not get an action object, proceed to the next step to present the payment result to your shopper.

Step 6: Present payment result

After the shopper completes the payment and no further actions are required on the front end or client app, use the resultCode to inform the shopper of the payment status.

resultCode Description
Authorised The payment was successful.
Error Inform the shopper that there was an error processing their payment. This result code is returned with a refusalReason, 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.
PresentToShopper For a voucher payment method, inform the shopper that you are waiting for their payment. You will receive the final result of the payment in an AUTHORISATION notification.

For a qrCode payment method, wait for the AUTHORISATION notification before presenting the payment result to the shopper.
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 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 TransactionsPayments.

When you are ready to go live, you need to:

  1. Apply for a live account.
  2. Assess your PCI DSS compliance by submitting:
  3. Configure your live account
  4. Submit a request to add payment methods in your live Customer Area .
  5. Switch from test to our live endpoints.

See also

Next steps