Use our APIs to accept cards with 3D Secure authentication through a redirect page. When adding card payments with redirect 3D Secure authentication to your integration, you additionally need to:
- Collect the additional parameters in your payment form.
- Provide the required 3D Secure parameters when making a payment request.
- Handle the redirect.
Before you begin
Before starting your integration:
- If building a mobile integration, contact our Support Team to make sure that 3D Secure is triggered in your app.
- Make sure that you have integrated our Card Component for Web, iOS, or Android or built you own UI for collecting shopper's card details.
- If you are using 3D Secure for PSD2 compliance, read our comprehensive PSD2 SCA guide.
Collect additional parameters in your payment form
For higher authentication rates, we strongly recommend that you collect the card holder name, the shopper billing address and email address in advance in your payment form. Deliver these parameters to your backend when making a payment as they are required by the card schemes.
Collect card holder name in your payment form
If you are using our client-side integrations, select the integration below:
If you are using our Card Component, include the following when creating an instance of the Card Component:
hasHolderName
: true. This shows the input field for the card holder name.holderNameRequired
: true. This makes the card holder name a required field.
const card = checkout.create("card", {
hasHolderName: true,
holderNameRequired: true
}).mount("#card-container");
To collect the card holder name using our Card Component, specify the following when adding the Card Component:
showsHolderNameField
: true
let cardComponent = CardComponent(paymentMethod: cardPaymentMethod,
publicKey: "YOUR_CSE_PUBLIC_KEY")
cardComponent.showsHolderNameField = true
cardComponent.delegate = self
cardComponent.environment = .test
present(cardComponent.viewController, animated: true)
If you are using our Card Component, set holderNameRequire
to true when creating a cardConfiguration
object:
val cardConfiguration = CardConfiguration.Builder(context, "<publicKey>")
setHolderNameRequire(true)
.build()
Make a payment
Select the channel that you are using below:
To make a card payment with 3D Secure redirect authentication on Web, proceed with the following steps:
-
From your server, make a /payments request, specifying:
Parameter name Required Description paymentMethod
If using the Card Component for Web, pass the parameters returned by the Component. If submitting raw card data, refer to Raw card data for the fields that you need to pass. browserInfo
The shopper's browser information. If using the Web Card Component, pass the state.data.browserInfo
object from theonChange
event.returnUrl
The URL where the shopper will be redirected back to after completing 3D Secure authentication. Get this URL from Drop-in in the RedirectComponent.getReturnUrl(context)
. The return URL can be a maximum of 1024 characters.
The URL should include the protocol:http://
orhttps://
. You can also include your own additional query parameters, for example, shopper ID or order reference number. In the response, you receive a URL that requires a POST request.billingAddress
The cardholder's billing address. shopperEmail
The cardholder's email address. shopperIP
The shopper's IP address. To increase the likelihood of achieving a frictionless flow and higher authorisation rates, we recommend that you send additional parameters.
For
channel
Web, we recommend including these additional parameters:billingAddress
,shopperEmail
, andshopperIP
.A sample /payments request for Web:
curl https://checkout-test.adyen.com/v66/payments \ -H "X-API-key: [Your API Key here]" \ -H "Content-Type: application/json" \ -d '{ "amount":{ "currency":"EUR", "value":1000 }, "reference":"YOUR_ORDER_NUMBER", "shopperReference":"YOUR_UNIQUE_SHOPPER_ID", "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_24$XUyMJyHebrra/TpSda9fha978+..", "holderName":"S. Hopper" }, "{hint:state.data.browserInfo from onChange or onSubmit}browserInfo{/hint}":{ "userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36", "acceptHeader":"text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8", "language":"nl-NL", "colorDepth":24, "screenHeight":723, "screenWidth":1536, "timeZoneOffset":0, "javaEnabled":true }, "{hint:state.data.billingAddress from onSubmit}billingAddress{/hint}": { "street": "Infinite Loop", "houseNumberOrName": "1", "postalCode": "1011DJ", "city": "Amsterdam", "country": "NL" }, "shopperEmail":"s.hopper@example.com", "shopperIP":"192.0.2.1", "channel":"web", "returnUrl":"https://example.com/checkout?shopperOrder=12xy..", "merchantAccount":"YOUR_MERCHANT_ACCOUNT" }'
# Set your X-API-KEY with the API key from the Customer Area. adyen = Adyen::Client.new adyen.env = :test adyen.api_key = "YOUR_X-API-KEY" response = adyen.checkout.payments({ :amount => { :currency => "EUR", :value => 1000 }, :reference => "YOUR_ORDER_NUMBER", :shopperReference => "YOUR_UNIQUE_SHOPPER_ID", :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_24$XUyMJyHebrra/TpSda9fha978+..", :holderName => "S. Hopper" }, :browserInfo => { :userAgent => "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36", :acceptHeader => "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8", :language => "nl-NL", :colorDepth => 24, :screenHeight => 723, :screenWidth => 1536, :timeZoneOffset => 0, :javaEnabled => true }, :billingAddress => { :city => "Amsterdam", :country => "NL", :houseNumberOrName => "1", :postalCode => "1011DJ", :street => "Infinite Loop" }, :shopperEmail => "s.hopper@example.com", :shopperIP => "192.0.2.1", :channel => "web", :returnUrl => "https://example.com/checkout?shopperOrder=12xy..", :merchantAccount => "YOUR_MERCHANT_ACCOUNT" }) # Check if further action is needed. if response.body.has_key(:action) # Pass the action object to your front end # response.body[:action] else # No further action needed, pass the resultCode object to your front end # response.body[:resultCode]
Client client = new Client("YOUR_API_KEY", Environment.TEST); Checkout checkout = new Checkout(client); PaymentsRequest paymentsRequest = new PaymentsRequest(); paymentsRequest.setMerchantAccount("YOUR_MERCHANT_ACCOUNT"); paymentsRequest.setReference("YOUR_ORDER_REFERENCE"); DefaultPaymentMethodDetails paymentMethodDetails = new DefaultPaymentMethodDetails(); paymentMethodDetails.setType("scheme"); paymentMethodDetails.setEncryptedCardNumber("adyenjs_0_1_18$k7s65M5V0KdPxTErhBIPoMPI8HlC.."); paymentMethodDetails.setEncryptedExpiryMonth("adyenjs_0_1_18$p2OZxW2XmwAA8C1Avxm3G9UB6e4.."); paymentMethodDetails.setEncryptedExpiryYear("adyenjs_0_1_18$CkCOLYZsdqpxGjrALWHj3QoGHqe+.."); paymentMethodDetails.setEncryptedSecurityCode("adyenjs_0_1_24$XUyMJyHebrra/TpSda9fha978+.."); paymentMethodDetails.setHolderName("S. Hopper"); paymentsRequest.setPaymentMethod(paymentMethodDetails); Amount amount = new Amount(); amount.setCurrency("EUR"); amount.setValue(1000L); paymentsRequest.setAmount(amount); BrowserInfo browserInfo = new BrowserInfo(); browserInfo.setUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36"); browserInfo.setAcceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"); browserInfo.setLanguage("nl-NL"); browserInfo.setColorDepth(24); browserInfo.setScreenHeight(723); browserInfo.setScreenWidth(1536); browserInfo.setTimeZoneOffset(0); browserInfo.setJavaEnabled(true); paymentsRequest.setBrowserInfo(browserInfo); Address billingAddress = new Address(); billingAddress.setCity("Amsterdam"); billingAddress.setCountry("NL"); billingAddress.setHouseNumberOrName("1"); billingAddress.setPostalCode("1011DJ"); billingAddress.setStreet("Infinite Loop"); paymentsRequest.setBillingAddress(billingAddress); paymentsRequest.setShopperEmail("s.hopper@example.com"); paymentsRequest.setShopperIP("192.0.2.1"); paymentsRequest.setChannel(PaymentsRequest.ChannelEnum.WEB); paymentsRequest.setReturnUrl("https://example.com/checkout?shopperOrder=12xy.."); PaymentsResponse paymentsResponse = checkout.payments(paymentsRequest);
// Set your X-API-KEY with the API key from the Customer Area. $client = new \Adyen\Client(); $client->setXApiKey("YOUR_X-API-KEY"); $service = new \Adyen\Service\Checkout($client); $params = [ "amount" => [ "currency" => "EUR", "value" => 1000 ], "reference" => "YOUR_ORDER_NUMBER", "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_24$XUyMJyHebrra/TpSda9fha978+..", "holderName" => "S. Hopper" ], "browserInfo" => [ "userAgent" => "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36", "acceptHeader" => "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8", "language" => "nl-NL", "colorDepth" => 24, "screenHeight" => 723, "screenWidth" => 1536, "timeZoneOffset" => 0, "javaEnabled" => true ], "billingAddress" => [ "city" => "Amsterdam", "country" => "NL", "houseNumberOrName" => "1", "postalCode" => "1011DJ", "street" => "Infinite Loop" ], "shopperEmail" = "s.hopper@example.com", "shopperIP" => "192.0.2.1", "channel" => "web", "returnUrl" => "https://example.com/checkout?shopperOrder=12xy..", "merchantAccount" => "YOUR_MERCHANT_ACCOUNT" ]; $result = $service->payments($params); // Check if further action is needed if (array_key_exists("action", $result){ // Pass the action object to your front end. // $result["action"] } else { // No further action needed, pass the resultCode to your front end // $result['resultCode'] }
# Set your X-API-KEY with the API key from the Customer Area. adyen = Adyen.Adyen() adyen.client.xapikey = 'YOUR_X-API-KEY' result = adyen.checkout.payments({ "amount": { "currency": "EUR", "value": 1000 }, "reference":"YOUR_ORDER_NUMBER", "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_24$XUyMJyHebrra/TpSda9fha978+..", "holderName": "S. Hopper" }, "browserInfo": { "userAgent": "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36", "acceptHeader": "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8", "language": "nl-NL", "colorDepth": 24, "screenHeight": 723, "screenWidth": 1536, "timeZoneOffset": 0, "javaEnabled": "true" }, "billingAddress": { "street": "Infinite Loop", "houseNumberOrName": "1", "postalCode": "1011DJ", "city": "Amsterdam", "country": "NL" }, "shopperEmail": "s.hopper@example.com", "shopperIP": "192.0.2.1", "channel": "web", "returnUrl": "https://example.com/checkout?shopperOrder=12xy..", "merchantAccount": "YOUR_MERCHANT_ACCOUNT" })
// Set your X-API-KEY with the API key from the Customer Area. var client = new Client ("YOUR-X-API-KEY", Environment.Test); var checkout = new Checkout(client); var paymentRequest = new Adyen.Model.Checkout.PaymentRequest { Amount = new Model.Checkout.Amount(Currency: "EUR", Value: 1000), Reference = "YOUR_ORDER_REFERENCE", PaymentMethod = new DefaultPaymentMethodDetails { EncryptedCardNumber = "adyenjs_0_1_18$k7s65M5V0KdPxTErhBIPoMPI8HlC..", EncryptedExpiryMonth = "adyenjs_0_1_18$p2OZxW2XmwAA8C1Avxm3G9UB6e4..", EncryptedExpiryYear = "adyenjs_0_1_18$CkCOLYZsdqpxGjrALWHj3QoGHqe+..", EncryptedSecurityCode = "adyenjs_0_1_24$XUyMJyHebrra/TpSda9fha978+..", HolderName = "S. Hopper", Type = "scheme" }, BrowserInfo = new Model.Checkout.BrowserInfo { UserAgent = @"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36", AcceptHeader = @"text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8", Language = "nl-NL", ColorDepth = 24, ScreenHeight = 723, ScreenWidth = 1536, TimeZoneOffset = 0, JavaEnabled = true }, BillingAddress = new Model.Checkout.Address { City = "Amsterdam", Country = "NL", HouseNumberOrName = "1", PostalCode = "1011DJ", Street = "Infinite Loop" }, ShopperEmail = "s.hopper@example.com", ShopperIP = "192.0.2.1", Channel = Model.Checkout.PaymentRequest.ChannelEnum.Web, ReturnUrl = "https://example.com/checkout?shopperOrder=12xy..", MerchantAccount = "YOUR_MERCHANT_ACCOUNT" };
// Set your X-API-KEY with the API key from the Customer Area. const {Client, Config, CheckoutAPI} = require('@adyen/api-library'); const config = new Config(); // Set your X-API-KEY with the API key from the Customer Area. config.apiKey = '[API_KEY]'; config.merchantAccount = '[MERCHANT_ACCOUNT]'; const client = new Client({ config }); client.setEnvironment("TEST"); const checkout = new CheckoutAPI(client); checkout.payments({ amount:{ currency: "EUR", value: 1000 }, reference: "YOUR_ORDER_NUMBER", 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_24$XUyMJyHebrra/TpSda9fha978+..", holderName: "S. Hopper" }, browserInfo:{ userAgent: "Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.110 Safari\/537.36", acceptHeader: "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8", language: "nl-NL", colorDepth: 24, screenHeight: 723, screenWidth: 1536, timeZoneOffset: 0, javaEnabled: true }, billingAddress: { city: "Amsterdam", country: "NL", houseNumberOrName: "1", postalCode: "1011DJ", street: "Infinite Loop" }, shopperEmail: "s.hopper@example.com", shopperIP: "192.0.2.1", channel: "web", returnUrl: "https://example.com/checkout?shopperOrder=12xy..", merchantAccount: "YOUR_MERCHANT_ACCOUNT" }).then(res => res);
{ "resultCode":"RedirectShopper", "action":{ "data":{ "MD":"OEVudmZVMUlkWjd0MDNwUWs2bmhSdz09...", "PaReq":"eNpVUttygjAQ/RXbDyAXBYRZ00HpTH3wUosPfe...", "TermUrl":"https://example.com/checkout?shopperOrder=12xy.." }, "method":"POST", "{hint: Store this on your server.}paymentData{/hint}":"Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...", "paymentMethodType":"scheme", "type":"redirect", "url":"https://test.adyen.com/hpp/3d/validate.shtml" }, "details":[ { "key":"MD", "type":"text" }, { "key":"PaRes", "type":"text" } ], ... }
-
Check if the response contains an
action
object. Your next steps depend on whether the /payments response contains anaction
object:Description Next steps No action
objectThe transaction was either exempted or out-of-scope for 3D Secure authentication. Use the resultCode
to present the payment result to your shopper.action
objecttype
:redirectThe payment qualifies for 3D Secure. Continue to Handle the redirect on web.
Handle the redirect on web
To redirect the shopper for 3D Secure authentication:
-
Get the
action.url
and theaction.method
from the /payments response. -
Redirect the shopper to the specified
url
using the HTTP POST, and include the contents of thedata
object in the request. For example:
The shopper is redirected to the issuer page to complete the 3D Secure authentication. In the test environment, this is the page:curl https://test.adyen.com/hpp/3d/validate.shtml \ --data-urlencode 'PaReq=eNpVUttygjAQ/RXbDyAXBYRZ00HpTH3wUosPfe...' \ --data-urlencode 'TermUrl=https://example.com/checkout?shopperOrder=12xy..' \ --data-urlencode 'MD=OEVudmZVMUlkWjd0MDNwUWs2bmhSdz09...'
https://test.adyen.com/hpp/3d/validate.shtml
, and you perform the authentication using the 3D Secure test credentials:- Username: user
- Password: password
returnUrl
with the same HTTP method. This will be appended with theMD
andPaRes
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 the parameters to your server. -
From your server, make a /payments/details request, specifying:
-
paymentData
: Value that you received in the /payments response. -
details
: Object that contains the URL-decodedMD
andPaRes
parameters.
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":{ "MD":"Ab02b4c0!BQABAgCW5sxB4e/==", "PaRes":"eNrNV0mTo7gS.." } }'
# Set your X-API-KEY with the API key from the Customer Area. adyen = Adyen::Client.new adyen.api_key = "YOUR_X-API-KEY" response = adyen.checkout.payments.details({ :paymentData => 'Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...', :details => { :MD => 'Ab02b4c0!BQABAgCW5sxB4e/==..', :PaRes => 'eNrNV0mTo7gS..' } })
// Set your X-API-KEY with the API key from the Customer Area. Client client = new Client(xApiKey,Environment.TEST); Checkout checkout = new Checkout(client); PaymentsDetailsRequest paymentsDetailsRequest = new PaymentsDetailsRequest(); HashMap<String, String> details = new HashMap<>(); details.put("MD", "Ab02b4c0!BQABAgCW5sxB4e/=="); details.put("PaRes", "eNrNV0mTo7gS.."); paymentsDetailsRequest.setDetails(details); paymentsDetailsRequest.setPaymentData("Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj..."); PaymentsResponse paymentsResponse = checkout.paymentsDetails(paymentsDetailsRequest);
// Set your X-API-KEY with the API key from the Customer Area. $client = new \Adyen\Client(); $client->setXApiKey("YOUR_X-API-KEY"); $service = new \Adyen\Service\Checkout($client); $params = array( "paymentData" => "Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...", "details" => array( "MD" => "Ab02b4c0!BQABAgCW5sxB4e/==", "PaRes" => "eNrNV0mTo7gS.." ) ); $result = $service->paymentsDetails($params);
#Set your X-API-KEY with the API key from the Customer Area. adyen = Adyen.Adyen() adyen.client.xapikey = 'YOUR_X-API-KEY' result = adyen.checkout.payments_details({ 'paymentData' : 'Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...', 'details': { 'MD': 'Ab02b4c0!BQABAgCW5sxB4e/==', 'PaRes': "eNrNV0mTo7gS.." } })
// Set your X-API-KEY with the API key from the Customer Area. var client = new Client ("YOUR_X-API-KEY", Environment.Test); var checkout = new Checkout(client); string paymentData = "Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj..."; var details = new Dictionary<string, string> { { "MD", "Ab02b4c0!BQABAgCW5sxB4e/==" }, {"PaRes", "eNrNV0mTo7gS.."} }; var paymentsDetailsRequest = new Model.Checkout.PaymentsDetailsRequest(Details: details, PaymentData: paymentData); var paymentResponse = checkout.PaymentDetails(paymentsDetailsRequest);
const {Client, Config, CheckoutAPI} = require('@adyen/api-library'); const config = new Config(); // Set your X-API-KEY with the API key from the Customer Area. config.apiKey = '[API_KEY]'; config.merchantAccount = '[MERCHANT_ACCOUNT]'; const client = new Client({ config }); client.setEnvironment("TEST"); const checkout = new CheckoutAPI(client); checkout.paymentsDetails({ details: { MD: "Ab02b4c0!BQABAgCW5sxB4e/==", PaRes: "eNrNV0mTo7gS.." }, paymentData: "Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...", }).then(res => res);
import ( "github.com/adyen/adyen-go-api-library/v2/src/checkout" "github.com/adyen/adyen-go-api-library/v2/src/common" "github.com/adyen/adyen-go-api-library/v2/src/adyen" ) // Set your X-API-KEY with the API key from the Customer Area. client := adyen.NewClient(&common.Config{ ApiKey: "[API_KEY]", Environment: common.TestEnv, }) res, httpRes, err := client.Checkout.PaymentsDetails(&checkout.DetailsRequest{ PaymentData: "Ab02b4c0!BQABAgAKspbjN8+5...", Details: map[string]interface{}{ "MD": "Ab02b4c0!BQABAgCW5sxB4e/==", "PaRes": "eNrNV0mTo7gS..", }, })
-
resultCode
: Use this to present the result to your shopper. -
pspReference
: Our unique identifier for the transaction.
-
To make a card payment with 3D Secure redirect authentication on iOS, proceed with the following steps:
-
From your server, make a /payments request, specifying:
Parameter name Required Description paymentMethod
If using the Card Component for iOS, pass the parameters returned by the Component. If submitting raw card data, refer to Raw card data for the fields that you need to pass. returnUrl
The URL where the shopper will be redirected back to after completing 3D Secure authentication. This URL can contain a maximum of 1024 characters. The returnURL
that you provide also determines the HTTP method that you should use when redirecting the shopper.
For iOS, you can 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. If you provide a custom URL, you receive a URL that requires a GET request.billingAddress
The cardholder's billing address. shopperEmail
The cardholder's email address. To increase the likelihood of achieving a frictionless flow and higher authorisation rates, we recommend that you send additional parameters.
For
channel
iOS, we recommend including these additional parameters:billingAddress
andshopperEmail
.A sample /payments request for iOS:
curl https://checkout-test.adyen.com/v66/payments \ -H "X-API-key: [Your API Key here]" \ -H "Content-Type: application/json" \ -d '{ "amount":{ "currency":"EUR", "value":1000 }, "reference":"YOUR_ORDER_NUMBER", "shopperReference":"YOUR_UNIQUE_SHOPPER_ID", "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_24$XUyMJyHebrra/TpSda9fha978+..", "holderName":"S. Hopper" }, "{hint:state.data.billingAddress from onSubmit}billingAddress{/hint}": { "street": "Infinite Loop", "houseNumberOrName": "1", "postalCode": "1011DJ", "city": "Amsterdam", "country": "NL" }, "shopperEmail":"s.hopper@example.com", "shopperIP":"192.0.2.1", "channel":"iOS", "returnUrl":"myapp://", "merchantAccount":"YOUR_MERCHANT_ACCOUNT" }'
# Set your X-API-KEY with the API key from the Customer Area. adyen = Adyen::Client.new adyen.env = :test adyen.api_key = "YOUR_X-API-KEY" response = adyen.checkout.payments({ :amount => { :currency => "EUR", :value => 1000 }, :reference => "YOUR_ORDER_NUMBER", :shopperReference => "YOUR_UNIQUE_SHOPPER_ID", :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_24$XUyMJyHebrra/TpSda9fha978+..", :holderName => "S. Hopper" } :billingAddress => { :city => "Amsterdam", :country => "NL", :houseNumberOrName => "1", :postalCode => "1011DJ", :street => "Infinite Loop" }, :shopperEmail => "s.hopper@example.com", :shopperIP => "192.0.2.1", :channel => "iOS", :returnUrl => "myapp://", :merchantAccount => "YOUR_MERCHANT_ACCOUNT" }) # Check if further action is needed. if response.body.has_key(:action) # Pass the action object to your front end # response.body[:action] else # No further action needed, pass the resultCode object to your front end # response.body[:resultCode]
Client client = new Client("YOUR_API_KEY", Environment.TEST); Checkout checkout = new Checkout(client); PaymentsRequest paymentsRequest = new PaymentsRequest(); paymentsRequest.setMerchantAccount("YOUR_MERCHANT_ACCOUNT"); paymentsRequest.setReference("YOUR_ORDER_REFERENCE"); DefaultPaymentMethodDetails paymentMethodDetails = new DefaultPaymentMethodDetails(); paymentMethodDetails.setType("scheme"); paymentMethodDetails.setEncryptedCardNumber("adyenjs_0_1_18$k7s65M5V0KdPxTErhBIPoMPI8HlC.."); paymentMethodDetails.setEncryptedExpiryMonth("adyenjs_0_1_18$p2OZxW2XmwAA8C1Avxm3G9UB6e4.."); paymentMethodDetails.setEncryptedExpiryYear("adyenjs_0_1_18$CkCOLYZsdqpxGjrALWHj3QoGHqe+.."); paymentMethodDetails.setEncryptedSecurityCode("adyenjs_0_1_24$XUyMJyHebrra/TpSda9fha978+.."); paymentMethodDetails.setHolderName("S. Hopper"); paymentsRequest.setPaymentMethod(paymentMethodDetails); Amount amount = new Amount(); amount.setCurrency("EUR"); amount.setValue(1000L); paymentsRequest.setAmount(amount); Address billingAddress = new Address(); billingAddress.setCity("Amsterdam"); billingAddress.setCountry("NL"); billingAddress.setHouseNumberOrName("1"); billingAddress.setPostalCode("1011DJ"); billingAddress.setStreet("Infinite Loop"); paymentsRequest.setBillingAddress(billingAddress); paymentsRequest.setShopperEmail("s.hopper@example.com"); paymentsRequest.setShopperIP("192.0.2.1"); paymentsRequest.setChannel(PaymentsRequest.ChannelEnum.IOS); paymentsRequest.setReturnUrl("myapp://"); PaymentsResponse paymentsResponse = checkout.payments(paymentsRequest);
// Set your X-API-KEY with the API key from the Customer Area. $client = new \Adyen\Client(); $client->setXApiKey("YOUR_X-API-KEY"); $service = new \Adyen\Service\Checkout($client); $params = [ "amount" => [ "currency" => "EUR", "value" => 1000 ], "reference" => "YOUR_ORDER_NUMBER", "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_24$XUyMJyHebrra/TpSda9fha978+..", "holderName" => "S. Hopper" ], "billingAddress" => [ "city" => "Amsterdam", "country" => "NL", "houseNumberOrName" => "1", "postalCode" => "1011DJ", "street" => "Infinite Loop" ], "shopperEmail" = "s.hopper@example.com", "shopperIP" => "192.0.2.1", "channel" => "iOS", "returnUrl" => "myapp://", "merchantAccount" => "YOUR_MERCHANT_ACCOUNT" ]; $result = $service->payments($params); // Check if further action is needed if (array_key_exists("action", $result){ // Pass the action object to your front end. // $result["action"] } else { // No further action needed, pass the resultCode to your front end // $result['resultCode'] }
# Set your X-API-KEY with the API key from the Customer Area. adyen = Adyen.Adyen() adyen.client.xapikey = 'YOUR_X-API-KEY' result = adyen.checkout.payments({ "amount": { "currency": "EUR", "value": 1000 }, "reference":"YOUR_ORDER_NUMBER", "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_24$XUyMJyHebrra/TpSda9fha978+..", "holderName": "S. Hopper" }, "billingAddress": { "street": "Infinite Loop", "houseNumberOrName": "1", "postalCode": "1011DJ", "city": "Amsterdam", "country": "NL" }, "shopperEmail": "s.hopper@example.com", "shopperIP": "192.0.2.1", "channel": "iOS", "returnUrl": "myapp://", "merchantAccount": "YOUR_MERCHANT_ACCOUNT" })
// Set your X-API-KEY with the API key from the Customer Area. var client = new Client ("YOUR-X-API-KEY", Environment.Test); var checkout = new Checkout(client); var paymentRequest = new Adyen.Model.Checkout.PaymentRequest { Amount = new Model.Checkout.Amount(Currency: "EUR", Value: 1000), Reference = "YOUR_ORDER_REFERENCE", PaymentMethod = new DefaultPaymentMethodDetails { EncryptedCardNumber = "adyenjs_0_1_18$k7s65M5V0KdPxTErhBIPoMPI8HlC..", EncryptedExpiryMonth = "adyenjs_0_1_18$p2OZxW2XmwAA8C1Avxm3G9UB6e4..", EncryptedExpiryYear = "adyenjs_0_1_18$CkCOLYZsdqpxGjrALWHj3QoGHqe+..", EncryptedSecurityCode = "adyenjs_0_1_24$XUyMJyHebrra/TpSda9fha978+..", HolderName = "S. Hopper", Type = "scheme" }, BillingAddress = new Model.Checkout.Address { City = "Amsterdam", Country = "NL", HouseNumberOrName = "1", PostalCode = "1011DJ", Street = "Infinite Loop" }, ShopperEmail = "s.hopper@example.com", ShopperIP = "192.0.2.1", Channel = Model.Checkout.PaymentRequest.ChannelEnum.iOS, ReturnUrl = "myapp://", MerchantAccount = "YOUR_MERCHANT_ACCOUNT" };
// Set your X-API-KEY with the API key from the Customer Area. const {Client, Config, CheckoutAPI} = require('@adyen/api-library'); const config = new Config(); // Set your X-API-KEY with the API key from the Customer Area. config.apiKey = '[API_KEY]'; config.merchantAccount = '[MERCHANT_ACCOUNT]'; const client = new Client({ config }); client.setEnvironment("TEST"); const checkout = new CheckoutAPI(client); checkout.payments({ amount:{ currency: "EUR", value: 1000 }, reference: "YOUR_ORDER_NUMBER", 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_24$XUyMJyHebrra/TpSda9fha978+..", holderName: "S. Hopper" }, billingAddress: { city: "Amsterdam", country: "NL", houseNumberOrName: "1", postalCode: "1011DJ", street: "Infinite Loop" }, shopperEmail: "s.hopper@example.com", shopperIP: "192.0.2.1", channel: "iOS", returnUrl: "myapp://", merchantAccount: "YOUR_MERCHANT_ACCOUNT" }).then(res => res);
{ "resultCode": "RedirectShopper", "action": { "{hint: Store this on your server.}paymentData{/hint}": "Ab02b4c0!BQA...", "paymentMethodType": "scheme", "url": "https://test.adyen.com/hpp/3d-redirect-checkout-direct-api.shtml?brandCode=scheme&issuerUrl=https%3A%2F%2Ftest.adyen.com%2Fhpp%2F3d%2Fvalidate.shtml&md=MnRhOWMvRXF6N1JUa3l...", "method": "GET", "type": "redirect" }, "details": [ { "key": "MD", "type": "text" }, { "key": "PaRes", "type": "text" } ], ... }
- Check if the response contains an
action
object. Your next steps depend on whether the /payments response contains anaction
object:
Description | Next steps | |
---|---|---|
No action object |
The transaction was either exempted or out-of-scope for 3D Secure authentication. | Use the resultCode to present the payment result to your shopper. |
action object type :redirect |
The payment qualifies for 3D Secure. | Proceed to handle the redirect. |
Handle the redirect on iOS
-
Get the
action.url
and theaction.method
from the /payments response. -
Redirect the shopper to the specified
url
using the HTTP method, and include the contents of thedata
object in the request. For example, if you set a custom URL as theredirectUrl
, you receive a URL that requires a GET request.curl https://test.adyen.com/hpp/3d-redirect-checkout-direct-api.shtml?brandCode=scheme&issuerUrl=https%3A%.. \
After completing the 3D Secure authentication, the shopper is redirected back to your
returnUrl
with the same HTTP method. This will be appended withMD
andPaRes
variables.GET /?PaRes=eNrNV8mSo0gSvesr..&MD=MnRhOWMvRXF6N1JU... HTTP/1.1 Host: myapp://
-
URL-decode the
MD
andPaRes
parameters, and pass the parameters to your server. -
From your server, make a /payments/details request, specifying:
paymentData
: Value that you received in the /payments response.details
: Object that contains the URL-decodedMD
andPaRes
parameters.
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":{ "MD":"Ab02b4c0!BQABAgCW5sxB4e/==..", "PaRes":"eNrNV0mTo7gS.." } }'
# Set your X-API-KEY with the API key from the Customer Area. adyen = Adyen::Client.new adyen.api_key = "YOUR_X-API-KEY" response = adyen.checkout.payments.details({ :paymentData => 'Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...', :details => { :MD => 'Ab02b4c0!BQABAgCW5sxB4e/==..', :PaRes => 'eNrNV0mTo7gS..' } })
// Set your X-API-KEY with the API key from the Customer Area. Client client = new Client(xApiKey,Environment.TEST); Checkout checkout = new Checkout(client); PaymentsDetailsRequest paymentsDetailsRequest = new PaymentsDetailsRequest(); HashMap<String, String> details = new HashMap<>(); details.put("MD", "Ab02b4c0!BQABAgCW5sxB4e/==.."); details.put("PaRes", "eNrNV0mTo7gS.."); paymentsDetailsRequest.setDetails(details); paymentsDetailsRequest.setPaymentData("Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj..."); PaymentsResponse paymentsResponse = checkout.paymentsDetails(paymentsDetailsRequest);
// Set your X-API-KEY with the API key from the Customer Area. $client = new \Adyen\Client(); $client->setXApiKey("YOUR_X-API-KEY"); $service = new \Adyen\Service\Checkout($client); $params = array( "paymentData" => "Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...", "details" => array( "MD" => "Ab02b4c0!BQABAgCW5sxB4e/==..", "PaRes" => "eNrNV0mTo7gS.." ) ); $result = $service->paymentsDetails($params);
#Set your X-API-KEY with the API key from the Customer Area. adyen = Adyen.Adyen() adyen.client.xapikey = 'YOUR_X-API-KEY' result = adyen.checkout.payments_details({ 'paymentData' : 'Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...', 'details': { 'MD': 'Ab02b4c0!BQABAgCW5sxB4e/==..', 'PaRes': "eNrNV0mTo7gS.." } })
// Set your X-API-KEY with the API key from the Customer Area. var client = new Client ("YOUR_X-API-KEY", Environment.Test); var checkout = new Checkout(client); string paymentData = "Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj..."; var details = new Dictionary<string, string> { { "MD", "Ab02b4c0!BQABAgCW5sxB4e/==.." }, {"PaRes", "eNrNV0mTo7gS.."} }; var paymentsDetailsRequest = new Model.Checkout.PaymentsDetailsRequest(Details: details, PaymentData: paymentData); var paymentResponse = checkout.PaymentDetails(paymentsDetailsRequest);
// Set your X-API-KEY with the API key from the Customer Area. const {Client, Config, CheckoutAPI} = require('@adyen/api-library'); const config = new Config(); // Set your X-API-KEY with the API key from the Customer Area. config.apiKey = '[API_KEY]'; config.merchantAccount = '[MERCHANT_ACCOUNT]'; const client = new Client({ config }); client.setEnvironment("TEST"); const checkout = new CheckoutAPI(client); checkout.paymentsDetails({ details: { MD: "Ab02b4c0!BQABAgCW5sxB4e/==..", PaRes: "eNrNV0mTo7gS.." }, paymentData: "Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...", }).then(res => res);
The response contains:
resultCode
: Use this to present the result to your shopper.pspReference
: Our unique identifier for the transaction.
To make a card payment with 3D Secure redirect authentication on Android, you need to:
-
From your server, make a /payments request, specifying:
Parameter name Required Description paymentMethod
If using the Card Component for Android, pass the parameters returned by the Component. If submitting raw card data, refer to Raw card data for the fields that you need to pass. billingAddress
The cardholder's billing address. shopperEmail
The cardholder's email address. returnUrl
The URL where the shopper will be redirected back to after completing 3D Secure authentication. This URL can contain a maximum of 1024 characters. The returnURL
that you provide also determines the HTTP method that you should use when redirecting the shopper.
For Android, you can use a custom URL handled by an Activity on your app. You can configure it with an intent filter. For example, configuremy-app://your.package.name
, and then add that to yourmanifest.xml
file. If you provide a custom URL, you receive a URL that requires a GET request. See the example below.<activity android:name=".YourActivity"> <intent-filter> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.BROWSABLE"/> <data android:host="${applicationId}" android:scheme="my-app"/> </intent-filter> </activity>
To increase the likelihood of achieving a frictionless flow and higher authorisation rates, we recommend that you send additional parameters.
For
channel
Android, we recommend including these additional parameters:billingAddress
andshopperEmail
.A sample /payments request for Android:
curl https://checkout-test.adyen.com/v66/payments \ -H "X-API-key: [Your API Key here]" \ -H "Content-Type: application/json" \ -d '{ "amount":{ "currency":"EUR", "value":1000 }, "reference":"YOUR_ORDER_NUMBER", "shopperReference":"YOUR_UNIQUE_SHOPPER_ID", "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_24$XUyMJyHebrra/TpSda9fha978+..", "holderName":"S. Hopper" }, "{hint:state.data.billingAddress from onSubmit}billingAddress{/hint}": { "street": "Infinite Loop", "houseNumberOrName": "1", "postalCode": "1011DJ", "city": "Amsterdam", "country": "NL" }, "shopperEmail":"s.hopper@example.com", "shopperIP":"192.0.2.1", "channel":"Android", "returnUrl":"myapp://", "merchantAccount":"YOUR_MERCHANT_ACCOUNT" }'
# Set your X-API-KEY with the API key from the Customer Area. adyen = Adyen::Client.new adyen.env = :test adyen.api_key = "YOUR_X-API-KEY" response = adyen.checkout.payments({ :amount => { :currency => "EUR", :value => 1000 }, :reference => "YOUR_ORDER_NUMBER", :shopperReference => "YOUR_UNIQUE_SHOPPER_ID", :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_24$XUyMJyHebrra/TpSda9fha978+..", :holderName => "S. Hopper" } :billingAddress => { :city => "Amsterdam", :country => "NL", :houseNumberOrName => "1", :postalCode => "1011DJ", :street => "Infinite Loop" }, :shopperEmail => "s.hopper@example.com", :shopperIP => "192.0.2.1", :channel => "Android", :returnUrl => "myapp://", :merchantAccount => "YOUR_MERCHANT_ACCOUNT" }) # Check if further action is needed. if response.body.has_key(:action) # Pass the action object to your front end # response.body[:action] else # No further action needed, pass the resultCode object to your front end # response.body[:resultCode]
Client client = new Client("YOUR_API_KEY", Environment.TEST); Checkout checkout = new Checkout(client); PaymentsRequest paymentsRequest = new PaymentsRequest(); paymentsRequest.setMerchantAccount("YOUR_MERCHANT_ACCOUNT"); paymentsRequest.setReference("YOUR_ORDER_REFERENCE"); DefaultPaymentMethodDetails paymentMethodDetails = new DefaultPaymentMethodDetails(); paymentMethodDetails.setType("scheme"); paymentMethodDetails.setEncryptedCardNumber("adyenjs_0_1_18$k7s65M5V0KdPxTErhBIPoMPI8HlC.."); paymentMethodDetails.setEncryptedExpiryMonth("adyenjs_0_1_18$p2OZxW2XmwAA8C1Avxm3G9UB6e4.."); paymentMethodDetails.setEncryptedExpiryYear("adyenjs_0_1_18$CkCOLYZsdqpxGjrALWHj3QoGHqe+.."); paymentMethodDetails.setEncryptedSecurityCode("adyenjs_0_1_24$XUyMJyHebrra/TpSda9fha978+.."); paymentMethodDetails.setHolderName("S. Hopper"); paymentsRequest.setPaymentMethod(paymentMethodDetails); Amount amount = new Amount(); amount.setCurrency("EUR"); amount.setValue(1000L); paymentsRequest.setAmount(amount); Address billingAddress = new Address(); billingAddress.setCity("Amsterdam"); billingAddress.setCountry("NL"); billingAddress.setHouseNumberOrName("1"); billingAddress.setPostalCode("1011DJ"); billingAddress.setStreet("Infinite Loop"); paymentsRequest.setBillingAddress(billingAddress); paymentsRequest.setShopperEmail("s.hopper@example.com"); paymentsRequest.setShopperIP("192.0.2.1"); paymentsRequest.setChannel(PaymentsRequest.ChannelEnum.ANDROID); paymentsRequest.setReturnUrl("myapp://"); PaymentsResponse paymentsResponse = checkout.payments(paymentsRequest);
// Set your X-API-KEY with the API key from the Customer Area. $client = new \Adyen\Client(); $client->setXApiKey("YOUR_X-API-KEY"); $service = new \Adyen\Service\Checkout($client); $params = [ "amount" => [ "currency" => "EUR", "value" => 1000 ], "reference" => "YOUR_ORDER_NUMBER", "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_24$XUyMJyHebrra/TpSda9fha978+..", "holderName" => "S. Hopper" ], "billingAddress" => [ "city" => "Amsterdam", "country" => "NL", "houseNumberOrName" => "1", "postalCode" => "1011DJ", "street" => "Infinite Loop" ], "shopperEmail" = "s.hopper@example.com", "shopperIP" => "192.0.2.1", "channel" => "Android", "returnUrl" => "myapp://", "merchantAccount" => "YOUR_MERCHANT_ACCOUNT" ]; $result = $service->payments($params); // Check if further action is needed if (array_key_exists("action", $result){ // Pass the action object to your front end. // $result["action"] } else { // No further action needed, pass the resultCode to your front end // $result['resultCode'] }
# Set your X-API-KEY with the API key from the Customer Area. adyen = Adyen.Adyen() adyen.client.xapikey = 'YOUR_X-API-KEY' result = adyen.checkout.payments({ "amount": { "currency": "EUR", "value": 1000 }, "reference":"YOUR_ORDER_NUMBER", "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_24$XUyMJyHebrra/TpSda9fha978+..", "holderName": "S. Hopper" }, "billingAddress": { "street": "Infinite Loop", "houseNumberOrName": "1", "postalCode": "1011DJ", "city": "Amsterdam", "country": "NL" }, "shopperEmail": "s.hopper@example.com", "shopperIP": "192.0.2.1", "channel": "Android", "returnUrl": "myapp://", "merchantAccount": "YOUR_MERCHANT_ACCOUNT" })
// Set your X-API-KEY with the API key from the Customer Area. var client = new Client ("YOUR-X-API-KEY", Environment.Test); var checkout = new Checkout(client); var paymentRequest = new Adyen.Model.Checkout.PaymentRequest { Amount = new Model.Checkout.Amount(Currency: "EUR", Value: 1000), Reference = "YOUR_ORDER_REFERENCE", PaymentMethod = new DefaultPaymentMethodDetails { EncryptedCardNumber = "adyenjs_0_1_18$k7s65M5V0KdPxTErhBIPoMPI8HlC..", EncryptedExpiryMonth = "adyenjs_0_1_18$p2OZxW2XmwAA8C1Avxm3G9UB6e4..", EncryptedExpiryYear = "adyenjs_0_1_18$CkCOLYZsdqpxGjrALWHj3QoGHqe+..", EncryptedSecurityCode = "adyenjs_0_1_24$XUyMJyHebrra/TpSda9fha978+..", HolderName = "S. Hopper", Type = "scheme" }, BillingAddress = new Model.Checkout.Address { City = "Amsterdam", Country = "NL", HouseNumberOrName = "1", PostalCode = "1011DJ", Street = "Infinite Loop" }, ShopperEmail = "s.hopper@example.com", ShopperIP = "192.0.2.1", Channel = Model.Checkout.PaymentRequest.ChannelEnum.Android, ReturnUrl = "myapp://", MerchantAccount = "YOUR_MERCHANT_ACCOUNT" };
// Set your X-API-KEY with the API key from the Customer Area. const {Client, Config, CheckoutAPI} = require('@adyen/api-library'); const config = new Config(); // Set your X-API-KEY with the API key from the Customer Area. config.apiKey = '[API_KEY]'; config.merchantAccount = '[MERCHANT_ACCOUNT]'; const client = new Client({ config }); client.setEnvironment("TEST"); const checkout = new CheckoutAPI(client); checkout.payments({ amount:{ currency: "EUR", value: 1000 }, reference: "YOUR_ORDER_NUMBER", 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_24$XUyMJyHebrra/TpSda9fha978+..", holderName: "S. Hopper" }, billingAddress: { city: "Amsterdam", country: "NL", houseNumberOrName: "1", postalCode: "1011DJ", street: "Infinite Loop" }, shopperEmail: "s.hopper@example.com", shopperIP: "192.0.2.1", channel: "Android", returnUrl: "myapp://", merchantAccount: "YOUR_MERCHANT_ACCOUNT" }).then(res => res);
- Check if the response contains an
action
object. Your next steps depend on whether the /payments response contains anaction
object:
{
"resultCode": "RedirectShopper",
"action": {
"{hint: Store this on your server.}paymentData{/hint}": "Ab02b4c0!BQA...",
"paymentMethodType": "scheme",
"url": "https://test.adyen.com/hpp/3d-redirect-checkout-direct-api.shtml?brandCode=scheme&issuerUrl=https%3A%2F%2Ftest.adyen.com%2Fhpp%2F3d%2Fvalidate.shtml&md=MnRhOWMvRXF6N1JUa3l...",
"method": "GET",
"type": "redirect"
},
"details": [
{
"key": "MD",
"type": "text"
},
{
"key": "PaRes",
"type": "text"
}
],
...
}
Description | Next steps | |
---|---|---|
No action object |
The transaction was either exempted or out-of-scope for 3D Secure authentication. | Use the resultCode to present the payment result to your shopper. |
action object type :redirect |
The payment qualifies for 3D Secure. | Proceed to handle the redirect. |
Handle the redirect on Android
-
Get the
action.url
and theaction.method
from the /payments response. -
Redirect the shopper to the specified
url
using the HTTP method, and include the contents of thedata
object in the request. For example, if you set a custom URL as theredirectUrl
, you receive a URL that requires a GET request.curl https://test.adyen.com/hpp/3d-redirect-checkout-direct-api.shtml?brandCode=scheme&issuerUrl=https%3A%.. \
After completing the 3D Secure authentication, the shopper is redirected back to your
returnUrl
with the same HTTP method. This will be appended withMD
andPaRes
variables.GET /?PaRes=eNrNV8mSo0gSvesr..&MD=MnRhOWMvRXF6N1JU... HTTP/1.1 Host: myapp://
-
URL-decode the
MD
andPaRes
parameters, and pass the parameters to your server. -
From your server, make a /payments/details request, specifying:
paymentData
: Value that you received in the /payments response.details
: Object that contains the URL-decodedMD
andPaRes
parameters.
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":{ "MD":"Ab02b4c0!BQABAgCW5sxB4e/==..", "PaRes":"eNrNV0mTo7gS.." } }'
# Set your X-API-KEY with the API key from the Customer Area. adyen = Adyen::Client.new adyen.api_key = "YOUR_X-API-KEY" response = adyen.checkout.payments.details({ :paymentData => 'Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...', :details => { :MD => 'Ab02b4c0!BQABAgCW5sxB4e/==..', :PaRes => 'eNrNV0mTo7gS..' } })
// Set your X-API-KEY with the API key from the Customer Area. Client client = new Client(xApiKey,Environment.TEST); Checkout checkout = new Checkout(client); PaymentsDetailsRequest paymentsDetailsRequest = new PaymentsDetailsRequest(); HashMap<String, String> details = new HashMap<>(); details.put("MD", "Ab02b4c0!BQABAgCW5sxB4e/==.."); details.put("PaRes", "eNrNV0mTo7gS.."); paymentsDetailsRequest.setDetails(details); paymentsDetailsRequest.setPaymentData("Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj..."); PaymentsResponse paymentsResponse = checkout.paymentsDetails(paymentsDetailsRequest);
// Set your X-API-KEY with the API key from the Customer Area. $client = new \Adyen\Client(); $client->setXApiKey("YOUR_X-API-KEY"); $service = new \Adyen\Service\Checkout($client); $params = array( "paymentData" => "Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...", "details" => array( "MD" => "Ab02b4c0!BQABAgCW5sxB4e/==..", "PaRes" => "eNrNV0mTo7gS.." ) ); $result = $service->paymentsDetails($params);
#Set your X-API-KEY with the API key from the Customer Area. adyen = Adyen.Adyen() adyen.client.xapikey = 'YOUR_X-API-KEY' result = adyen.checkout.payments_details({ 'paymentData' : 'Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...', 'details': { 'MD': 'Ab02b4c0!BQABAgCW5sxB4e/==..', 'PaRes': "eNrNV0mTo7gS.." } })
// Set your X-API-KEY with the API key from the Customer Area. var client = new Client ("YOUR_X-API-KEY", Environment.Test); var checkout = new Checkout(client); string paymentData = "Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj..."; var details = new Dictionary<string, string> { { "MD", "Ab02b4c0!BQABAgCW5sxB4e/==.." }, {"PaRes", "eNrNV0mTo7gS.."} }; var paymentsDetailsRequest = new Model.Checkout.PaymentsDetailsRequest(Details: details, PaymentData: paymentData); var paymentResponse = checkout.PaymentDetails(paymentsDetailsRequest);
// Set your X-API-KEY with the API key from the Customer Area. const {Client, Config, CheckoutAPI} = require('@adyen/api-library'); const config = new Config(); // Set your X-API-KEY with the API key from the Customer Area. config.apiKey = '[API_KEY]'; config.merchantAccount = '[MERCHANT_ACCOUNT]'; const client = new Client({ config }); client.setEnvironment("TEST"); const checkout = new CheckoutAPI(client); checkout.paymentsDetails({ details: { MD: "Ab02b4c0!BQABAgCW5sxB4e/==..", PaRes: "eNrNV0mTo7gS.." }, paymentData: "Ab02b4c0!BQABAgCJN1wRZuGJmq8dMncmypvknj9s7l5Tj...", }).then(res => res);
The response contains:
resultCode
: Use this to present the result to your shopper.pspReference
: Our unique identifier for the transaction.
Present the payment result
Use the resultCode from the /payments or /payments/details response to present the payment result to your shopper. You will also receive the outcome of the payment asynchronously in a notification webhook.
For card payments, you can receive the following resultCode
values:
resultCode | Description | Action to take |
---|---|---|
Authorised | The payment was successful. | Inform the shopper that the payment has been successful. If you are using manual capture, you also need to capture the payment. |
Cancelled | The shopper cancelled the payment. | Ask the shopper whether they want to continue with the order, or ask them to select a different payment method. |
Error | There was an error when the payment was being processed. For more information, check the
refusalReason
field. |
Inform the shopper that there was an error processing their payment. |
Refused | The payment was refused. For more information, check the
refusalReason
field. |
Ask the shopper to try the payment again using a different payment method. |
Test and go live
Use our test card numbers to test how your integration handles different 3D Secure authentication scenarios.