Pesquisar

Are you looking for test card numbers?

Would you like to contact support?

Atenção, esta página não se encontra disponível em Português
Default 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, use one of our pre-built UI options.

With our API-only solution, you have two options for accepting card payments:

  • Use our custom card integration to securely encrypt card details. This helps you ensure PCI compliance, as you're only required to submit SAQ A.
  • Collect and pass raw card data. This requires you to assess your PCI compliance according to SAQ D, the most extensive form of self-certification.

Before you begin

Before you start integrating:

  1. If you want to accept payments using raw card data, confirm with your Adyen Account Manager that you're eligible to use this option.
  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.

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.

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/v67/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",
      "shopperLocale": "nl-NL"
    }'
    require 'adyen-ruby-api-library'
    
    # Set your X-API-KEY with the API key from the Customer Area.
    adyen = Adyen::Client.new
    adyen.env = :test
    adyen.api_key = "YOUR_X-API-KEY"
    
    response = adyen.checkout.payment_methods({
        :countryCode => 'NL',
        :shopperLocale => 'nl-NL',
        :amount => {
            :currency => 'EUR',
            :value => 1000
        },
        :channel => 'Web',
        :merchantAccount => 'YOUR_MERCHANT_ACCOUNT'
    })
    // Set your X-API-KEY with the API key from the Customer Area.
    String xApiKey = "YOUR_X-API-KEY";
    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.Web);
    PaymentMethodsResponse paymentMethodsResponse = checkout.paymentMethods(paymentMethodsRequest);
    // Pass the response to your front end
    // Set your X-API-KEY with the API key from the Customer Area.
    $client = new \Adyen\Client();
    $client->setEnvironment(\Adyen\Environment::TEST);
    $client->setXApiKey("YOUR_X-API-KEY");
    $service = new \Adyen\Service\Checkout($client);
    
    $params = array(
        "countryCode" => "NL",
        "shopperLocale" => "nl-NL",
        "amount" => array(
            "currency" => "EUR",
            "value" => 1000
        ),
        "channel" => "Web",
        "merchantAccount" => "YOUR_MERCHANT_ACCOUNT"
    );
    $result = $service->paymentMethods($params);
    # Set your X-API-KEY with the API key from the Customer Area.
    adyen = Adyen.Adyen()
    adyen.payment.client.platform = "test"
    adyen.client.xapikey = 'YOUR_X-API-KEY'
    
    request = {
        'countryCode': 'NL',
        'shopperLocale': 'nl-NL',
        'amount': {
            'value': 1000,
            'currency': 'EUR'
        },
        'channel': 'Web',
        'merchantAccount': 'YOUR_MERCHANT_ACCOUNT'
    }
    result = adyen.checkout.payment_methods(request)
    // Set your X-API-KEY with the API key from the Customer Area.
    string apiKey = "YOUR_X-API-KEY";
    var client = new Client (apiKey, Environment.Test);
    var checkout = new Checkout(client);
    var amount = new Adyen.Model.Checkout.Amount("EUR", 1000);
    var paymentMethodsRequest = new Adyen.Model.Checkout.PaymentMethodsRequest(merchantAccount: "YOUR_MERCHANT_ACCOUNT")
    { 
        CountryCode = "NL",
        ShopperLocale = "nl-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 = '[YOUR_X-API-KEY]';
    config.merchantAccount = '[YOUR_MERCHANT_ACCOUNT]';
    const client = new Client({ config });
    client.setEnvironment("TEST");
    const checkout = new CheckoutAPI(client);
    const paymentsResponse = checkout.paymentMethods({
        merchantAccount: config.merchantAccount,
        countryCode: "NL",
        shopperLocale: "nl-NL",
        amount: { currency: "EUR", value: 1000, },
        channel: "Web"
    }).then(res => res);
    import (
        "github.com/adyen/adyen-go-api-library/v5/src/checkout"
        "github.com/adyen/adyen-go-api-library/v5/src/common"
        "github.com/adyen/adyen-go-api-library/v5/src/adyen"
    )
    // Set your X-API-KEY with the API key from the Customer Area.
    client := adyen.NewClient(&common.Config{
        Environment: common.TestEnv,
        ApiKey:      "[YOUR_X-API-KEY]",
    })
    res, httpRes, err := client.Checkout.PaymentMethods(&checkout.PaymentMethodsRequest{
        CountryCode: "NL",
        ShopperLocale: "nl-NL",
        Amount: checkout.Amount{
            Value:    1000,
            Currency: "EUR",
        },
        Channel: "Web",
        MerchantAccount: "[YOUR_MERCHANT_ACCOUNT]",
    })

    The response includes the list of available paymentMethods, ordered by popularity in the shopper's country. For each payment method, the response contains:

    • 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.
    {
      "paymentMethods":[
        {
          "name": "Credit Card",
          "type": "scheme"
        },
        {
          "name":"SEPA Direct Debit",
          "type":"sepadirectdebit"
        },
        {    ...
        }
      ]
    }
  2. Provide the list of payment methods and the required input fields for each payment method 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.

Collect your shopper's payment details based on the fields required by each payment method. Check the payment method pages to see which fields are required for each payment method.

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.

You need to include additional parameters in your payment request to:

Here's an example of how you would make a credit card payment for 10 EUR using encrypted card data:

curl https://checkout-test.adyen.com/v67/payments \
-H "x-API-key: YOUR_X-API-KEY" \
-H "content-type: application/json" \
-d '{
  "merchantAccount":"YOUR_MERCHANT_ACCOUNT",
  "paymentMethod":{
    "type": "scheme",
    "encryptedCardNumber": "test_4111111111111111",
    "encryptedExpiryMonth": "test_03",
    "encryptedExpiryYear": "test_2030",
    "encryptedSecurityCode": "test_737"
  },
  "amount":{
    "currency":"EUR",
    "value":1000
  },
  "reference":"YOUR_ORDER_NUMBER",
  "returnUrl":"https://your-company.com/checkout?shopperOrder=12xy.."
}'
require 'adyen-ruby-api-library'

