Try it out!
Visit our demo webshop. To see which payment methods are available in a country, select the country at the bottom of the page.
For code samples, see our GitHub repository and other sample projects.
Drop-in is our all-in-one UI solution for accepting payments on your website using a single front-end implementation. Use Drop-in if you want a quick way to start accepting payments on your website, with little to no customization.
Drop-in is also available on iOS and Android. For an overview of all integration options and available features, refer to Online payments.
Supported payment methods
Drop-in readily supports cards, wallets, and most local payment methods. For a list of supported payment methods, refer to Supported payment methods.
Adding new payment methods usually requires no additional implementation effort, however some payment methods require additional configuration. For more information, refer to our payment method integration guides.
We're actively adding payment methods to Drop-in. To check the latest on Drop-in, see our release notes.
How it works
The following flow applies for each payment method supported in Drop-in:
On this page we describe both server-side and client-side integration steps:
- From your server, submit a request to get a list of payment methods available to the shopper.
- Create an instance of Drop-in on your payments form.
- From your server, submit a payment request with data you receive from Drop-in.
- Determine from the response if you need to perform additional actions on your front end.
- From your server, submit additional payment details with data you receive from Drop-in.
- Present the payment result to the shopper.
When you have completed the integration, proceed to test your integration.
Before you begin
If you haven't done so already, follow our Get started guide to set up your test account, get your API key, and install a server-side library.
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.
From your server, make a POST /paymentMethods request, specifying:
Parameter name | Required | Description |
---|---|---|
merchantAccount |
![]() |
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; use Web. 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 |
By default, the shopperlocale is set to en-US. To change the language, set this to the shopper's language and country code. You also need to set the same locale within your Drop-in configuration. |
You can also include other optional parameters, for example allowedPaymentMethods or blockedPaymentMethods to customize which payment methods will be shown to the shopper.
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
:
Pass the response to your front end. You'll use this in the next step to show which payment methods are available for the shopper.
Step 2: Add Drop-in to your payments form
Next, use Drop-in to show the available payment methods, and to collect payment details from your shopper. Install the Adyen Web Node package or use a <script>
tag.
-
Install the Adyen Web Node package:
npm install @adyen/adyen-web --save
To update to the latest version of the Adyen Web package, download it and run
npm update
. -
Import Adyen Web into your application:
import AdyenCheckout from '@adyen/adyen-web'; import '@adyen/adyen-web/dist/adyen.css';
-
Include the following script in the
<body>
above any other JavaScript in your checkout page:We recommend that you also validate the Subresource Integrity (SRI) hash, which we provide for our JavaScript and CSS files.
<script src="https://checkoutshopper-test.adyen.com/checkoutshopper/sdk/3.21.1/adyen.js" integrity="sha384-qgB03MgLihAbvkTmWIkmZxFUxyAqJ4Ozk1My6beIRqit6+8e5HFg8ysln5y5FSw0" crossorigin="anonymous"></script> <!-- Adyen provides the SRI hash that you include as the integrity attribute. Refer to our release notes to get the SRI hash for the specific version. https://docs.adyen.com/online-payments/release-notes -->
-
Use the following CSS file:
<link rel="stylesheet" href="https://checkoutshopper-test.adyen.com/checkoutshopper/sdk/3.21.1/adyen.css" integrity="sha384-KM3xJKzswGJ0xqiPCOHrWUtn0i0LHqEngauvYxSfy0eRtqcImL7ArxjV2HVgeRJ/" crossorigin="anonymous"> <!-- Adyen provides the SRI hash that you include as the integrity attribute. Refer to our release notes to get the SRI hash for the specific version. https://docs.adyen.com/online-payments/release-notes -->
You can add your own styling by overriding the rules in this CSS file.
-
Create a DOM element on your checkout page, placing it where you want Drop-in to be rendered on the page.
<div id="dropin-container"></div>
If you are using JavaScript frameworks such as Vue or React, make sure that you use references instead of selectors and that you don't re-render the DOM element.
-
Create a
configuration
object with the following parameters:Parameter name Required Description paymentMethodsResponse
The full /paymentMethods
response returned in step 1.clientKey
A public key linked to your API credential, used for client-side authentication.
Web Drop-in versions before 3.10.1 useoriginKey
instead. Find out how to migrate from usingoriginKey
toclientKey
.locale
The shopper's locale. This is used to set the language rendered in the UI. For a list of supported locales, see Language and localization. environment
Use test. When you're ready to accept live payments, change the value to one of our live environments. onSubmit(state, dropin)
Create an event handler, called when the shopper selects the Pay button and payment details are valid. onChange(state, dropin)
Create an event handler, called when the shopper provides the required payment details. onAdditionalDetails(state, dropin)
Create an event handler, called when a payment method requires more details, for example for native 3D Secure 2, or native QR code payment methods. onError(error)
Create an event handler, called when an error occurs in Drop-in. paymentMethodsConfiguration
Required or optional configuration for specific payment methods. For more information, refer to our payment method guides. allowPaymentMethods
Array of payment methods to be presented to the shopper. To refer to payment methods, use their paymentMethod.type
from Payment methods overview.removePaymentMethods
Array of payment methods to be hidden from the shopper. To refer to payment methods, use their paymentMethod.type
from Payment methods overview.amount
Amount to be displayed on the Pay Button. It expects an object with the value and currency properties. For example, { value: 1000, currency: 'USD' }
.const configuration = { paymentMethodsResponse: paymentMethodsResponse, // The `/paymentMethods` response from the server. clientKey: "YOUR_CLIENT_KEY", // Web Drop-in versions before 3.10.1 use originKey instead of clientKey. locale: "en-US", environment: "test", onSubmit: (state, dropin) => { // Your function calling your server to make the `/payments` request makePayment(state.data) .then(response => { if (response.action) { // Drop-in handles the action object from the /payments response dropin.handleAction(response.action); } else { // Your function to show the final result to the shopper showFinalResult(response); } }) .catch(error => { throw Error(error); }); }, onAdditionalDetails: (state, dropin) => { // Your function calling your server to make a `/payments/details` request makeDetailsCall(state.data) .then(response => { if (response.action) { // Drop-in handles the action object from the /payments response dropin.handleAction(response.action); } else { // Your function to show the final result to the shopper showFinalResult(response); } }) .catch(error => { throw Error(error); }); }, paymentMethodsConfiguration: { card: { // Example optional configuration for Cards hasHolderName: true, holderNameRequired: true, enableStoreDetails: true, hideCVC: false, // Change this to true to hide the CVC field for stored cards name: 'Credit or debit card' } } };
-
Use the
configuration
object to create an instance ofAdyenCheckout
. Then use the returned value to create and mount the instance of Drop-in:const checkout = new AdyenCheckout(configuration); const dropin = checkout.create('dropin').mount('#dropin-container');
When the shopper selects the Pay button, Drop-in calls the
onSubmit
event, which contains astate.data
. These are the shopper details that you need to make the payment. -
Pass the
state.data
to your server.{ isValid: true, data: { paymentMethod: { type: "scheme", encryptedCardNumber: "adyenjs_0_1_18$k7s65M5V0KdPxTErhBIPoMPI8HlC..", encryptedExpiryMonth: "adyenjs_0_1_18$p2OZxW2XmwAA8C1Avxm3G9UB6e4..", encryptedExpiryYear: "adyenjs_0_1_18$CkCOLYZsdqpxGjrALWHj3QoGHqe+..", encryptedSecurityCode: "adyenjs_0_1_18$XUyMJyHebrra/TpSda9fha978+.." holderName: "S. Hopper" } } }
Configuring Drop-in
You can include the following additional configuration when instantiating Drop-in on your payments form:
Configuration object | Description |
---|---|
openFirstPaymentMethod |
When enabled, Drop-in opens the first payment method automatically on page load. Defaults to true. |
openFirstStoredPaymentMethod |
When enabled, Drop-in opens the payment method with stored card details on page load. This option takes precedence over openFirstPaymentMethod . Defaults to true. |
showStoredPaymentMethods |
Shows or hides payment methods with stored card details. Defaults to true. |
showRemovePaymentMethodButton |
Allows the shopper to remove a stored payment method. Defaults to false. |
showPaymentMethods |
Shows or hides regular (not stored) payment methods. Set to false if you only want to show payment methods with stored card details. Defaults to true. |
showPayButton |
Show or hides a Pay Button for each payment method. Defaults to true. The Pay button triggers the onSubmit event when payment details are valid. If you want to disable the button and then trigger the submit flow on your own, set this to false and call the .submit() method from your own button implementation. For example, dropin.submit() Note that PayPal Smart Payment Buttons doesn't support the .submit() method. |
Events
Use the following events to include additional logic on your checkout page:
Event name | Description |
---|---|
onReady() |
Called when Drop-in is initialized and is ready for use. |
onSelect(component) |
Called when the shopper selects a payment method. |
onDisableStoredPaymentMethod(storedPaymentMethodId, resolve, reject) |
Called when a shopper removes a stored payment method. To remove the selected payment method, make a /disable request using the storedPaymentMethodId . Then call either resolve() or reject() , depending on the /disable response. |
Step 3: Make a payment
After the shopper selects the Pay button 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 POST /payments request specifying:
Parameter name | Required | Description |
---|---|---|
merchantAccount |
![]() |
Your merchant account name. |
amount |
![]() |
The currency and value of the payment (in minor units). For more information, see Currency codes. |
reference |
![]() |
Your unique reference for this payment. |
paymentMethod |
![]() |
The state.data.paymentMethod from the onSubmit event from your front end. |
returnUrl |
![]() |
URL to where the shopper should be taken back to after a redirection. The URL can contain a maximum of 1024 characters and should include the protocol: http:// or https:// . You can also include your own additional query parameters, for example, shopper ID or order reference number. |
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 payment request for 10 EUR:
curl https://checkout-test.adyen.com/v66/payments \
-H "x-API-key: YOUR_X-API-KEY" \
-H "content-type: application/json" \
-d '{
"amount":{
"currency":"EUR",
"value":1000
},
"reference":"YOUR_ORDER_NUMBER",
"paymentMethod":{hint:paymentMethod field of an object passed from the front end or client app}STATE_DATA{/hint},
"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.env = :test
adyen.api_key = "YOUR_X-API-KEY"
# STATE_DATA is the paymentMethod field of an object passed from the front end or client app, deserialized from JSON to a data structure.
paymentMethod = STATE_DATA
response = adyen.checkout.payments({
:merchantAccount => 'YOUR_MERCHANT_ACCOUNT',
:paymentMethod => paymentMethod,
:amount => {
:currency => 'EUR',
:value => 1000
},
:reference => "YOUR_ORDER_NUMBER",
:returnUrl => "https://your-company.com/checkout?shopperOrder=12xy.."
})
# Check if further action is needed.
if response.body.has_key(:action)
# Pass the action object to your front end
# response.body[:action]
else
# No further action needed, pass the resultCode object to your front end
# response.body[:resultCode]
// Set your X-API-KEY with the API key from the Customer Area.
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");
// STATE_DATA is the paymentMethod field of an object passed from the front end or client app, deserialized from JSON to a data structure.
paymentsRequest.setPaymentMethod(STATE_DATA)
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);
// STATE_DATA is the paymentMethod field of an object passed from the front end or client app, deserialized from JSON to a data structure.
$paymentMethod = STATE_DATA;
$params = array(
"merchantAccount" => "YOUR_MERCHANT_ACCOUNT",
"paymentMethod" => $paymentMethod,
"amount" => array(
"currency" => "EUR",
"value" => 1000
),
"reference" => "YOUR_ORDER_NUMBER",
"returnUrl" => "https://your-company.com/checkout?shopperOrder=12xy.."
);
$result = $service->payments($params);
// Check if further action is needed
if (array_key_exists("action", $result)){
// Pass the action object to your front end
// $result["action"]
}
else {
// No further action needed, pass the resultCode to your front end
// $result['resultCode']
}
# Set your X-API-KEY with the API key from the Customer Area.
adyen = Adyen.Adyen()
adyen.payment.client.platform = "test"
adyen.client.xapikey = 'YOUR_X-API-KEY'
# STATE_DATA is the paymentMethod field of an object passed from the front end or client app, deserialized from JSON to a data structure.
paymentMethod = STATE_DATA
result = adyen.checkout.payments({
'merchantAccount': 'YOUR_MERCHANT_ACCOUNT',
'paymentMethod': paymentMethod,
'amount': {
'value': 1000,
'currency': 'EUR'
},
'reference': 'YOUR_ORDER_NUMBER',
'returnUrl': 'https://your-company.com/checkout?shopperOrder=12xy..'
})
# Check if further action is needed
if 'action' in result.message:
# Pass the action object to your front end
# result.message['action']
else:
# No further action needed, pass the resultCode to your front end
# result.message['resultCode']
// Set your X-API-KEY with the API key from the Customer Area.
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 paymentRequest = new Adyen.Model.Checkout.PaymentRequest
{
// STATE_DATA is the paymentMethod field of an object passed from the front end or client app, deserialized from JSON to a data structure.
PaymentMethod = STATE_DATA,
Amount = amount,
Reference = "YOUR_ORDER_NUMBER",
ReturnUrl = @"https://your-company.com/checkout?shopperOrder=12xy.."
};
var paymentResponse = checkout.Payment(paymentRequest);
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,
// STATE_DATA is the paymentMethod field of an object passed from the front end or client app, deserialized from JSON to a data structure.
paymentMethod: STATE_DATA,
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]",
})
// STATE_DATA is the paymentMethod field of an object passed from the front end or client app, deserialized from JSON to a data structure.
paymentMethod := STATE_DATA
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 and action.type redirect |
The shopper is redirected to another website or app to complete the payment. | 1. Check the /payments response to know what parameters to expect when the shopper returns to your website. 2. Store the action.paymentData in your server. You'll need this in your next API request.3. Pass the action object to your front end. Drop-in uses this to handle the required action. 4. Proceed to step 4. |
With action object |
The shopper needs to do additional actions to complete the payment. | 1. Pass the action object to your front end. Drop-in uses this to handle the required action. 2. 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 |
The shopper needs to do additional actions to complete the payment. | 1. Pass the action object to your front end. Drop-in uses this to handle the required action. 2. Proceed to step 4. |
The following example shows the /payments response for iDEAL, a redirect payment method.
Step 4: Perform additional front-end actions
Some payment methods require additional action from the shopper such as: to scan a QR code, to authenticate a payment with 3D Secure, or to log in to their bank's website to complete the payment.
To handle these additional front-end actions, Drop-in uses the dropin.handleAction
function depending on the action.type
. You should also use the action.type
to determine your next steps.
action.type |
Description | Next steps |
---|---|---|
voucher | Drop-in displays the voucher which the shopper uses to complete the payment. |
1. Proceed to step 6 and inform the shopper that you are waiting for the payment. 2. Wait for the notification webhook to know the payment result. |
redirect | Drop-in redirects the shopper to another website or app to complete the payment. | 1. When the shopper returns to your website, your server needs to handle the redirect result. 2. Proceed to step 5 to check the payment result. |
qrCode | Drop-in presents the QR code and calls the onAdditionalDetails event. |
1. Get the state.data from the onAdditionalDetails event and pass it your server. 2. Proceed to step 5 to check the payment result. |
await | Drop-in shows the waiting screen while the shopper completes the payment. Depending on the payment outcome, Drop-in calls the onAdditionalDetails or onError event. |
1. Get the state.data object from the onAdditionalDetails or onError event and pass it your server. 2. Proceed to step 5 to check the payment result. |
sdk | Drop-in presents the specific payment method's UI as an overlay and calls the onAdditionalDetails event. |
1. Get the state.data from the onAdditionalDetails event and pass it your server. 2. Proceed to step 5 to check the payment result. |
threeDS2Fingerprint | The payment qualifies for 3D Secure 2, and will go through either the frictionless or the challenge flow. Drop-in performs the authentication flow, and calls the onAdditionalDetails event. |
1. Get the state.data from the onAdditionalDetails event and pass it your server. 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. Drop-in performs the authentication flow, and calls the onAdditionalDetails event. |
1. Get the state.data from the onAdditionalDetails event and pass it your server. 2. Proceed to step 5 to complete the payment. |
Handle the redirect result
If you receive an action.type
redirect, Drop-in redirects your shopper to another website to complete the payment.
The redirect result depends on whether it's for a redirect payment method, or for 3D Secure authentication.
Redirect payment method
The shopper is redirected back to your returnUrl
with an HTTP GET. The returnUrl
is appended with a Base64-encoded redirectResult
:
GET /?shopperOrder=12xy..&&redirectResult=X6XtfGC3%21Y... HTTP/1.1
Host: www.your-company.com/checkout
- URL-decode the
redirectResult
and pass it to your back end. - Proceed to step 5.
If a shopper completed the payment but failed to return to your website, wait for the notification webhook to know the payment result.
3D Secure authentication
The shopper is redirected back to your returnUrl
with an HTTP POST. This will be appended with the MD
and PaRes
variables.
POST / HTTP/1.1
Host: www.your-company.com/checkout?shopperOrder=12xy..
Content-Type: application/x-www-form-urlencoded
MD=Ab02b4c0%21BQABAgCW5sxB4e%2F%3D%3D..&PaRes=eNrNV0mTo7gS..
- URL-decode the
MD
andPaRes
parameters, and pass these to your back end. - Proceed to step 5.
If a shopper completed the payment but failed to return to your website, wait for the notification webhook to know the payment result.
action.type |
Description | Next steps |
---|---|---|
voucher | Drop-in displays the voucher which the shopper uses to complete the payment. |
1. Proceed to step 6 and inform the shopper that you are waiting for the payment. 2. Wait for the notification webhook to know the payment result. |
redirect | Drop-in redirects the shopper to another website or app to complete the payment. | 1. When the shopper returns to your website, your server needs to handle the redirect result. 2. Proceed to step 5 to check the payment result. |
qrCode | Drop-in presents the QR code and calls the onAdditionalDetails event. |
1. Get the state.data from the onAdditionalDetails event and pass it your server. 2. Proceed to step 5 to check the payment result. |
await | Drop-in shows the waiting screen while the shopper completes the payment. Depending on the payment outcome, Drop-in calls the onAdditionalDetails or onError event. |
1. Get the state.data object from the onAdditionalDetails or onError event and pass it your server. 2. Proceed to step 5 to check the payment result. |
sdk | Drop-in presents the specific payment method's UI as an overlay and calls the onAdditionalDetails event. |
1. Get the state.data from the onAdditionalDetails event and pass it your server. 2. Proceed to step 5 to check the payment result. |
threeDS2 | The payment qualifies for 3D Secure 2, and will go through the authentication flow. Drop-in performs the authentication flow, and calls the onAdditionalDetails event. |
1. Get the state.data from the onAdditionalDetails event and pass it your server. 2. Proceed to step 5 to complete the payment. |
Handle the redirect result
If you receive an action.type
redirect, Drop-in redirects your shopper to another website to complete the payment.
After completing the payment, the shopper is redirected back to your returnUrl
with an HTTP GET. The returnUrl
is appended with a Base64-encoded redirectResult
:
GET /?shopperOrder=12xy..&&redirectResult=X6XtfGC3%21Y... HTTP/1.1
Host: www.your-company.com/checkout
- URL-decode the
redirectResult
and pass it to your back end. - Proceed to step 5.
If a shopper completed the payment but failed to return to your website, wait for the notification webhook to know the payment result.
Step 5: Submit additional payment details
If the shopper performed additional action, you need to submit additional payment details to either complete the payment, or to check the payment result.
Make a /payments/details request, and include:
-
For
action.type
: redirect, pass in your request:details
: The URL-decoded parameters you received when the shopper was redirected back to your website.paymentData
: The value from the/payments
response that you stored in your server.
- For
action.type
: qrCode, await, sdk, threeDS2Fingerprint, or threeDS2Challenge, pass in your request thestate.data
from theonAdditionalDetails
event.
The example below shows how you would submit additional payment details in case you received an onAdditionalDetails
event.
curl https://checkout-test.adyen.com/v66/payments/details \
-H "x-API-key: YOUR_X-API-KEY" \
-H "content-type: application/json" \
-d '{hint:object passed from the front end or client app}STATE_DATA{/hint}'
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"
# STATE_DATA is an object passed from the front end or client app, deserialized from JSON to a data structure.
request = STATE_DATA
response = adyen.checkout.payments.details(request)
# Check if further action is needed.
if response.body.has_key(:action)
# Pass the action object to your frontend
puts response.body[:action]
else
# No further action needed, pass the resultCode to your frontend
puts response.body[:resultCode]
end
// Set your X-API-KEY with the API key from the Customer Area.
String xApiKey = "YOUR_X-API-KEY";
Client client = new Client(xApiKey,Environment.TEST);
Checkout checkout = new Checkout(client);
// STATE_DATA is an object passed from the front end or client app, deserialized from JSON to a data structure.
PaymentsDetailsRequest paymentsDetailsRequest = STATE_DATA;
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);
// STATE_DATA is an object passed from the front end or client app, deserialized from JSON to a data structure.
$params = STATE_DATA;
$result = $service->paymentsDetails($params);
// Check if further action is needed
if (array_key_exists("action", $result)){
// Pass the action object to your frontend.
// $result["action"]
}
else {
// No further action needed, pass the resultCode to your front end
// $result['resultCode']
}
# Set your X-API-KEY with the API key from the Customer Area.
adyen = Adyen.Adyen()
adyen.payment.client.platform = "test"
adyen.client.xapikey = 'YOUR_X-API-KEY'
# STATE_DATA is an object passed from the front end or client app, deserialized from JSON to a data structure.
request = STATE_DATA
result = adyen.checkout.payments_details(request)
# Check if further action is needed.
if 'action' in result.message:
# Pass the action object to your front end
# result.message['action']
else:
# No further action needed, pass the resultCode to your front end
# result.message['resultCode']
// Set your X-API-KEY with the API key from the Customer Area.
string apiKey = "YOUR_X-API-KEY";
var client = new Client (apiKey, Environment.Test);
var checkout = new Checkout(client);
// STATE_DATA is an object passed from the front end or client app, deserialized from JSON to a data structure.
var paymentsDetailsRequest = STATE_DATA;
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);
// STATE_DATA is an object passed from the front end or client app, deserialized from JSON to a data structure.
checkout.paymentsDetails(STATE_DATA).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]",
})
// STATE_DATA is an object passed from the front end or client app, deserialized from JSON to a data structure.
req := STATE_DATA;
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.
Make a /payments/details request, and include:
- For
action.type
: redirect, pass in your request:details
: Object that contains the URL-decodedredirectResult
.
- For
action.type
: qrCode, await, sdk, or threeDS2, pass in your request thestate.data
from theonAdditionalDetails
event.
The following example shows how you would submit additional payment details in case of a redirect.
The response includes:
pspReference
: Our unique identifier for the transaction.-
resultCode
: Indicates the status of the payment. You can use this to present the payment result to your shopper in step 6.
Step 6: Present the payment result
After the shopper completes the payment and no further actions are required on the front end, use the resultCode
to inform the shopper of the payment status.
resultCode | Description | Action to take |
---|---|---|
Authorised | The payment was successful. | Inform the shopper that the payment was successful. |
Error | Inform the shopper that there was an error processing their payment. | You'll receive a refusalReason in the same response, indicating the cause of the error. |
Pending | The shopper has completed the payment but the final result is not yet known. | Inform the shopper that you've received their order, and are waiting for the payment to be completed. You will receive the final result of the payment in an AUTHORISATION notification. |
PresentToShopper | Present the voucher or the QR code to the shopper. | 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 | The payment was refused. | Inform the shopper that the payment was refused. Ask the shopper to try the payment again using a different payment method or card. |
Received | For some payment methods, it can take some time before the final status of the payment is known. | Inform the shopper that you've received their order, and are waiting for the payment to clear. You will receive the final result of the payment in an AUTHORISATION notification. |
For other possible resultCode
values and recommended messages that you can present to your shopper, see Result codes.
Alternatively, you can use the dropin.setStatus
to show a customized message. For example:
// Show a success message
dropin.setStatus('success');
dropin.setStatus('success', { message: 'Payment successful!' });
// Show an error message
dropin.setStatus('error');
dropin.setStatus('error', { message: 'Something went wrong.'});
// Set a loading state
dropin.setStatus('loading'); // start the loading state
dropin.setStatus('ready'); // set back to the initial state
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.
- Configure your live account.
- Submit a request to add payment methods in your live Customer Area .
- Switch from test to our live endpoints.
-
Load Drop-in from one of our live environments closest to where your shoppers are. Set the
environment
configuration object to:- Europe: live
- Australia: live-au
- US: live-us