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:
- If you want to accept payments using raw card data, confirm with your Adyen Account Manager that you're eligible to use this option.
- 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:
- From your server, submit a request to get a list of payment methods available to the shopper.
- Present your payment form and collect your shopper's payment details.
- From your server, submit a payment request with the data you have collected from the shopper.
- 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.
- From your server, submit additional payment details.
- 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.
-
From your server, make a POST /paymentMethods request, specifying:
Parameter name Required Description merchantAccount
Your merchant account name. amount
The currency
andvalue
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/v66/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({ :merchantAccount => 'YOUR_MERCHANT_ACCOUNT', :countryCode => 'NL', :shopperLocale => 'nl-NL', :amount => { :currency => 'EUR', :value => 1000 }, :channel => 'Web' }) # Pass the response to your front end
// 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( "merchantAccount" => "YOUR_MERCHANT_ACCOUNT", "countryCode" => "NL", "shopperLocale" => "nl-NL", "amount" => array( "currency" => "EUR", "value" => 1000 ), "channel" => "Web" ); $result = $service->paymentMethods($params); // Pass the response to your front end
# 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 = { 'merchantAccount': 'YOUR_MERCHANT_ACCOUNT', 'countryCode': 'NL', 'shopperLocale': 'nl-NL', 'amount': { 'value': 1000, 'currency': 'EUR' }, 'channel': 'Web' } response = adyen.checkout.payment_methods(request) # Pass the response to your front end
// 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); // Pass the response to your front end
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); // Pass the response to your front end
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{ Environment: common.TestEnv, ApiKey: "[YOUR_X-API-KEY]", }) res, httpRes, err := client.Checkout.PaymentMethods(&checkout.PaymentMethodsRequest{ MerchantAccount: "[YOUR_MERCHANT_ACCOUNT]", CountryCode: "NL", ShopperLocale: "nl-NL", Amount: checkout.Amount{ Value: 1000, Currency: "EUR", }, Channel: "Web", }) // Pass the response to your front end
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" }, { ... } ] }
-
Get the required fields for each payment method from the
details
array. If a payment method does not have adetails
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 eachname
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, thedetails.type
property indicates that you need text fields to collect the followingdetails.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" } ] }
- 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:
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:
- Use a custom card integration to encrypt your shopper's card data.
- Collect your shopper's raw card data, if you have confirmed with us that you're eligible to use this option.
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 |
![]() |
Your merchant account name. |
amount |
![]() |
The currency and value of the payment, in minor units. |
reference |
![]() |
Your unique reference for this payment. |
paymentMethod.type |
![]() |
The type of this payment method from the
/paymentMethods
response. |
paymentMethod |
![]() |
The shopper details that you collected in the previous step. |
returnUrl |
![]() |
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:
- Integrate some payment methods. For more information, refer to our payment method integration guides.
- Make use of our risk management features. For more information, see Required risk fields.
- Use native 3D Secure 2 authentication.
- Tokenize your shopper's payment details or make recurring payments.
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/v66/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({
: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.."
})
// 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(
"merchantAccount" => "YOUR_MERCHANT_ACCOUNT",
"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.."
);
$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({
'merchantAccount': 'YOUR_MERCHANT_ACCOUNT',
'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..'
})
// 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',
encryptedSecurityCode: "test_4111111111111111",
encryptedExpiryMonth: "test_03",
encryptedExpiryYear: "test_2030",
encryptedCardNumber: "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/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{
Environment: common.TestEnv,
ApiKey: "[YOUR_X-API-KEY]",
})
paymentMethod := map[string]interface{}{
"type": "scheme",
"encryptedSecurityCode": "test_4111111111111111",
"encryptedExpiryMonth": "test_03",
"encryptedExpiryYear": "test_2030",
"encryptedCardNumber": "test_737",
},
res, httpRes, err := client.Checkout.Payments(&checkout.PaymentRequest{
MerchantAccount: "[YOUR_MERCHANT_ACCOUNT]",
PaymentMethod: paymentMethod,
Amount: checkout.Amount{
Value: 1000,
Currency: "EUR",
},
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. 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. 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.
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.
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. |
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: |
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. |
threeDS | 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: |
Additional actions
If you get a voucher action.type
:
-
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" } }
- 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
:
-
Get the
qrCodeData
from theaction
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" } ... }
- Present the QR code on your checkout page.
- After the shopper scans the QR code and completes the payment, we'll send a notification webhook informing you of the payment result.
- 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
: This object should contain thedetails.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 theaction.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 => 'X6XtfGC3!Y...'
}
})
// 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);
PaymentsDetails paymentsDetails = new PaymentsDetails();
HashMap<String, String> details = new HashMap<>();
details.put("redirectResult", "X6XtfGC3!Y...");
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" => "X6XtfGC3!Y..."
)
);
$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': 'X6XtfGC3!Y...'
}
})
// 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", "X6XtfGC3!Y..." }
};
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: "X6XtfGC3!Y..." },
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{
Environment: common.TestEnv,
ApiKey: "[YOUR_X-API-KEY]",
})
req := checkout.DetailsRequest{
PaymentData: "Ab02b4c0!BQABAgAKspbjN8+5...",
Details: map[string]interface{}{
"redirectResult": "X6XtfGC3!Y...",
},
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.
From your server, make a POST /payments/details request specifying:
details
: Pass either URL-decodedredirectResult
from when the shopper returned to your website, or thethreeDSResult
from the 3D Secure 2 Component.
The following example shows how you would submit additional payment details after a redirect:
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.
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 Transactions > Payments.
When you are ready to go live, you need to:
- Apply for a live account.
- Assess your PCI DSS compliance by submitting:
- the Self-Assessment Questionnaire-A, if you're using the Custom Card Component.
- the Self-Assessment Questionnaire-D, if you're submitting raw card data.
- Configure your live account.
- Submit a request to add payment methods in your live Customer Area .
- Switch from test to our live endpoints.