# Set your X-API-KEY with the API key from the Customer Area.
adyen = Adyen::Client.new
adyen.env = :test
adyen.api_key = "YOUR_X-API-KEY"

response = adyen.checkout.payments({
    :paymentMethod => {
        :type => "scheme",
        :encryptedCardNumber => "test_4111111111111111",
        :encryptedExpiryMonth => "test_03",
        :encryptedExpiryYear => "test_2030",
        :encryptedSecurityCode => "test_737"
    },
    :amount => {
        :currency => 'EUR',
        :value => 1000
    },
    :reference => "YOUR_ORDER_NUMBER",
    :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.
String xApiKey = "YOUR_X-API-KEY";
Client client = new Client(xApiKey,Environment.TEST);
Checkout checkout = new Checkout(client);
PaymentsRequest paymentsRequest = new PaymentsRequest();
paymentsRequest.setMerchantAccount("YOUR_MERCHANT_ACCOUNT");
String encryptedCardNumber = "test_4111111111111111";
String encryptedExpiryMonth = "test_03";
String encryptedExpiryYear = "test_2030";
String encryptedSecurityCode = "test_737";
paymentsRequest.addEncryptedCardData(encryptedCardNumber,encryptedExpiryMonth, encryptedExpiryYear, encryptedSecurityCode);
Amount amount = new Amount();
amount.setCurrency("EUR");
amount.setValue(1000L);
paymentsRequest.setAmount(amount);
paymentsRequest.setReference("Your order number");
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->setEnvironment(\Adyen\Environment::TEST);
$client->setXApiKey("YOUR_X-API-KEY");
$service = new \Adyen\Service\Checkout($client);

$params = array(
    "paymentMethod" => array(
        "type" => "scheme",
        "encryptedCardNumber" => "test_4111111111111111",
        "encryptedExpiryMonth" => "test_03",
        "encryptedExpiryYear" => "test_2030",
        "encryptedSecurityCode" => "test_737"
    ),
    "amount" => array(
        "currency" => "EUR",
        "value" => 1000
    ),
    "reference" => "YOUR_ORDER_NUMBER",
    "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.payment.client.platform = "test"
adyen.client.xapikey = 'YOUR_X-API-KEY'

result = adyen.checkout.payments({
    'paymentMethod': {
        'type': 'scheme',
        'encryptedCardNumber': 'test_4111111111111111',
        'encryptedExpiryMonth': 'test_03',
        'encryptedExpiryYear': 'test_2030',
        'encryptedSecurityCode': 'test_737'
    },
    'amount': {
        'value': 1000,
        'currency': 'EUR'
    },
    'reference': 'YOUR_ORDER_NUMBER',
    '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.
string apiKey = "YOUR_X-API-KEY";
var client = new Client (apiKey, Environment.Test);
var checkout = new Checkout(client);
var details = new Model.Checkout.DefaultPaymentMethodDetails{
    Type = "scheme",
    EncryptedCardNumber = "test_4111111111111111",
    EncryptedExpiryMonth = "test_03",
    EncryptedExpiryYear = "test_2030",
    EncryptedSecurityCode = "test_737"
};
var amount = new Adyen.Model.Checkout.Amount("EUR", 1000);
var paymentRequest = new Adyen.Model.Checkout.PaymentRequest
{ 
    PaymentMethod = details,
    Amount = amount,
    Reference = "YOUR_ORDER_NUMBER",
    ReturnUrl = @"https://your-company.com/checkout?shopperOrder=12xy.."
};
var paymentsResponse = 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 = '[YOUR_X-API-KEY]';
config.merchantAccount = '[YOUR_MERCHANT_ACCOUNT]';
const client = new Client({ config });
client.setEnvironment("TEST");
const checkout = new CheckoutAPI(client);
checkout.payments({
    merchantAccount: config.merchantAccount,
    paymentMethod: {
        type: 'scheme',
        encryptedCardNumber: "test_4111111111111111",
        encryptedExpiryMonth: "test_03",
        encryptedExpiryYear: "test_2030",
        encryptedSecurityCode: "test_737"
    },
    amount: { currency: "EUR", value: 1000, },
    reference: "YOUR_ORDER_NUMBER",
    returnUrl: "https://your-company.com/checkout?shopperOrder=12xy.."
}).then(res => res);
import (
    "github.com/adyen/adyen-go-api-library/v5/src/checkout"
    "github.com/adyen/adyen-go-api-library/v5/src/common"
    "github.com/adyen/adyen-go-api-library/v5/src/adyen"
)
// Set your X-API-KEY with the API key from the Customer Area.
client := adyen.NewClient(&common.Config{
    Environment: common.TestEnv,
    ApiKey:      "[YOUR_X-API-KEY]",
})
paymentMethod := map[string]interface{}{
        "type":   "scheme",
        "encryptedCardNumber": "test_4111111111111111",
        "encryptedExpiryMonth": "test_03",
        "encryptedExpiryYear": "test_2030",
        "encryptedSecurityCode": "test_737",
    },
res, httpRes, err := client.Checkout.Payments(&checkout.PaymentRequest{
    PaymentMethod: paymentMethod,
    Amount: checkout.Amount{
        Value:    1000,
        Currency: "EUR",
    },
    Reference: "YOUR_ORDER_NUMBER",
    ReturnUrl: "https://your-company.com/checkout?shopperOrder=12xy..",
    MerchantAccount: "[YOUR_MERCHANT_ACCOUNT]",
})


Your next steps depend on whether the /payments response contains an action object. Choose your API version:

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 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.

The following example shows the /payments response for iDEAL, a redirect payment method.

/payments response
  {
    "resultCode": "RedirectShopper",
    "action": {
      "paymentMethodType": "ideal",
      "url": "https://checkoutshopper-test.adyen.com/checkoutshopper/checkoutPaymentRedirect?redirectData=X6Xtf...",
      "method": "GET",
      "type": "redirect"
    }
  }
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 Additional steps are needed to complete the payment. 1. Store the action.paymentData in your server. You'll need this in your next API request.
2. Pass the action object to your front end or client app.
3. Proceed to step 4.

The following example shows the /payments response for iDEAL, a redirect payment method.

/payments response
  {
    "resultCode": "RedirectShopper",
    "action": {
      "paymentData": "Ab02b4c0!BQABAgBJp/z/T3+6P ...",
      "paymentMethodType": "ideal",
      "url": "https://checkoutshopper-test.adyen.com/checkoutshopper/checkoutPaymentRedirect?redirectData=X6Xtf...",
      "method": "GET",
      "type": "redirect"
    }
    ...
  }

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. Follow the instructions for handling redirects.
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.
threeDS2 The payment qualifies for 3D Secure 2, and will go through either the frictionless or the challenge flow. Follow our 3D Secure 2 integration guides:
action.type Description Next steps
redirect The shopper is redirected to another website or app to complete the payment. Follow the instructions for handling redirects.
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. Follow our 3D Secure 2 integration guides:
threeDS2Challenge The payment qualifies for 3D Secure 2, and the issuer is initiating a challenge flow. Follow our 3D Secure 2 integration guides:

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": "2021-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": "Pending",
    "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, or if your shopper went through the native 3D Secure 2 flow, use the /payments/details endpoint to complete the payment.

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

  • details: Pass either URL-decoded redirectResult from when the shopper returned to your website, or the threeDSResult from the 3D Secure 2 Component.

The following example shows how you would submit additional payment details after a redirect:

/payments/details request
curl https://checkout-test.adyen.com/v67/payments/details \
-H "x-API-key: YOUR_X-API-KEY" \
-H "content-type: application/json" \
-d '{
     "details": {
       "redirectResult": "eyJ0cmFuc1N0YXR1cyI6IlkifQ=="
   }
}'

The response includes:

  • pspReference: Our unique identifier for the transaction.
  • resultCode: Indicates the status of the payment. Use this to present the payment result to your shopper in step 6.
Successful payment response
{
"pspReference": "88154795347618C",
"resultCode": "Authorised"
}

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 action.paymentData from your last API response.

The following example shows how you would submit additional payment details after a redirect:

curl https://checkout-test.adyen.com/v66/payments/details \
-H "x-API-key: YOUR_X-API-KEY" \
-H "content-type: application/json" \
-d '{
     "paymentData":"Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...",
     "details":{
       "redirectResult":"X6XtfGC3!Y..."
     }
}'
require 'adyen-ruby-api-library'

# Set your X-API-KEY with the API key from the Customer Area.
adyen = Adyen::Client.new
adyen.env = :test
adyen.api_key = "YOUR_X-API-KEY"

response = adyen.checkout.payments.details({ 
  :paymentData => 'Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...',
  :details => {
    :redirectResult => 'Ab02b4c0!BQABAgCW5sxB4e/=='
  }
})
// Set your X-API-KEY with the API key from the Customer Area.
String xApiKey = "YOUR_X-API-KEY";
Client client = new Client(xApiKey,Environment.TEST);
Checkout checkout = new Checkout(client);
paymentsDetailsRequest paymentsDetailsRequest = new paymentsDetailsRequest();
HashMap<String, String> details = new HashMap<>();
details.put("redirectResult", "Ab02b4c0!BQABAgCW5sxB4e/==...");
paymentsDetailsRequest.setDetails(details);
paymentsDetailsRequest.setPaymentData("Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...");
PaymentsResponse paymentsDetailsResponse = checkout.paymentsDetails(paymentsDetailsRequest);
// Set your X-API-KEY with the API key from the Customer Area.
$client = new \Adyen\Client();
$client->setEnvironment(\Adyen\Environment::TEST);
$client->setXApiKey("YOUR_X-API-KEY");
$service = new \Adyen\Service\Checkout($client);

$params = array(
  "paymentData" => "Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...",
  "details" => array(
    "redirectResult" => "Ab02b4c0!BQABAgCW5sxB4e/==..."
  )
);
$result = $service->paymentsDetails($params);
# Set your X-API-KEY with the API key from the Customer Area.
adyen = Adyen.Adyen()
adyen.payment.client.platform = "test"
adyen.client.xapikey = 'YOUR_X-API-KEY'

result = adyen.checkout.payments_details({
   'paymentData' : 'Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...',
   'details': {
      'redirectResult': 'Ab02b4c0!BQABAgCW5sxB4e/=='
   }
})
// Set your X-API-KEY with the API key from the Customer Area.
string apiKey = "YOUR_X-API-KEY";
var client = new Client (apiKey, Environment.Test);
var checkout = new Checkout(client);
var details = new Dictionary<string, string>
{
  { "redirectResult", "Ab02b4c0!BQABAgCW5sxB4e/==..." }
};
var paymentsDetailsRequest = new Adyen.Model.Checkout.PaymentsDetailsRequest(Details: details);
var paymentsDetailsResponse = checkout.PaymentsDetails(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 = '[YOUR_X-API-KEY]';
const client = new Client({ config });
client.setEnvironment("TEST");
const checkout = new CheckoutAPI(client);
checkout.paymentsDetails({ 
    details: { redirectResult: "Ab02b4c0!BQABAgCW5sxB4e/==" },
    paymentData: "Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...",
}).then(res => res);
import (
    "github.com/adyen/adyen-go-api-library/v5/src/checkout"
    "github.com/adyen/adyen-go-api-library/v5/src/common"
    "github.com/adyen/adyen-go-api-library/v5/src/adyen"
)
// Set your X-API-KEY with the API key from the Customer Area.
client := adyen.NewClient(&common.Config{
    Environment: common.TestEnv,
    ApiKey:      "[YOUR_X-API-KEY]",
})
req := checkout.DetailsRequest{
PaymentData: "Ab02b4c0!BQABAgAKspbjN8+5...",
    Details: map[string]interface{}{
        "redirectResult":    "Ab02b4c0!BQABF...",
    },
res, httpRes, err := client.Checkout.PaymentsDetails(&req)

Depending on the payment result, you 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, you need to perform step 4 again.

If the /payments/details response does not contain an action object, proceed to step 6 to present the payment result to your shopper.

Successful payment response
{
 "pspReference": "88154795347618C",
 "resultCode": "Authorised"
}

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

Próximos passos