{"title":"Helper functions","category":"default","creationDate":1776961627,"content":"<div class=\"sc-notice warning\"><div>\n<p><strong>Adyen is no longer developing the Classic API integration<\/strong><\/p>\n<p>This page is for the Classic API (<code>\/authorise<\/code>) integration, which we no longer accept new integrations with. <\/p>\n<p>We strongly recommend migrating to the newer <a href=\"\/checkout-build-your-own-3ds2\/checkout-api-helper-functions\">3D Secure 2 helper functions on Checkout API<\/a> integration. To use this newer integration, you must also <a href=\"\/pt\/online-payments\/upgrade-your-integration\/migrate-to-checkout-api\">migrate to the Checkout API<\/a>.<\/p>\n<\/div><\/div>\n<p>Use our helper functions to:<\/p>\n<ul>\n<li>Collect browser info and store data in properties required in the EMVCo specifications.<\/li>\n<li>Perform base64url encoding and decoding.<\/li>\n<li>Create an iframe with an onload event listener for the 3D Secure 2 device fingerprinting and challenge results.<\/li>\n<li>Create a form with a target attribute to send the issuer requests for 3D Secure 2 device fingerprinting and the challenge.<\/li>\n<li>Configure the challenge window size according to the EMVCo specifications.<\/li>\n<\/ul>\n<div class=\"sc-notice note\"><div>\n<p>The use of helper functions replaces the Web 3D Secure 2 SDK implementation. If you are currently using Web 3D Secure 2 SDK and require assistance, contact <a href=\"https:\/\/ca-test.adyen.com\/ca\/ca\/contactUs\/support.shtml?form=other\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Support Team<\/a>.<\/p>\n<\/div><\/div>\n<h2 id=\"before-you-begin\">Before\u00a0you begin<\/h2>\n<p>Before you begin to integrate, make sure you have followed the <a href=\"\/pt\/get-started-with-adyen\">Get started with Adyen guide<\/a> to:<\/p>\n<ul>\n<li>Get an overview of the steps needed to accept live payments.<\/li>\n<li>Create your test account.<\/li>\n<\/ul>\n<p>After you have created your test account:<\/p>\n<ol>\n<li>\n<p><a href=\"\/pt\/development-resources\/api-credentials#generate-api-key\">Get your API Key<\/a>. Save a copy\u00a0as you'll need it for API calls you make to the\u00a0plataforma de pagamentos da Adyen.<\/p>\n<\/li>\n<li>\n<p>Install one of our\u00a0<a href=\"\/pt\/development-resources\/libraries\">Libraries<\/a>\u00a0to connect with the Adyen APIs. For more information on these steps, refer to\u00a0<a href=\"\/pt\/get-started-with-adyen\">Get started with Adyen<\/a>.<\/p>\n<\/li>\n<li>\n<p>Set up the following webhooks. The issuer will send an HTTP POST containing the 3D Secure 2 device fingerprinting process and the challenge result to these URLs.<\/p>\n<ul>\n<li><code>YOUR_3DS_METHOD_NOTIFICATION_URL<\/code>: Absolute URL\u00a0to where the issuer can post the result of the 3D Secure device fingerprinting process.\u00a0<\/li>\n<li><code>YOUR_3DS_NOTIFICATION_URL<\/code>: Absolute URL to where the issuer can post a base64url encoded Challenge Response (<code>CRes<\/code>)\u00a0message, containing the challenge result.<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>Import our helper functions by:<\/p>\n<ul>\n<li>\n<p>Cloning our repository from\u00a0<a href=\"https:\/\/github.com\/Adyen\/adyen-3ds2-js-utils\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">https:\/\/github.com\/Adyen\/adyen-3ds2-js-utils<\/a> and importing the files into your project.\u00a0<\/p>\n<pre><code class=\"language-js\">import collectBrowserInfo from \".\/browser\";\nimport base64Url from \".\/base64url\";\nimport createIframe from \".\/iframe\";\nimport createForm from \".\/form\";\nimport {validateChallengeWindowSize, getChallengeWindowSize} from \".\/config.js\";<\/code><\/pre>\n<\/li>\n<li>\n<p>Or by building the file, hosting it, and then embedding it in your page.\u00a0<\/p>\n<pre><code class=\"language-xml\">&lt;script type=\"text\/javascript\" src=\"YOUR_PATH\/threeds2-js-utils.js\"&gt;<\/code><\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h2 id=\"collect-the-shoppers-browser-information\">Collect the shopper's browser information<\/h2>\n<p>The\u00a0<code>browserInfo<\/code>\u00a0object is required when submitting a 3D Secure 2 payment request. To get the required values for the transaction, use the\u00a0<code>collectBrowserInfo<\/code>\u00a0function. Pass on the values to your server.<\/p>\n<pre><code class=\"language-js\">const browserInf = collectBrowserInfo();\nconst requestObj =\n{\n    browserInfo         : {\n        \"acceptHeader\"  : \"TO BE ADDED BY SERVER\",\n        \"colorDepth\"    : browserInf.colorDepth,\n        \"javaEnabled\"   : browserInf.javaEnabled,\n        \"language\"      : browserInf.language,\n        \"screenHeight\"  : browserInf.screenHeight,\n        \"screenWidth\"   : browserInf.screenWidth,\n        \"timeZoneOffset\": browserInf.timeZoneOffset,\n        \"userAgent\"     : browserInf.userAgent\n};<\/code><\/pre>\n<h2 id=\"submit-a-payment-request\">Submit a payment request<\/h2>\n<p>Submit a payment request with a POST\u00a0<a href=\"https:\/\/docs.adyen.com\/api-explorer\/#\/Payment\/authorise\" class=\"codeLabel external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/authorise<\/a>\u00a0call. Include the\u00a0<code>threeDS2RequestData<\/code>\u00a0and\u00a0<code>browserInfo<\/code>\u00a0objects to indicate that you are ready to accept 3D Secure 2 authenticated\u00a0payments.<\/p>\n<ul>\n<li><code>deviceChannel<\/code>:\u00a0<strong>browser<\/strong><\/li>\n<li><code>notificationURL<\/code>:\u00a0<code>YOUR_3DS_NOTIFICATION_URL<\/code>\n<div class=\"sc-notice note\"><div>\n<p>You can send <a href=\"\/pt\/online-payments\/classic-integrations\/classic-api-integration\/3d-secure-authentication\/native-3ds2\/api-reference-3d-secure-2#3d-secure-2-additional-parameters\">additional parameters<\/a> for better authorization rates, and to increase the chance of a frictionless flow. You do not have to send all the additional parameters.  Send parameters that you know you can provide accurately, or that are mandatory in specific scenarios.<\/p>\n<\/div><\/div><\/li>\n<\/ul>\n<p>Here is an example of how to make a request for a <strong>EUR&nbsp;150<\/strong> purchase:<\/p>\n<div data-component-wrapper=\"code-sample\">\n    <code-sample :title=\"'Request'\" :id=\"'request-9483156992'\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;curl&quot;,&quot;content&quot;:&quot;curl https:\\\/\\\/pal-test.adyen.com\\\/pal\\\/servlet\\\/Payment\\\/v68\\\/authorise \\\\\\n-H 'x-api-key: ADYEN_API_KEY' \\\\\\n-H 'content-type: application\\\/json' \\\\\\n-d '{\\n  \\&quot;amount\\&quot;:{\\n    \\&quot;currency\\&quot;:\\&quot;EUR\\&quot;,\\n    \\&quot;value\\&quot;:15000\\n  },\\n  \\&quot;merchantAccount\\&quot;:\\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n  \\&quot;reference\\&quot;:\\&quot;TEST\\&quot;,\\n  \\&quot;threeDS2RequestData\\&quot;:{\\n    \\&quot;deviceChannel\\&quot;:\\&quot;browser\\&quot;,\\n    \\&quot;notificationURL\\&quot;:\\&quot;https:\\\\\\\/\\\\\\\/www.example.com\\\\\\\/YOUR_3DS_NOTIFICATION_URL\\&quot;\\n  },\\n  \\&quot;browserInfo\\&quot;:{\\n    \\&quot;userAgent\\&quot;:\\&quot;Mozilla\\\\\\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\\\\\\/537.36 (KHTML, like Gecko) Chrome\\\\\\\/70.0.3538.110 Safari\\\\\\\/537.36\\&quot;,\\n    \\&quot;acceptHeader\\&quot;:\\&quot;text\\\\\\\/html,application\\\\\\\/xhtml+xml,application\\\\\\\/xml;q=0.9,image\\\\\\\/webp,image\\\\\\\/apng,*\\\\\\\/*;q=0.8\\&quot;,\\n    \\&quot;language\\&quot;:\\&quot;en-US\\&quot;,\\n    \\&quot;colorDepth\\&quot;:24,\\n    \\&quot;screenHeight\\&quot;:723,\\n    \\&quot;screenWidth\\&quot;:1536,\\n    \\&quot;timeZoneOffset\\&quot;:0,\\n    \\&quot;javaEnabled\\&quot;:false\\n  },\\n  \\&quot;shopperIP\\&quot;: \\&quot;192.0.2.1\\&quot;,\\n  \\&quot;card\\&quot;:{\\n    \\&quot;cvc\\&quot;:\\&quot;737\\&quot;,\\n    \\&quot;expiryMonth\\&quot;:\\&quot;03\\&quot;,\\n    \\&quot;expiryYear\\&quot;:\\&quot;2030\\&quot;,\\n    \\&quot;holderName\\&quot;:\\&quot;Simon Hopper\\&quot;,\\n    \\&quot;number\\&quot;:\\&quot;4917610000000000\\&quot;\\n  }\\n}'&quot;},{&quot;language&quot;:&quot;java&quot;,&quot;tabTitle&quot;:&quot;Java&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Java API Library v26.3.0\\nimport com.adyen.Client;\\nimport com.adyen.enums.Environment;\\nimport com.adyen.model.payment.*;\\nimport java.time.OffsetDateTime;\\nimport java.util.*;\\nimport com.adyen.service.*;\\n\\nClient client = new Client(\\&quot;ADYEN_API_KEY\\&quot;, Environment.TEST);\\n\\n\\\/\\\/ Create the request object(s)\\nAmount amount = new Amount()\\n  .currency(\\&quot;EUR\\&quot;)\\n  .value(15000L);\\n\\nThreeDS2RequestData threeDS2RequestData = new ThreeDS2RequestData()\\n  .notificationURL(\\&quot;https:\\\/\\\/www.example.com\\\/YOUR_3DS_NOTIFICATION_URL\\&quot;)\\n  .deviceChannel(\\&quot;browser\\&quot;);\\n\\nBrowserInfo browserInfo = new BrowserInfo()\\n  .acceptHeader(\\&quot;text\\\/html,application\\\/xhtml+xml,application\\\/xml;q=0.9,image\\\/webp,image\\\/apng,*\\\/*;q=0.8\\&quot;)\\n  .screenWidth(1536)\\n  .javaEnabled(false)\\n  .screenHeight(723)\\n  .timeZoneOffset(0)\\n  .userAgent(\\&quot;Mozilla\\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\\/537.36 (KHTML, like Gecko) Chrome\\\/70.0.3538.110 Safari\\\/537.36\\&quot;)\\n  .language(\\&quot;en-US\\&quot;)\\n  .colorDepth(24);\\n\\nCard card = new Card()\\n  .cvc(\\&quot;737\\&quot;)\\n  .number(\\&quot;4917610000000000\\&quot;)\\n  .holderName(\\&quot;Simon Hopper\\&quot;)\\n  .expiryMonth(\\&quot;03\\&quot;)\\n  .expiryYear(\\&quot;2030\\&quot;);\\n\\nPaymentRequest paymentRequest = new PaymentRequest()\\n  .reference(\\&quot;TEST\\&quot;)\\n  .amount(amount)\\n  .merchantAccount(\\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;)\\n  .threeDS2RequestData(threeDS2RequestData)\\n  .shopperIP(\\&quot;192.0.2.1\\&quot;)\\n  .browserInfo(browserInfo)\\n  .card(card);\\n\\n\\\/\\\/ Send the request\\npaymentApi service = new paymentApi(client);\\nPaymentResult response = service.authorise(paymentRequest, null);&quot;},{&quot;language&quot;:&quot;php&quot;,&quot;tabTitle&quot;:&quot;PHP&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen PHP API Library v18.2.1\\nuse Adyen\\\\Client;\\nuse Adyen\\\\Environment;\\nuse Adyen\\\\Model\\\\Payments\\\\Amount;\\nuse Adyen\\\\Model\\\\Payments\\\\ThreeDS2RequestData;\\nuse Adyen\\\\Model\\\\Payments\\\\BrowserInfo;\\nuse Adyen\\\\Model\\\\Payments\\\\Card;\\nuse Adyen\\\\Model\\\\Payments\\\\PaymentRequest;\\nuse Adyen\\\\Service\\\\Payments\\\\PaymentsApi;\\n\\n$client = new Client();\\n$client-&gt;setXApiKey(\\&quot;ADYEN_API_KEY\\&quot;);\\n$client-&gt;setEnvironment(Environment::TEST);\\n\\n\\n\\\/\\\/ Create the request object(s)\\n$amount = new Amount();\\n$amount\\n  -&gt;setCurrency(\\&quot;EUR\\&quot;)\\n  -&gt;setValue(15000);\\n\\n$threeDS2RequestData = new ThreeDS2RequestData();\\n$threeDS2RequestData\\n  -&gt;setNotificationURL(\\&quot;https:\\\/\\\/www.example.com\\\/YOUR_3DS_NOTIFICATION_URL\\&quot;)\\n  -&gt;setDeviceChannel(\\&quot;browser\\&quot;);\\n\\n$browserInfo = new BrowserInfo();\\n$browserInfo\\n  -&gt;setAcceptHeader(\\&quot;text\\\/html,application\\\/xhtml+xml,application\\\/xml;q=0.9,image\\\/webp,image\\\/apng,*\\\/*;q=0.8\\&quot;)\\n  -&gt;setScreenWidth(1536)\\n  -&gt;setJavaEnabled(false)\\n  -&gt;setScreenHeight(723)\\n  -&gt;setTimeZoneOffset(0)\\n  -&gt;setUserAgent(\\&quot;Mozilla\\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\\/537.36 (KHTML, like Gecko) Chrome\\\/70.0.3538.110 Safari\\\/537.36\\&quot;)\\n  -&gt;setLanguage(\\&quot;en-US\\&quot;)\\n  -&gt;setColorDepth(24);\\n\\n$card = new Card();\\n$card\\n  -&gt;setCvc(\\&quot;737\\&quot;)\\n  -&gt;setNumber(\\&quot;4917610000000000\\&quot;)\\n  -&gt;setHolderName(\\&quot;Simon Hopper\\&quot;)\\n  -&gt;setExpiryMonth(\\&quot;03\\&quot;)\\n  -&gt;setExpiryYear(\\&quot;2030\\&quot;);\\n\\n$paymentRequest = new PaymentRequest();\\n$paymentRequest\\n  -&gt;setReference(\\&quot;TEST\\&quot;)\\n  -&gt;setAmount($amount)\\n  -&gt;setMerchantAccount(\\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;)\\n  -&gt;setThreeDS2RequestData($threeDS2RequestData)\\n  -&gt;setShopperIP(\\&quot;192.0.2.1\\&quot;)\\n  -&gt;setBrowserInfo($browserInfo)\\n  -&gt;setCard($card);\\n\\n\\\/\\\/ Send the request\\n$service = new PaymentsApi($client);\\n$response = $service-&gt;authorise($paymentRequest);&quot;},{&quot;language&quot;:&quot;cs&quot;,&quot;tabTitle&quot;:&quot;C#&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen .net API Library v17.0.0\\nusing Adyen;\\nusing Environment = Adyen.Model.Environment;\\nusing Adyen.Model;\\nusing Adyen.Model.Payment;\\nusing Adyen.Service;\\n\\nvar config = new Config()\\n{\\n    XApiKey = \\&quot;ADYEN_API_KEY\\&quot;,\\n    Environment = Environment.Test\\n};\\nvar client = new Client(config);\\n\\n\\\/\\\/ Create the request object(s)\\nAmount amount = new Amount\\n{\\n  Currency = \\&quot;EUR\\&quot;,\\n  Value = 15000\\n};\\n\\nThreeDS2RequestData threeDS2RequestData = new ThreeDS2RequestData\\n{\\n  NotificationURL = \\&quot;https:\\\/\\\/www.example.com\\\/YOUR_3DS_NOTIFICATION_URL\\&quot;,\\n  DeviceChannel = \\&quot;browser\\&quot;\\n};\\n\\nBrowserInfo browserInfo = new BrowserInfo\\n{\\n  AcceptHeader = \\&quot;text\\\/html,application\\\/xhtml+xml,application\\\/xml;q=0.9,image\\\/webp,image\\\/apng,*\\\/*;q=0.8\\&quot;,\\n  ScreenWidth = 1536,\\n  JavaEnabled = false,\\n  ScreenHeight = 723,\\n  TimeZoneOffset = 0,\\n  UserAgent = \\&quot;Mozilla\\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\\/537.36 (KHTML, like Gecko) Chrome\\\/70.0.3538.110 Safari\\\/537.36\\&quot;,\\n  Language = \\&quot;en-US\\&quot;,\\n  ColorDepth = 24\\n};\\n\\nCard card = new Card\\n{\\n  Cvc = \\&quot;737\\&quot;,\\n  Number = \\&quot;4917610000000000\\&quot;,\\n  HolderName = \\&quot;Simon Hopper\\&quot;,\\n  ExpiryMonth = \\&quot;03\\&quot;,\\n  ExpiryYear = \\&quot;2030\\&quot;\\n};\\n\\nPaymentRequest paymentRequest = new PaymentRequest\\n{\\n  Reference = \\&quot;TEST\\&quot;,\\n  Amount = amount,\\n  MerchantAccount = \\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n  ThreeDS2RequestData = threeDS2RequestData,\\n  ShopperIP = \\&quot;192.0.2.1\\&quot;,\\n  BrowserInfo = browserInfo,\\n  Card = card\\n};\\n\\n\\\/\\\/ Send the request\\nvar service = new PaymentService(client);\\nvar response = service.Authorise(paymentRequest);&quot;},{&quot;language&quot;:&quot;js&quot;,&quot;tabTitle&quot;:&quot;NodeJS (JavaScript)&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Node API Library v17.3.0\\n\\\/\\\/ Require the parts of the module you want to use\\nconst { Client, PaymentAPI } = require('@adyen\\\/api-library');\\n\\\/\\\/ Initialize the client object\\nconst client = new Client({apiKey: \\&quot;ADYEN_API_KEY\\&quot;, environment: \\&quot;TEST\\&quot;});\\n\\n\\\/\\\/ Create the request object(s)\\nconst paymentRequest = {\\n  amount: {\\n    currency: \\&quot;EUR\\&quot;,\\n    value: 15000\\n  },\\n  merchantAccount: \\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n  reference: \\&quot;TEST\\&quot;,\\n  threeDS2RequestData: {\\n    deviceChannel: \\&quot;browser\\&quot;,\\n    notificationURL: \\&quot;https:\\\/\\\/www.example.com\\\/YOUR_3DS_NOTIFICATION_URL\\&quot;\\n  },\\n  browserInfo: {\\n    userAgent: \\&quot;Mozilla\\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\\/537.36 (KHTML, like Gecko) Chrome\\\/70.0.3538.110 Safari\\\/537.36\\&quot;,\\n    acceptHeader: \\&quot;text\\\/html,application\\\/xhtml+xml,application\\\/xml;q=0.9,image\\\/webp,image\\\/apng,*\\\/*;q=0.8\\&quot;,\\n    language: \\&quot;en-US\\&quot;,\\n    colorDepth: 24,\\n    screenHeight: 723,\\n    screenWidth: 1536,\\n    timeZoneOffset: 0,\\n    javaEnabled: false\\n  },\\n  shopperIP: \\&quot;192.0.2.1\\&quot;,\\n  card: {\\n    cvc: \\&quot;737\\&quot;,\\n    expiryMonth: \\&quot;03\\&quot;,\\n    expiryYear: \\&quot;2030\\&quot;,\\n    holderName: \\&quot;Simon Hopper\\&quot;,\\n    number: \\&quot;4917610000000000\\&quot;\\n  }\\n}\\n\\n\\\/\\\/ Send the request\\nconst paymentAPI = new PaymentAPI(client);\\nconst response = paymentAPI.authorise(paymentRequest);&quot;},{&quot;language&quot;:&quot;go&quot;,&quot;tabTitle&quot;:&quot;Go&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Go API Library v10.4.0\\nimport (\\n  \\&quot;context\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v9\\\/src\\\/common\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v9\\\/src\\\/adyen\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v9\\\/src\\\/payments\\&quot;\\n)\\nclient := adyen.NewClient(&amp;common.Config{\\n  ApiKey:      \\&quot;ADYEN_API_KEY\\&quot;,\\n  Environment: common.TestEnv,\\n})\\n\\n\\\/\\\/ Create the request object(s)\\namount := payments.Amount{\\n  Currency: \\&quot;EUR\\&quot;,\\n  Value: 15000,\\n}\\n\\nthreeDS2RequestData := payments.ThreeDS2RequestData{\\n  NotificationURL: common.PtrString(\\&quot;https:\\\/\\\/www.example.com\\\/YOUR_3DS_NOTIFICATION_URL\\&quot;),\\n  DeviceChannel: \\&quot;browser\\&quot;,\\n}\\n\\nbrowserInfo := payments.BrowserInfo{\\n  AcceptHeader: \\&quot;text\\\/html,application\\\/xhtml+xml,application\\\/xml;q=0.9,image\\\/webp,image\\\/apng,*\\\/*;q=0.8\\&quot;,\\n  ScreenWidth: 1536,\\n  JavaEnabled: false,\\n  ScreenHeight: 723,\\n  TimeZoneOffset: 0,\\n  UserAgent: \\&quot;Mozilla\\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\\/537.36 (KHTML, like Gecko) Chrome\\\/70.0.3538.110 Safari\\\/537.36\\&quot;,\\n  Language: \\&quot;en-US\\&quot;,\\n  ColorDepth: 24,\\n}\\n\\ncard := payments.Card{\\n  Cvc: common.PtrString(\\&quot;737\\&quot;),\\n  Number: common.PtrString(\\&quot;4917610000000000\\&quot;),\\n  HolderName: common.PtrString(\\&quot;Simon Hopper\\&quot;),\\n  ExpiryMonth: common.PtrString(\\&quot;03\\&quot;),\\n  ExpiryYear: common.PtrString(\\&quot;2030\\&quot;),\\n}\\n\\npaymentRequest := payments.PaymentRequest{\\n  Reference: \\&quot;TEST\\&quot;,\\n  Amount: amount,\\n  MerchantAccount: \\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n  ThreeDS2RequestData: &amp;threeDS2RequestData,\\n  ShopperIP: common.PtrString(\\&quot;192.0.2.1\\&quot;),\\n  BrowserInfo: &amp;browserInfo,\\n  Card: &amp;card,\\n}\\n\\n\\\/\\\/ Send the request\\nservice := client.Payments()\\nreq := service.PaymentsApi.AuthoriseInput().PaymentRequest(paymentRequest)\\nres, httpRes, err := service.PaymentsApi.Authorise(context.Background(), req)&quot;},{&quot;language&quot;:&quot;py&quot;,&quot;tabTitle&quot;:&quot;Python&quot;,&quot;content&quot;:&quot;# Adyen Python API Library v12.5.1\\nimport Adyen\\n\\nadyen = Adyen.Adyen()\\nadyen.client.xapikey = \\&quot;ADYEN_API_KEY\\&quot;\\nadyen.client.platform = \\&quot;test\\&quot; # The environment to use library in.\\n\\n# Create the request object(s)\\njson_request = {\\n  \\&quot;amount\\&quot;: {\\n    \\&quot;currency\\&quot;: \\&quot;EUR\\&quot;,\\n    \\&quot;value\\&quot;: 15000\\n  },\\n  \\&quot;merchantAccount\\&quot;: \\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n  \\&quot;reference\\&quot;: \\&quot;TEST\\&quot;,\\n  \\&quot;threeDS2RequestData\\&quot;: {\\n    \\&quot;deviceChannel\\&quot;: \\&quot;browser\\&quot;,\\n    \\&quot;notificationURL\\&quot;: \\&quot;https:\\\/\\\/www.example.com\\\/YOUR_3DS_NOTIFICATION_URL\\&quot;\\n  },\\n  \\&quot;browserInfo\\&quot;: {\\n    \\&quot;userAgent\\&quot;: \\&quot;Mozilla\\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\\/537.36 (KHTML, like Gecko) Chrome\\\/70.0.3538.110 Safari\\\/537.36\\&quot;,\\n    \\&quot;acceptHeader\\&quot;: \\&quot;text\\\/html,application\\\/xhtml+xml,application\\\/xml;q=0.9,image\\\/webp,image\\\/apng,*\\\/*;q=0.8\\&quot;,\\n    \\&quot;language\\&quot;: \\&quot;en-US\\&quot;,\\n    \\&quot;colorDepth\\&quot;: 24,\\n    \\&quot;screenHeight\\&quot;: 723,\\n    \\&quot;screenWidth\\&quot;: 1536,\\n    \\&quot;timeZoneOffset\\&quot;: 0,\\n    \\&quot;javaEnabled\\&quot;: False\\n  },\\n  \\&quot;shopperIP\\&quot;: \\&quot;192.0.2.1\\&quot;,\\n  \\&quot;card\\&quot;: {\\n    \\&quot;cvc\\&quot;: \\&quot;737\\&quot;,\\n    \\&quot;expiryMonth\\&quot;: \\&quot;03\\&quot;,\\n    \\&quot;expiryYear\\&quot;: \\&quot;2030\\&quot;,\\n    \\&quot;holderName\\&quot;: \\&quot;Simon Hopper\\&quot;,\\n    \\&quot;number\\&quot;: \\&quot;4917610000000000\\&quot;\\n  }\\n}\\n\\n# Send the request\\nresult = adyen.payment.payments_api.authorise(request=json_request)&quot;},{&quot;language&quot;:&quot;rb&quot;,&quot;tabTitle&quot;:&quot;Ruby&quot;,&quot;content&quot;:&quot;# Adyen Ruby API Library v9.5.1\\nrequire \\&quot;adyen-ruby-api-library\\&quot;\\n\\nadyen = Adyen::Client.new\\nadyen.api_key = 'ADYEN_API_KEY'\\nadyen.env = :test # Set to \\&quot;live\\&quot; for live environment\\n\\n# Create the request object(s)\\nrequest_body = {\\n  :amount =&gt; {\\n    :currency =&gt; 'EUR',\\n    :value =&gt; 15000\\n  },\\n  :merchantAccount =&gt; 'YOUR_MERCHANT_ACCOUNT',\\n  :reference =&gt; 'TEST',\\n  :threeDS2RequestData =&gt; {\\n    :deviceChannel =&gt; 'browser',\\n    :notificationURL =&gt; 'https:\\\/\\\/www.example.com\\\/YOUR_3DS_NOTIFICATION_URL'\\n  },\\n  :browserInfo =&gt; {\\n    :userAgent =&gt; 'Mozilla\\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\\/537.36 (KHTML, like Gecko) Chrome\\\/70.0.3538.110 Safari\\\/537.36',\\n    :acceptHeader =&gt; 'text\\\/html,application\\\/xhtml+xml,application\\\/xml;q=0.9,image\\\/webp,image\\\/apng,*\\\/*;q=0.8',\\n    :language =&gt; 'en-US',\\n    :colorDepth =&gt; 24,\\n    :screenHeight =&gt; 723,\\n    :screenWidth =&gt; 1536,\\n    :timeZoneOffset =&gt; 0,\\n    :javaEnabled =&gt; false\\n  },\\n  :shopperIP =&gt; '192.0.2.1',\\n  :card =&gt; {\\n    :cvc =&gt; '737',\\n    :expiryMonth =&gt; '03',\\n    :expiryYear =&gt; '2030',\\n    :holderName =&gt; 'Simon Hopper',\\n    :number =&gt; '4917610000000000'\\n  }\\n}\\n\\n# Send the request\\nresult = adyen.payment.payments_api.authorise(request_body)&quot;},{&quot;language&quot;:&quot;ts&quot;,&quot;tabTitle&quot;:&quot;NodeJS (TypeScript)&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Node API Library v17.3.0\\n\\\/\\\/ Require the parts of the module you want to use\\nimport { Client, PaymentAPI, Types } from \\&quot;@adyen\\\/api-library\\&quot;;\\n\\\/\\\/ Initialize the client object\\nconst client = new Client({apiKey: \\&quot;ADYEN_API_KEY\\&quot;, environment: \\&quot;TEST\\&quot;});\\n\\n\\\/\\\/ Create the request object(s)\\nconst amount: Types.payment.Amount = {\\n  currency: \\&quot;EUR\\&quot;,\\n  value: 15000\\n};\\n\\nconst threeDS2RequestData: Types.payment.ThreeDS2RequestData = {\\n  notificationURL: \\&quot;https:\\\/\\\/www.example.com\\\/YOUR_3DS_NOTIFICATION_URL\\&quot;,\\n  deviceChannel: \\&quot;browser\\&quot;\\n};\\n\\nconst browserInfo: Types.payment.BrowserInfo = {\\n  acceptHeader: \\&quot;text\\\/html,application\\\/xhtml+xml,application\\\/xml;q=0.9,image\\\/webp,image\\\/apng,*\\\/*;q=0.8\\&quot;,\\n  screenWidth: 1536,\\n  javaEnabled: false,\\n  screenHeight: 723,\\n  timeZoneOffset: 0,\\n  userAgent: \\&quot;Mozilla\\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\\/537.36 (KHTML, like Gecko) Chrome\\\/70.0.3538.110 Safari\\\/537.36\\&quot;,\\n  language: \\&quot;en-US\\&quot;,\\n  colorDepth: 24\\n};\\n\\nconst card: Types.payment.Card = {\\n  cvc: \\&quot;737\\&quot;,\\n  number: \\&quot;4917610000000000\\&quot;,\\n  holderName: \\&quot;Simon Hopper\\&quot;,\\n  expiryMonth: \\&quot;03\\&quot;,\\n  expiryYear: \\&quot;2030\\&quot;\\n};\\n\\nconst paymentRequest: Types.payment.PaymentRequest = {\\n  reference: \\&quot;TEST\\&quot;,\\n  amount: amount,\\n  merchantAccount: \\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n  threeDS2RequestData: threeDS2RequestData,\\n  shopperIP: \\&quot;192.0.2.1\\&quot;,\\n  browserInfo: browserInfo,\\n  card: card\\n};\\n\\n\\\/\\\/ Send the request\\nconst paymentAPI = new PaymentAPI(client);\\nconst response = paymentAPI.authorise(paymentRequest);&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>You receive a response containing:<\/p>\n<ul>\n<li><code>resultCode<\/code>:\u00a0<strong>IdentifyShopper<\/strong> or\u00a0<strong>ChallengeShopper<\/strong>.\u00a0Perform the corresponding\u00a0<a href=\"#get-the-3d-secure-2-device-fingerprint\">Identify the shopper<\/a>\u00a0or\u00a0<a href=\"#present-a-challenge\">Present a challenge to the shopper<\/a>\u00a0flows. If the transaction is exempted from 3D Secure 2, you might get an\u00a0<strong>Authorised<\/strong>\u00a0result code.<\/li>\n<\/ul>\n<div class=\"sc-notice note\"><div>\n<p>To optimize authorization rates, Adyen's <a href=\"https:\/\/www.adyen.com\/knowledge-hub\/psd2-simplified-with-our-new-authentication-engine\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Authentication Engine<\/a> routes each payment to either the 3D Secure 2 or the 3D Secure 1 flow, based on issuer performance. See\u00a0<a href=\"\/pt\/online-payments\/classic-integrations\/classic-api-integration\/3d-secure-authentication\/native-3ds2#3d-secure-1-fallback\">3D Secure fallback<\/a> for more information.<\/p>\n<\/div><\/div>\n<div class=\"notices green\">\n<p>For a complete list of\u00a0<code>resultCode<\/code>\u00a0values and the actions you need to take, see\u00a0<a href=\"\/pt\/online-payments\/payment-result-codes\">Result codes<\/a>.<\/p>\n<\/div>\n<div data-component-wrapper=\"code-sample\">\n    <code-sample :title=\"'Response - IdentifyShopper'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n    \\\"additionalData\\\": {\\n        \\\"threeds2.threeDSServerTransID\\\": \\\"f8062b92-66e9-4c5a-979a-f465e66a6e48\\\",\\n        \\\"threeds2.threeDS2Token\\\": \\\"BQABAQBPCQZ98WKh3v7qGnBlUMGClVzDolIjs8w\\\/8L64WIAqaOGZipbZod7n+E=...\\\",\\n        \\\"threeds2.threeDSMethodURL\\\": \\\"https:\\\/\\\/pal-test.adyen.com\\\/threeds2simulator\\\/acs\\\/threedsmethodURL.shtml\\\"\\n    },\\n    \\\"pspReference\\\": \\\"8835494629682519\\\",\\n    \\\"resultCode\\\": \\\"IdentifyShopper\\\"\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<h2 id=\"get-the-3d-secure-2-device-fingerprint\">Get the 3D Secure 2 device fingerprint<\/h2>\n<p>If your server receives an\u00a0 <strong>IdentifyShopper<\/strong> <code>resultCode<\/code>, start the 3D Secure 2\u00a0device fingerprinting process.<\/p>\n<ol>\n<li>\n<p>Get the following values from the\u00a0<a href=\"https:\/\/docs.adyen.com\/api-explorer\/#\/Payment\/authorise\" class=\"codeLabel external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/authorise<\/a>\u00a0response:<\/p>\n<ul>\n<li><code>threeds2.threeDSServerTransID<\/code><\/li>\n<li><code>threeds2.threeDSMethodURL<\/code><\/li>\n<li><code>threeds2.threeDS2Token<\/code><\/li>\n<\/ul>\n<\/li>\n<li>\n<p>Create objects and pass on the values of\u00a0<code>threeds2.threeDSServerTransID<\/code>\u00a0and\u00a0<code>YOUR_3DS_METHOD_NOTIFICATION_URL<\/code>. Next, use helper functions to base64url encode the data, create an iframe, and create a form that will send an HTTP POST to the\u00a0<code>threeDSMethodURL<\/code>.<\/p>\n<pre><code class=\"language-js\">const perform3DSDeviceFingerprint = (responseData) =&gt;\n{\n    const serverTransactionID = responseData.additionalData['threeds2.threeDSServerTransID'];\n    const threeDSMethodURL = responseData.additionalData['threeds2.threeDSMethodURL'];\n    const threedsContainer = document.getElementById('threedsContainer');\n    const dataObj = {\n        threeDSServerTransID : serverTransactionID,\n        threeDSMethodNotificationURL : YOUR_3DS_METHOD_NOTIFICATION_URL\n    };\n    const stringifiedDataObject = JSON.stringify(dataObj);\n    \/\/ Encode data\n    const base64URLencodedData = base64Url.encode(stringifiedDataObject);\n    const IFRAME_NAME = 'threeDSMethodIframe';\n\n    \/\/ Create hidden iframe\n    const iframe = createIframe(threedsContainer, IFRAME_NAME, '0', '0');\n    \/\/ Create a form that will use the iframe to POST data to the threeDSMethodURL\n    const form =  createForm('threedsMethodForm', threeDSMethodURL, IFRAME_NAME, 'threeDSMethodData', base64URLencodedData);\n    threedsContainer.appendChild(form);\n    setTimeout( function () {\n        threedsContainer.removeChild( form );\n    }, 1000 );\n    form.submit();\n};<\/code><\/pre>\n<\/li>\n<li>\n<p>Wait for the issuer's response posted in your\u00a0<code>YOUR_3DS_METHOD_NOTIFICATION_URL<\/code>\u00a0within 10 seconds after you sent the HTTP POST.\u00a0If do not get any response within 10 seconds, proceed to the next step.<\/p>\n<p>The issuer will post the <code>threeDSMethodData<\/code>. This contains the base64encoded <code>threeDSServerTransID<\/code> which you can use to identify which request the webhook event is for.<\/p>\n<pre><code class=\"language-bash\"> threeDSMethodData=eyJ0aHJlZURTU2VydmVyVHJhbnNJRCI6ImY4MDYyYjkyLTY2ZTktNGM1YS05NzlhLWY0NjVlNjZhNmU0OCJ9<\/code><\/pre>\n<pre><code class=\"language-json\"> {\"threeDSServerTransID\":\"f8062b92-66e9-4c5a-979a-f465e66a6e48\"}<\/code><\/pre>\n<div class=\"sc-notice info\"><div>\n<p>To trigger your front end to remove the iframe after your webhook receives a response or after 10 seconds has elapsed, see <a href=\"#handling-notification-urls\">Handling the communication from webhooks to your front end<\/a>.<\/p>\n<\/div><\/div>\n<\/li>\n<li>\n<p>Make a POST\u00a0<a href=\"https:\/\/docs.adyen.com\/api-explorer\/#\/Payment\/authorise3ds2\" class=\"codeLabel external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/authorise3ds2<\/a>\u00a0request from your server and include:<\/p>\n<ul>\n<li><code>threeDS2Token<\/code><\/li>\n<li><code>threeDSCompInd<\/code>: If you received a response in <code>YOUR_3DS_METHOD_NOTIFICATION_URL<\/code> within 10 seconds, set this to <strong>Y<\/strong>. Otherwise, set this to <strong>N<\/strong>.<\/li>\n<\/ul>\n<div class=\"sc-notice note\"><div>\n<p>You can send <a href=\"\/pt\/online-payments\/classic-integrations\/classic-api-integration\/3d-secure-authentication\/native-3ds2\/api-reference-3d-secure-2#3d-secure-2-additional-parameters\">additional parameters<\/a> for better authorization rates, and to increase the chance of a frictionless flow. You do not have to send all the additional parameters.  Send parameters that you know you can provide accurately, or that are mandatory in specific scenarios.<\/p>\n<\/div><\/div>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Request - Submit device fingerprint'\" :id=\"'request--submit-device-fingerprint-1431002943'\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;curl&quot;,&quot;content&quot;:&quot;curl https:\\\/\\\/pal-test.adyen.com\\\/pal\\\/servlet\\\/Payment\\\/v68\\\/authorise3ds2 \\\\\\n-H 'x-api-key: ADYEN_API_KEY' \\\\\\n-H 'content-type: application\\\/json' \\\\\\n-d '{\\n   \\&quot;merchantAccount\\&quot;:\\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n   \\&quot;threeDS2RequestData\\&quot;:{\\n      \\&quot;threeDSCompInd\\&quot;:\\&quot;Y\\&quot;\\n   },\\n   \\&quot;threeDS2Token\\&quot;:\\&quot;BQABAQBPCQZ98WKh3v7qGnBlUMGClVzDolIjs8w\\\/8L64WIAqaOGZipbZod7n+E=...\\&quot;\\n}'&quot;},{&quot;language&quot;:&quot;java&quot;,&quot;tabTitle&quot;:&quot;Java&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Java API Library v32.0.0\\nimport com.adyen.Client;\\nimport com.adyen.enums.Environment;\\nimport com.adyen.model.payment.*;\\nimport java.time.OffsetDateTime;\\nimport java.util.*;\\nimport com.adyen.service.*;\\n\\nClient client = new Client(\\&quot;ADYEN_API_KEY\\&quot;, Environment.TEST);\\n\\n\\\/\\\/ Create the request object(s)\\nThreeDS2RequestData threeDS2RequestData2 = new ThreeDS2RequestData()\\n  .threeDSCompInd(\\&quot;Y\\&quot;);\\n\\nPaymentRequest3ds2 paymentRequest3ds2 = new PaymentRequest3ds2()\\n  .threeDS2Token(\\&quot;BQABAQBPCQZ98WKh3v7qGnBlUMGClVzDolIjs8w\\\/8L64WIAqaOGZipbZod7n+E=...\\&quot;)\\n  .merchantAccount(\\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;)\\n  .threeDS2RequestData(threeDS2RequestData2);\\n\\n\\\/\\\/ Send the request\\npaymentApi service = new paymentApi(client);\\nPaymentResult response = service.authorise3ds2(paymentRequest3ds2, null);&quot;},{&quot;language&quot;:&quot;php&quot;,&quot;tabTitle&quot;:&quot;PHP&quot;,&quot;content&quot;:&quot;&lt;?php\\n\\\/\\\/ Adyen PHP API Library v23.0.0\\nuse Adyen\\\\Client;\\nuse Adyen\\\\Environment;\\nuse Adyen\\\\Model\\\\Payments\\\\ThreeDS2RequestData;\\nuse Adyen\\\\Model\\\\Payments\\\\PaymentRequest3ds2;\\nuse Adyen\\\\Service\\\\Payments\\\\PaymentsApi;\\n\\n$client = new Client();\\n$client-&gt;setXApiKey(\\&quot;ADYEN_API_KEY\\&quot;);\\n$client-&gt;setEnvironment(Environment::TEST);\\n\\n\\n\\\/\\\/ Create the request object(s)\\n$threeDS2RequestData2 = new ThreeDS2RequestData();\\n$threeDS2RequestData2\\n  -&gt;setThreeDSCompInd(\\&quot;Y\\&quot;);\\n\\n$paymentRequest3ds2 = new PaymentRequest3ds2();\\n$paymentRequest3ds2\\n  -&gt;setThreeDS2Token(\\&quot;BQABAQBPCQZ98WKh3v7qGnBlUMGClVzDolIjs8w\\\/8L64WIAqaOGZipbZod7n+E=...\\&quot;)\\n  -&gt;setMerchantAccount(\\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;)\\n  -&gt;setThreeDS2RequestData($threeDS2RequestData2);\\n\\n\\\/\\\/ Send the request\\n$service = new PaymentsApi($client);\\n$response = $service-&gt;authorise3ds2($paymentRequest3ds2);&quot;},{&quot;language&quot;:&quot;cs&quot;,&quot;tabTitle&quot;:&quot;C#&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen .net API Library v26.0.0\\nusing Adyen;\\nusing Environment = Adyen.Model.Environment;\\nusing Adyen.Model;\\nusing Adyen.Model.Payment;\\nusing Adyen.Service;\\n\\nvar config = new Config()\\n{\\n    XApiKey = \\&quot;ADYEN_API_KEY\\&quot;,\\n    Environment = Environment.Test\\n};\\nvar client = new Client(config);\\n\\n\\\/\\\/ Create the request object(s)\\nThreeDS2RequestData threeDS2RequestData2 = new ThreeDS2RequestData\\n{\\n  ThreeDSCompInd = \\&quot;Y\\&quot;\\n};\\n\\nPaymentRequest3ds2 paymentRequest3ds2 = new PaymentRequest3ds2\\n{\\n  ThreeDS2Token = \\&quot;BQABAQBPCQZ98WKh3v7qGnBlUMGClVzDolIjs8w\\\/8L64WIAqaOGZipbZod7n+E=...\\&quot;,\\n  MerchantAccount = \\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n  ThreeDS2RequestData = threeDS2RequestData2\\n};\\n\\n\\\/\\\/ Send the request\\nvar service = new PaymentService(client);\\nvar response = service.Authorise3ds2(paymentRequest3ds2);&quot;},{&quot;language&quot;:&quot;js&quot;,&quot;tabTitle&quot;:&quot;NodeJS (JavaScript)&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Node API Library v22.1.0\\n\\\/\\\/ Require the parts of the module you want to use\\nconst { Client, PaymentAPI } = require('@adyen\\\/api-library');\\n\\nconst client = new Client({ apiKey: \\&quot;ADYEN_API_KEY\\&quot;, environment: \\&quot;TEST\\&quot; });\\n\\n\\\/\\\/ Create the request object(s)\\nconst paymentRequest3ds2 = {\\n  merchantAccount: \\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n  threeDS2RequestData: {\\n    threeDSCompInd: \\&quot;Y\\&quot;\\n  },\\n  threeDS2Token: \\&quot;BQABAQBPCQZ98WKh3v7qGnBlUMGClVzDolIjs8w\\\/8L64WIAqaOGZipbZod7n+E=...\\&quot;\\n}\\n\\n\\\/\\\/ Send the request\\nconst paymentAPI = new PaymentAPI(client);\\nconst response = paymentAPI.authorise3ds2(paymentRequest3ds2);&quot;},{&quot;language&quot;:&quot;go&quot;,&quot;tabTitle&quot;:&quot;Go&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Go API Library v16.1.0\\nimport (\\n  \\&quot;context\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v9\\\/src\\\/common\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v9\\\/src\\\/adyen\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v9\\\/src\\\/payments\\&quot;\\n)\\nclient := adyen.NewClient(&amp;common.Config{\\n  ApiKey:      \\&quot;ADYEN_API_KEY\\&quot;,\\n  Environment: common.TestEnv,\\n})\\n\\n\\\/\\\/ Create the request object(s)\\nthreeDS2RequestData2 := payments.ThreeDS2RequestData{\\n  ThreeDSCompInd: common.PtrString(\\&quot;Y\\&quot;),\\n}\\n\\npaymentRequest3ds2 := payments.PaymentRequest3ds2{\\n  ThreeDS2Token: common.PtrString(\\&quot;BQABAQBPCQZ98WKh3v7qGnBlUMGClVzDolIjs8w\\\/8L64WIAqaOGZipbZod7n+E=...\\&quot;),\\n  MerchantAccount: \\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n  ThreeDS2RequestData: &amp;threeDS2RequestData2,\\n}\\n\\n\\\/\\\/ Send the request\\nservice := client.Payments()\\nreq := service.PaymentsApi.Authorise3ds2Input().PaymentRequest3ds2(paymentRequest3ds2)\\nres, httpRes, err := service.PaymentsApi.Authorise3ds2(context.Background(), req)&quot;},{&quot;language&quot;:&quot;py&quot;,&quot;tabTitle&quot;:&quot;Python&quot;,&quot;content&quot;:&quot;# Adyen Python API Library v13.2.0\\nimport Adyen\\n\\nadyen = Adyen.Adyen()\\nadyen.client.xapikey = \\&quot;ADYEN_API_KEY\\&quot;\\nadyen.client.platform = \\&quot;test\\&quot; # The environment to use library in.\\n\\n# Create the request object(s)\\njson_request = {\\n  \\&quot;merchantAccount\\&quot;: \\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n  \\&quot;threeDS2RequestData\\&quot;: {\\n    \\&quot;threeDSCompInd\\&quot;: \\&quot;Y\\&quot;\\n  },\\n  \\&quot;threeDS2Token\\&quot;: \\&quot;BQABAQBPCQZ98WKh3v7qGnBlUMGClVzDolIjs8w\\\/8L64WIAqaOGZipbZod7n+E=...\\&quot;\\n}\\n\\n# Send the request\\nresult = adyen.payment.payments_api.authorise3ds2(request=json_request)&quot;},{&quot;language&quot;:&quot;rb&quot;,&quot;tabTitle&quot;:&quot;Ruby&quot;,&quot;content&quot;:&quot;# Adyen Ruby API Library v10.1.0\\nrequire \\&quot;adyen-ruby-api-library\\&quot;\\n\\nadyen = Adyen::Client.new\\nadyen.api_key = 'ADYEN_API_KEY'\\nadyen.env = :test # Set to \\&quot;live\\&quot; for live environment\\n\\n# Create the request object(s)\\nrequest_body = {\\n  :merchantAccount =&gt; 'YOUR_MERCHANT_ACCOUNT',\\n  :threeDS2RequestData =&gt; {\\n    :threeDSCompInd =&gt; 'Y'\\n  },\\n  :threeDS2Token =&gt; 'BQABAQBPCQZ98WKh3v7qGnBlUMGClVzDolIjs8w\\\/8L64WIAqaOGZipbZod7n+E=...'\\n}\\n\\n# Send the request\\nresult = adyen.payment.payments_api.authorise3ds2(request_body)&quot;},{&quot;language&quot;:&quot;ts&quot;,&quot;tabTitle&quot;:&quot;NodeJS (TypeScript)&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Node API Library v22.1.0\\n\\\/\\\/ Require the parts of the module you want to use\\nimport { Client, PaymentAPI, Types } from \\&quot;@adyen\\\/api-library\\&quot;;\\n\\nconst client = new Client({ apiKey: \\&quot;ADYEN_API_KEY\\&quot;, environment: \\&quot;TEST\\&quot; });\\n\\n\\\/\\\/ Create the request object(s)\\nconst threeDS2RequestData2: Types.payment.ThreeDS2RequestData = {\\n  threeDSCompInd: \\&quot;Y\\&quot;\\n};\\n\\nconst paymentRequest3ds2: Types.payment.PaymentRequest3ds2 = {\\n  threeDS2Token: \\&quot;BQABAQBPCQZ98WKh3v7qGnBlUMGClVzDolIjs8w\\\/8L64WIAqaOGZipbZod7n+E=...\\&quot;,\\n  merchantAccount: \\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n  threeDS2RequestData: threeDS2RequestData2\\n};\\n\\n\\\/\\\/ Send the request\\nconst paymentAPI = new PaymentAPI(client);\\nconst response = paymentAPI.authorise3ds2(paymentRequest3ds2);&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>You receive a response containing a\u00a0<code>resultCode<\/code>\u00a0that can either be:<\/p>\n<ul>\n<li><strong>Authorised<\/strong>\u00a0\u2013\u00a0Indicates that the\u00a03D Secure 2 authentication was frictionless, and the payment authorisation was successfully completed. This state serves as an indicator to proceed with the delivery of goods and services.\u00a0<\/li>\n<li><strong>ChallengeShopper<\/strong>\u00a0\u2013 The issuer has requested further shopper interaction. Perform the\u00a0<a href=\"#present-a-challenge\">Challenge flow<\/a>.<\/li>\n<\/ul>\n<p>For a complete list of\u00a0<code>resultCode<\/code>\u00a0values and the actions you need to take, see\u00a0<a href=\"\/pt\/online-payments\/payment-result-codes\">Result codes<\/a>.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Response - ChallengeShopper'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n   \\\"additionalData\\\":{\\n      \\\"threeds2.threeDS2ResponseData.dsReferenceNumber\\\":\\\"ADYEN-DS-SIMULATOR\\\",\\n      \\\"threeds2.threeDS2ResponseData.transStatus\\\":\\\"C\\\",\\n      \\\"threeds2.threeDS2ResponseData.acsChallengeMandated\\\":\\\"Y\\\",\\n      \\\"threeds2.threeDS2ResponseData.acsURL\\\":\\\"http:\\\\\\\/\\\\\\\/localhost:8080\\\\\\\/threeds2simulator\\\\\\\/services\\\\\\\/ThreeDS2Simulator\\\\\\\/v1\\\\\\\/handle\\\\\\\/eb9c6eb3-57b3-400d-bf2f-4e72bd69dcec\\\",\\n      \\\"threeds2.threeDS2ResponseData.threeDSServerTransID\\\":\\\"c9200190-5ffe-11e8-954f-2677777ae710\\\",\\n      \\\"threeds2.threeDS2ResponseData.authenticationType\\\":\\\"01\\\",\\n      \\\"threeds2.threeDS2ResponseData.dsTransID\\\":\\\"73aab3ce-eb39-49e8-8e9b-46fb77a472f1\\\",\\n      \\\"threeds2.threeDS2ResponseData.messageVersion\\\":\\\"2.1.0\\\",\\n      \\\"threeds2.threeDS2Token\\\":\\\"BQABAQBPCQZ98WKh3v7qGnBlUMGClVzDolIjs8w\\\/8L64WIAqaOGZipbZod7n+E=...\\\",\\n      \\\"threeds2.threeDS2ResponseData.acsTransID\\\":\\\"eb9c6eb3-57b3-400d-bf2f-4e72b779dcec\\\",\\n      \\\"threeds2.threeDS2ResponseData.acsReferenceNumber\\\":\\\"ADYEN-ACS-SIMULATOR\\\"\\n   },\\n   \\\"pspReference\\\":\\\"9935272408577755\\\",\\n   \\\"resultCode\\\":\\\"ChallengeShopper\\\"\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<\/ol>\n<h2 id=\"present-a-challenge\">Present a challenge<\/h2>\n<p>If your server receives a\u00a0<strong>ChallengeShopper<\/strong>\u00a0<code>resultCode<\/code>,\u00a0this means that the issuer would like to perform additional checks in order to verify that the shopper is indeed the cardholder.<\/p>\n<ol>\n<li>\n<p>Get the following parameters from the\u00a0<a href=\"https:\/\/docs.adyen.com\/api-explorer\/#\/Payment\/authorise\" class=\"codeLabel external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/authorise<\/a>\u00a0response or from\u00a0<a href=\"https:\/\/docs.adyen.com\/api-explorer\/#\/Payment\/authorise3ds2\" class=\"codeLabel external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/authorise3ds2<\/a>\u00a0if you are proceeding from the\u00a0<strong>IdentifyShopper<\/strong>\u00a0flow.<\/p>\n<ul>\n<li><code>threeds2.threeDS2Token<\/code><\/li>\n<li><code>threeds2.threeDS2ResponseData.threeDSServerTransID<\/code><\/li>\n<li><code>threeds2.threeDS2ResponseData.acsTransID<\/code><\/li>\n<li><code>threeds2.threeDS2ResponseData.messageVersion<\/code><\/li>\n<\/ul>\n<\/li>\n<li>\n<p>Create a\u00a0<code>cReqData<\/code>\u00a0object and pass on the values of\u00a0<code>threeds2.threeDSServerTransID<\/code>,\u00a0<code>threeds2.threeDS2ResponseData.acsTransID<\/code>,\u00a0<code>threeds2.threeDS2ResponseData.messageVersion<\/code>\u00a0and\u00a0<code>challengeWindowSize<\/code>.\u00a0<\/p>\n<p>Set the\u00a0<code>challengeWindowSize<\/code>\u00a0to any of the following specifications:<\/p>\n<table style=\"width:100%;\"><colgroup><col style=\"width: 33%\"><col style=\"width: 66%\"><\/colgroup><thead><tr class=\"header\"><th>identifier<\/th><th>size<\/th><\/tr><\/thead><tbody><tr><td>\n<p>01<\/p>\n<\/td><td>\n<p>250px x 400px<\/p>\n<\/td><\/tr><tr><td>\n<p>02<\/p>\n<\/td><td>\n<p>390px x 400px<\/p>\n<\/td><\/tr><tr><td>\n<p>03<\/p>\n<\/td><td>\n<p>500px x 600px<\/p>\n<\/td><\/tr><tr><td>\n<p>04<\/p>\n<\/td><td>\n<p>600px x 400px<\/p>\n<\/td><\/tr><tr><td>\n<p>05<\/p>\n<\/td><td>\n<p>100% x 100%<\/p>\n<\/td><\/tr><\/tbody><\/table>\n<p>Next, base64url encode the\u00a0<code>CReq<\/code>\u00a0message, create an iframe, and create a form that will send an HTTP POST to the\u00a0<code>threeds2.threeDS2ResponseData.acsURL<\/code>.<\/p>\n<pre><code class=\"language-java\">const perform3DSChallenge = (responseData) =&gt;\n {\n    const challengeWindowSize = validateChallengeWindowSize('04');\/\/ Corresponds to a 600px x 400px iframe size\n\n    \/\/ Extract the ACS hosted url that will provide the content for the challenge iframe\n    const acsURL = responseData.additionalData['threeds2.threeDS2ResponseData.acsURL'];\n\n    \/\/ Collate the data required to make a cReq\n    const cReqData = {\n        threeDSServerTransID : responseData.additionalData['threeds2.threeDS2ResponseData.threeDSServerTransID'],\n        acsTransID : responseData.additionalData['threeds2.threeDS2ResponseData.acsTransID'],\n        messageVersion : responseData.additionalData['threeds2.threeDS2ResponseData.messageVersion'],\n        messageType : 'CReq',\n        challengeWindowSize\n    };\n\n    const stringifiedDataObject = JSON.stringify(cReqData);\n\n    \/\/ Encode data\n    const base64URLencodedData = base64Url.encode(stringifiedDataObject);\n\n    const IFRAME_NAME = 'threeDSChallengeIframe';\n\n    const threedsContainer = document.getElementById('threedsContainer');\n\n    const iframeSizesArr = getChallengeWindowSize(challengeWindowSize);\n\n    \/\/ Create iframe with challenge window dimensions\n    const iframe = createIframe(threedsContainer, IFRAME_NAME, iframeSizesArr[0], iframeSizesArr[1]);\n\n    \/\/ Create a form that will use the iframe to POST data to the acsURL\n    const form =  createForm('cReqForm', acsURL, IFRAME_NAME, 'creq', base64URLencodedData);\n\n    threedsContainer.appendChild(form);\n\n    setTimeout( function () {\n        threedsContainer.removeChild( form );\n    }, 1000 );\n\n    form.submit();\n};<\/code><\/pre>\n<\/li>\n<li>\n<p>Wait for the issuer's response which will be posted to\u00a0<code>YOUR_3DS_NOTIFICATION_URL<\/code>\u00a0within 10 minutes after you sent the HTTP POST.\u00a0 The response will contain the Challenge Response (<code>CRes<\/code>) in a base64url encoded format. If do not get any response within 10 minutes, proceed to the next step.<\/p>\n<pre><code class=\"language-bash\">cres=eyJtZXNzYWdlVHlwZSI6IkNSZXMiLCJtZXNzYWdlVmVyc2lvbiI6IjIuMS4wIiwidGhyZWVEU1NlcnZlclRyt...<\/code><\/pre>\n<p>Once you get the response,\u00a0Base64url decode the message and get the\u00a0<code>transStatus<\/code>\u00a0value.<\/p>\n<pre><code class=\"language-json\">{\n  \"messageType\":\"CRes\",\n  \"messageVersion\":\"2.1.0\",\n  \"threeDSServerTransID\":\"5ef630b0-76d0-4fcb-8a17-c81ecc86cff7\",\n  \"acsTransID\":\"1f1bb4cc-05c9-49d0-a82c-e587c914a37b\",\n  \"acsUiType\":\"01\",\n  \"challengeCompletionInd\":\"Y\",\n  \"transStatus\":\"Y\"\n}<\/code><\/pre>\n<div class=\"sc-notice info\"><div>\n<p>To trigger your front end to remove the iframe after your webhook endpoint receives a response or after 10 minutes has elapsed, see <a href=\"#handling-notification-urls\">Handling the communication from notification URLs to your front end<\/a>.<\/p>\n<\/div><\/div>\n<\/li>\n<li>\n<p>Make a POST\u00a0<a href=\"https:\/\/docs.adyen.com\/api-explorer\/#\/Payment\/authorise3ds2\" class=\"codeLabel external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/authorise3ds2<\/a>\u00a0request from your server and include\u00a0<code>transStatus<\/code>\u00a0and\u00a0<code>threeds2.threeDS2Token<\/code>\u00a0parameters.<\/p>\n<div class=\"sc-notice note\"><div>\n<p>If you do not receive a response in <code>YOUR_3DS_NOTIFICATION_URL<\/code> within 10 minutes, assume that something went wrong or the shopper aborted the transaction. In this case, send <code>transStatus: U<\/code>\u00a0to Adyen in order to order to finalize the payment.<\/p>\n<\/div><\/div>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Request - Submit challenge result'\" :id=\"'request--submit-challenge-result-2965743395'\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;curl&quot;,&quot;content&quot;:&quot;curl https:\\\/\\\/pal-test.adyen.com\\\/pal\\\/servlet\\\/Payment\\\/v68\\\/authorise3ds2 \\\\\\n-H 'x-api-key: ADYEN_API_KEY' \\\\\\n-H 'content-type: application\\\/json' \\\\\\n-d '{\\n    \\&quot;merchantAccount\\&quot;: \\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n    \\&quot;threeDS2Result\\&quot;: {\\n        \\&quot;transStatus\\&quot;: \\&quot;Y\\&quot;\\n    },\\n    \\&quot;threeDS2Token\\&quot;: \\&quot;BQABAQBPCQZ98WKh3v7qGnBlUMGClVzDolIjs8w\\\/8L64WIAqaOGZipbZod7n+E=...\\&quot;\\n}'&quot;},{&quot;language&quot;:&quot;java&quot;,&quot;tabTitle&quot;:&quot;Java&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Java API Library v25.0.0\\nimport com.adyen.Client;\\nimport com.adyen.enums.Environment;\\nimport com.adyen.model.payment.*;\\nimport java.time.OffsetDateTime;\\nimport java.util.*;\\nimport com.adyen.service.*;\\n\\nClient client = new Client(\\&quot;ADYEN_API_KEY\\&quot;, Environment.TEST);\\n\\n\\\/\\\/ Create the request object(s)\\nThreeDS2Result threeDS2Result2 = new ThreeDS2Result()\\n  .transStatus(\\&quot;Y\\&quot;);\\n\\nPaymentRequest3ds2 paymentRequest3ds2 = new PaymentRequest3ds2()\\n  .threeDS2Result(threeDS2Result2)\\n  .threeDS2Token(\\&quot;BQABAQBPCQZ98WKh3v7qGnBlUMGClVzDolIjs8w\\\/8L64WIAqaOGZipbZod7n+E=...\\&quot;)\\n  .merchantAccount(\\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;);\\n\\n\\\/\\\/ Make the API call\\npaymentApi service = new paymentApi(client);\\nPaymentResult response = service.authorise3ds2(paymentRequest3ds2, null);&quot;},{&quot;language&quot;:&quot;php&quot;,&quot;tabTitle&quot;:&quot;PHP&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen PHP API Library v17.4.0\\nuse Adyen\\\\Client;\\nuse Adyen\\\\Environment;\\nuse Adyen\\\\Model\\\\Payments\\\\ThreeDS2Result;\\nuse Adyen\\\\Model\\\\Payments\\\\PaymentRequest3ds2;\\nuse Adyen\\\\Service\\\\Payments\\\\PaymentsApi;\\n\\n$client = new Client();\\n$client-&gt;setXApiKey(\\&quot;ADYEN_API_KEY\\&quot;);\\n$client-&gt;setEnvironment(Environment::TEST);\\n\\n\\n\\\/\\\/ Create the request object(s)\\n$threeDS2Result2 = new ThreeDS2Result();\\n$threeDS2Result2\\n  -&gt;setTransStatus(\\&quot;Y\\&quot;);\\n\\n$paymentRequest3ds2 = new PaymentRequest3ds2();\\n$paymentRequest3ds2\\n  -&gt;setThreeDS2Result($threeDS2Result2)\\n  -&gt;setThreeDS2Token(\\&quot;BQABAQBPCQZ98WKh3v7qGnBlUMGClVzDolIjs8w\\\/8L64WIAqaOGZipbZod7n+E=...\\&quot;)\\n  -&gt;setMerchantAccount(\\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;);\\n\\n\\\/\\\/ Make the API call\\n$service = new PaymentsApi($client);\\n$response = $service-&gt;authorise3ds2($paymentRequest3ds2);&quot;},{&quot;language&quot;:&quot;cs&quot;,&quot;tabTitle&quot;:&quot;C#&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen .net API Library v14.4.0\\nusing Adyen;\\nusing Environment = Adyen.Model.Environment;\\nusing Adyen.Model;\\nusing Adyen.Model.Payment;\\nusing Adyen.Service;\\n\\nvar config = new Config()\\n{\\n    XApiKey = \\&quot;ADYEN_API_KEY\\&quot;,\\n    Environment = Environment.Test\\n};\\nvar client = new Client(config);\\n\\n\\\/\\\/ Create the request object(s)\\nThreeDS2Result threeDS2Result2 = new ThreeDS2Result\\n{\\n  TransStatus = \\&quot;Y\\&quot;\\n};\\n\\nPaymentRequest3ds2 paymentRequest3ds2 = new PaymentRequest3ds2\\n{\\n  ThreeDS2Result = threeDS2Result2,\\n  ThreeDS2Token = \\&quot;BQABAQBPCQZ98WKh3v7qGnBlUMGClVzDolIjs8w\\\/8L64WIAqaOGZipbZod7n+E=...\\&quot;,\\n  MerchantAccount = \\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;\\n};\\n\\n\\\/\\\/ Make the API call\\nvar service = new PaymentService(client);\\nvar response = service.Authorise3ds2(paymentRequest3ds2);&quot;},{&quot;language&quot;:&quot;js&quot;,&quot;tabTitle&quot;:&quot;NodeJS (JavaScript)&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Node API Library v16.2.0\\n\\\/\\\/ Require the parts of the module you want to use\\nconst { Client, PaymentAPI } = require('@adyen\\\/api-library');\\n\\\/\\\/ Initialize the client object\\nconst client = new Client({apiKey: \\&quot;ADYEN_API_KEY\\&quot;, environment: \\&quot;TEST\\&quot;});\\n\\n\\\/\\\/ Create the request object(s)\\nconst paymentRequest3ds2 = {\\n  merchantAccount: \\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n  threeDS2Result: {\\n    transStatus: \\&quot;Y\\&quot;\\n  },\\n  threeDS2Token: \\&quot;BQABAQBPCQZ98WKh3v7qGnBlUMGClVzDolIjs8w\\\/8L64WIAqaOGZipbZod7n+E=...\\&quot;\\n}\\n\\n\\\/\\\/ Make the API call\\nconst paymentAPI = new PaymentAPI(client);\\nconst response = paymentAPI.authorise3ds2(paymentRequest3ds2);&quot;},{&quot;language&quot;:&quot;go&quot;,&quot;tabTitle&quot;:&quot;Go&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Go API Library v9.3.0\\nimport (\\n  \\&quot;context\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v9\\\/src\\\/common\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v9\\\/src\\\/adyen\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v9\\\/src\\\/payments\\&quot;\\n)\\nclient := adyen.NewClient(&amp;common.Config{\\n  ApiKey:      \\&quot;ADYEN_API_KEY\\&quot;,\\n  Environment: common.TestEnv,\\n})\\n\\n\\\/\\\/ Create the request object(s)\\nthreeDS2Result2 := payments.ThreeDS2Result{\\n  TransStatus: common.PtrString(\\&quot;Y\\&quot;),\\n}\\n\\npaymentRequest3ds2 := payments.PaymentRequest3ds2{\\n  ThreeDS2Result: &amp;threeDS2Result2,\\n  ThreeDS2Token: common.PtrString(\\&quot;BQABAQBPCQZ98WKh3v7qGnBlUMGClVzDolIjs8w\\\/8L64WIAqaOGZipbZod7n+E=...\\&quot;),\\n  MerchantAccount: \\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n}\\n\\n\\\/\\\/ Make the API call\\nservice := client.Payments()\\nreq := service.PaymentsApi.Authorise3ds2Input().PaymentRequest3ds2(paymentRequest3ds2)\\nres, httpRes, err := service.PaymentsApi.Authorise3ds2(context.Background(), req)&quot;},{&quot;language&quot;:&quot;py&quot;,&quot;tabTitle&quot;:&quot;Python&quot;,&quot;content&quot;:&quot;# Adyen Python API Library v12.2.0\\nimport Adyen\\n\\nadyen = Adyen.Adyen()\\nadyen.client.xapikey = \\&quot;ADYEN_API_KEY\\&quot;\\nadyen.client.platform = \\&quot;test\\&quot; # The environment to use library in.\\n\\n# Create the request object(s)\\njson_request = {\\n  \\&quot;merchantAccount\\&quot;: \\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n  \\&quot;threeDS2Result\\&quot;: {\\n    \\&quot;transStatus\\&quot;: \\&quot;Y\\&quot;\\n  },\\n  \\&quot;threeDS2Token\\&quot;: \\&quot;BQABAQBPCQZ98WKh3v7qGnBlUMGClVzDolIjs8w\\\/8L64WIAqaOGZipbZod7n+E=...\\&quot;\\n}\\n\\n# Make the API call\\nresult = adyen.payment.payments_api.authorise3ds2(request=json_request)&quot;},{&quot;language&quot;:&quot;rb&quot;,&quot;tabTitle&quot;:&quot;Ruby&quot;,&quot;content&quot;:&quot;# Adyen Ruby API Library v9.3.0\\nrequire \\&quot;adyen-ruby-api-library\\&quot;\\n\\nadyen = Adyen::Client.new\\nadyen.api_key = 'ADYEN_API_KEY'\\nadyen.env = :test # Set to \\&quot;live\\&quot; for live environment\\n\\n# Create the request object(s)\\nrequest_body = {\\n  :merchantAccount =&gt; 'YOUR_MERCHANT_ACCOUNT',\\n  :threeDS2Result =&gt; {\\n    :transStatus =&gt; 'Y'\\n  },\\n  :threeDS2Token =&gt; 'BQABAQBPCQZ98WKh3v7qGnBlUMGClVzDolIjs8w\\\/8L64WIAqaOGZipbZod7n+E=...'\\n}\\n\\n# Make the API call\\nresult = adyen.payment.payments_api.authorise3ds2(request_body)&quot;},{&quot;language&quot;:&quot;ts&quot;,&quot;tabTitle&quot;:&quot;NodeJS (TypeScript)&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Node API Library v16.2.0\\n\\\/\\\/ Require the parts of the module you want to use\\nimport { Client, PaymentAPI, Types } from \\&quot;@adyen\\\/api-library\\&quot;;\\n\\\/\\\/ Initialize the client object\\nconst client = new Client({apiKey: \\&quot;ADYEN_API_KEY\\&quot;, environment: \\&quot;TEST\\&quot;});\\n\\n\\\/\\\/ Create the request object(s)\\nconst threeDS2Result2: Types.payment.ThreeDS2Result = {\\n  transStatus: \\&quot;Y\\&quot;\\n};\\n\\nconst paymentRequest3ds2: Types.payment.PaymentRequest3ds2 = {\\n  threeDS2Result: threeDS2Result2,\\n  threeDS2Token: \\&quot;BQABAQBPCQZ98WKh3v7qGnBlUMGClVzDolIjs8w\\\/8L64WIAqaOGZipbZod7n+E=...\\&quot;,\\n  merchantAccount: \\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;\\n};\\n\\n\\\/\\\/ Make the API call\\nconst paymentAPI = new PaymentAPI(client);\\nconst response = paymentAPI.authorise3ds2(paymentRequest3ds2);&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>You receive\u00a0<strong>Authorised<\/strong>\u00a0as the\u00a0<code>resultCode<\/code>\u00a0if the payment was successful.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Response - Authorised'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n    \\\"additionalData\\\": {\\n        \\\"liabilityShift\\\": \\\"true\\\",\\n        \\\"authCode\\\": \\\"44402\\\",\\n        \\\"avsResult\\\": \\\"4 AVS not supported for this card type\\\",\\n        \\\"threeDOffered\\\": \\\"true\\\",\\n        \\\"refusalReasonRaw\\\": \\\"AUTHORISED\\\",\\n        \\\"authorisationMid\\\": \\\"1000\\\",\\n        \\\"acquirerAccountCode\\\": \\\"TestPmmAcquirerAccount\\\",\\n        \\\"cvcResult\\\": \\\"1 Matches\\\",\\n        \\\"avsResultRaw\\\": \\\"4\\\",\\n        \\\"threeDAuthenticated\\\": \\\"true\\\",\\n        \\\"cvcResultRaw\\\": \\\"M\\\",\\n        \\\"acquirerCode\\\": \\\"TestPmmAcquirer\\\",\\n        \\\"acquirerReference\\\": \\\"7CASOGMCCB4\\\"\\n    },\\n    \\\"pspReference\\\": \\\"8825495331860022\\\",\\n    \\\"resultCode\\\": \\\"Authorised\\\",\\n    \\\"authCode\\\": \\\"44402\\\"\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<\/ol>\n<h2 id=\"handling-notification-urls\">Handling the communication from notification URLs to your front end<\/h2>\n<p>The notification URLs\u00a0<code>YOUR_3DS_METHOD_NOTIFICATION_URL<\/code>\u00a0and\u00a0<code>YOUR_3DS_NOTIFICATION_URL<\/code>\u00a0on your server are the ideal places from where you should perform the next\u00a0<a href=\"https:\/\/docs.adyen.com\/api-explorer\/#\/Payment\/authorise3ds2\" class=\"codeLabel external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/authorise3ds2<\/a>\u00a0request. However, you may want to communicate with your front end after performing the device fingerprinting or after presenting a challenge\u00a0in order to hide the iframes and to perform other actions if needed.<\/p>\n<p>In case you do not have an existing implementation for your front end and back end communication, our recommended implementation is to:<\/p>\n<ul>\n<li>Use the\u00a0<code>message<\/code>\u00a0event on the front end to listen to a\u00a0<code>window.postMessage<\/code>\u00a0method from the pages running the iframes at the notification URLs. See sample codes below:<\/li>\n<\/ul>\n<p>Add this in the notification URLs, running within the iframe:<\/p>\n<pre><code class=\"language-js\">&lt;script type=\"text\/javascript\"&gt;\n \/\/ For IdentifyShopper (3DSMethod) flow\n \/\/ NOTE: This redirect of the iframe should have happened within 10 seconds of POST-ing the form to the\n \/\/ threeDSMethodURL otherwise threeDSCompInd should be set to 'N'\n     const data = {\n         type: 'identifyShopper',\n         threeDSCompInd: 'Y'\n     };\n \/\/ For ChallengeShopper flow\n \/\/ NOTE: This redirect of the iframe should have happened within 10 minutes of POST-ing the form\n \/\/ to the acsURL otherwise transStatus should be set to 'U'\n const data = {\n         type: 'challengeShopper',\n         transStatus: 'Y',\n threeDSServerTransID: threeds2.threeDS2ResponseData.threeDSServerTransID\n     };\n\n    window.parent.postMessage(data, YOUR_WEBSITE_DOMAIN);\n\n&lt;\/script&gt;<\/code><\/pre>\n<p>Add this in your website:<\/p>\n<pre><code class=\"language-js\">window.addEventListener(\"message\", (e) =&gt;\n{\n    if(e.origin === YOUR_HOSTED_DOMAIN_FOR_THE_NOTIFICATION_URLS){\n        const eventData = e.data;\n        \/\/ IdentifyShopper (3DSMethod) response\n        if(eventData.hasOwnProperty('threeDSCompInd')){\n\n            \/\/ If you haven't already performed the next \/authorise3ds2 call from your notification URL this\n            \/\/ represents a good place to initiate the an API request\n            authorise3DS2RequestAfterIdentifyingShopper(eventData.threeDSCompInd);\n        }\n\n        \/\/ Challenge response\n        if(eventData.hasOwnProperty('transStatus') &amp;&amp; eventData.hasOwnProperty('threeDSServerTransID')){\n\n            \/\/ If you haven't already performed the next \/authorise3ds2 call from your notification URL this\n            \/\/ represents a good place to initiate the an API request\n            authorise3DS2RequestAfterChallenge(eventData.transStatus, eventData.threeDSServerTransID);\n        }\n\n        \/\/ Run code to remove the iframe from the '#threedsContainer' element\n        hideIframe();\n    }\n});<\/code><\/pre>\n<h2 id=\"testing-3d-secure-2\">Testing 3D Secure 2<\/h2>\n<p>Before going live, use the following card numbers and credentials to\u00a0test your integration.<\/p>\n<p>We recommend testing each\u00a0<strong>Card Type<\/strong>.<\/p>\n<p>To test how your integration handles different 3D Secure 2 authentication scenarios, use our test card numbers.<\/p>\n<p>All our test cards use the following expiry dates and security codes:<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">Expiry Date<\/th>\n<th style=\"text-align: left;\">CVC\/CVV<\/th>\n<th style=\"text-align: left;\">CID<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">03\/2030<\/td>\n<td style=\"text-align: left;\">737<\/td>\n<td style=\"text-align: left;\">7373<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>When prompted for 3D Secure 2 text challenges, use the following credentials:<\/p>\n<ul>\n<li>For mobile, use password: <strong>1234<\/strong><\/li>\n<li>For web, use password: <strong>password<\/strong><\/li>\n<\/ul>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">Card Type<\/th>\n<th style=\"text-align: left;\">Card Number<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">Cartes Bancaires<\/td>\n<td style=\"text-align: left;\">4035 5014 2814 6300<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">Maestro <a href=\"#nocvc\">\n  <sup>1<\/sup>\n<\/a><\/td>\n<td style=\"text-align: left;\">5000 5500 0000 0029<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">Mastercard<\/td>\n<td style=\"text-align: left;\">5454 5454 5454 5454<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">Visa<\/td>\n<td style=\"text-align: left;\">4917 6100 0000 0000<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><a id=\"nocvc\"><\/a> <sup>1<\/sup> This card doesn't require a CVC.<\/p>\n<p>When you make a payment request with these cards, you'll receive the following result codes depending on your integration:<\/p>\n<ul>\n<li><strong>RedirectShopper<\/strong>: You'll receive this result code if you are using the <a href=\"\/pt\/online-payments\/classic-integrations\/classic-api-integration\/3d-secure-authentication\/3d-secure-1\">Redirect authentication<\/a>.<\/li>\n<li><strong>IdentifyShopper<\/strong>:  You'll receive this result code if you are using the <a href=\"\/pt\/online-payments\/classic-integrations\/classic-api-integration\/3d-secure-authentication\/native-3ds2\">Native authentication<\/a>.<\/li>\n<li><strong>ChallengeShopper<\/strong>: You might get this result code after you submit the 3D Secure 2 device fingerprinting result in a Native authentication, indicating a challenge flow.<\/li>\n<\/ul>\n<!-- list separator -->\n<p>To test the web-based flow where the device fingerprinting step is skipped (because the issuer's ACS has not configured a <code>threeDSMethodURL<\/code>), and you get a <strong>ChallengeShopper<\/strong> <code>resultCode<\/code> <em>immediately<\/em> after submitting the payment request, use the following card:<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">Card Type<\/th>\n<th style=\"text-align: left;\">Card Number<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">Visa<\/td>\n<td style=\"text-align: left;\">4212 3456 7891 0006<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>To test the frictionless flow, specify in your payment request:<\/p>\n<ul>\n<li><code>amount.value<\/code>: <strong>12002<\/strong><\/li>\n<\/ul>\n<h4 id=\"app-based-integration\">App-based integration<\/h4>\n<p>To test different authentication scenarios for app-based integration, use the following test cards:<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">Card number<\/th>\n<th style=\"text-align: left;\">Authentication scenario<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">5201 2855 6567 2311<\/td>\n<td style=\"text-align: left;\">Basic text authentication<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">5201 2874 9905 2008<\/td>\n<td style=\"text-align: left;\">Basic single select<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">5201 2815 9233 1633<\/td>\n<td style=\"text-align: left;\">Basic multi select<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">5201 2888 2269 6974<\/td>\n<td style=\"text-align: left;\">Basic out-of-band (OOB) authentication<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">5201 2895 0084 3268<\/td>\n<td style=\"text-align: left;\">HTML OOB authentication<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">5201 2861 5377 1465<\/td>\n<td style=\"text-align: left;\">App single select then text authentication<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4 id=\"other-scenarios\">Other scenarios<\/h4>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">Card number<\/th>\n<th style=\"text-align: left;\">Scenario<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">4199 3500 0000 0002<\/td>\n<td style=\"text-align: left;\">The card is not enrolled for 3D Secure transactions,<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">5201 2829 9900 5515<\/td>\n<td style=\"text-align: left;\">There was a technical error.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>","url":"https:\/\/docs.adyen.com\/pt\/online-payments\/classic-integrations\/classic-api-integration\/3d-secure-authentication\/native-3ds2\/browser-based-integration\/3d-secure-2-helper-functions","articleFields":{"description":"Simplify your 3D Secure 2 implementation web implementation with our helper functions.","id":"47484537","type":"page","_expandable":{"operations":""},"status":"current","last_edit_on":"05-08-2019 11:17","sitemap":{"priority":0.3},"parameters":{"anchor_new":"<a href=\/checkout-build-your-own-3ds2\/checkout-api-helper-functions>3D Secure 2 helper functions on Checkout API<\/a>","parent_page":"Classic API (<code>\/authorise<\/code>)","new_desc":"integrating using our Checkout APIs"}},"algolia":{"url":"https:\/\/docs.adyen.com\/pt\/online-payments\/classic-integrations\/classic-api-integration\/3d-secure-authentication\/native-3ds2\/browser-based-integration\/3d-secure-2-helper-functions","title":"Helper functions","content":"\nAdyen is no longer developing the Classic API integration\nThis page is for the Classic API (\/authorise) integration, which we no longer accept new integrations with. \nWe strongly recommend migrating to the newer 3D Secure 2 helper functions on Checkout API integration. To use this newer integration, you must also migrate to the Checkout API.\n\nUse our helper functions to:\n\nCollect browser info and store data in properties required in the EMVCo specifications.\nPerform base64url encoding and decoding.\nCreate an iframe with an onload event listener for the 3D Secure 2 device fingerprinting and challenge results.\nCreate a form with a target attribute to send the issuer requests for 3D Secure 2 device fingerprinting and the challenge.\nConfigure the challenge window size according to the EMVCo specifications.\n\n\nThe use of helper functions replaces the Web 3D Secure 2 SDK implementation. If you are currently using Web 3D Secure 2 SDK and require assistance, contact Support Team.\n\nBefore\u00a0you begin\nBefore you begin to integrate, make sure you have followed the Get started with Adyen guide to:\n\nGet an overview of the steps needed to accept live payments.\nCreate your test account.\n\nAfter you have created your test account:\n\n\nGet your API Key. Save a copy\u00a0as you'll need it for API calls you make to the\u00a0plataforma de pagamentos da Adyen.\n\n\nInstall one of our\u00a0Libraries\u00a0to connect with the Adyen APIs. For more information on these steps, refer to\u00a0Get started with Adyen.\n\n\nSet up the following webhooks. The issuer will send an HTTP POST containing the 3D Secure 2 device fingerprinting process and the challenge result to these URLs.\n\nYOUR_3DS_METHOD_NOTIFICATION_URL: Absolute URL\u00a0to where the issuer can post the result of the 3D Secure device fingerprinting process.\u00a0\nYOUR_3DS_NOTIFICATION_URL: Absolute URL to where the issuer can post a base64url encoded Challenge Response (CRes)\u00a0message, containing the challenge result.\n\n\n\nImport our helper functions by:\n\n\nCloning our repository from\u00a0https:\/\/github.com\/Adyen\/adyen-3ds2-js-utils and importing the files into your project.\u00a0\nimport collectBrowserInfo from \".\/browser\";\nimport base64Url from \".\/base64url\";\nimport createIframe from \".\/iframe\";\nimport createForm from \".\/form\";\nimport {validateChallengeWindowSize, getChallengeWindowSize} from \".\/config.js\";\n\n\nOr by building the file, hosting it, and then embedding it in your page.\u00a0\n&lt;script type=\"text\/javascript\" src=\"YOUR_PATH\/threeds2-js-utils.js\"&gt;\n\n\n\n\nCollect the shopper's browser information\nThe\u00a0browserInfo\u00a0object is required when submitting a 3D Secure 2 payment request. To get the required values for the transaction, use the\u00a0collectBrowserInfo\u00a0function. Pass on the values to your server.\nconst browserInf = collectBrowserInfo();\nconst requestObj =\n{\n    browserInfo         : {\n        \"acceptHeader\"  : \"TO BE ADDED BY SERVER\",\n        \"colorDepth\"    : browserInf.colorDepth,\n        \"javaEnabled\"   : browserInf.javaEnabled,\n        \"language\"      : browserInf.language,\n        \"screenHeight\"  : browserInf.screenHeight,\n        \"screenWidth\"   : browserInf.screenWidth,\n        \"timeZoneOffset\": browserInf.timeZoneOffset,\n        \"userAgent\"     : browserInf.userAgent\n};\nSubmit a payment request\nSubmit a payment request with a POST\u00a0\/authorise\u00a0call. Include the\u00a0threeDS2RequestData\u00a0and\u00a0browserInfo\u00a0objects to indicate that you are ready to accept 3D Secure 2 authenticated\u00a0payments.\n\ndeviceChannel:\u00a0browser\nnotificationURL:\u00a0YOUR_3DS_NOTIFICATION_URL\n\nYou can send additional parameters for better authorization rates, and to increase the chance of a frictionless flow. You do not have to send all the additional parameters.  Send parameters that you know you can provide accurately, or that are mandatory in specific scenarios.\n\n\nHere is an example of how to make a request for a EUR&nbsp;150 purchase:\n\n    \n\nYou receive a response containing:\n\nresultCode:\u00a0IdentifyShopper or\u00a0ChallengeShopper.\u00a0Perform the corresponding\u00a0Identify the shopper\u00a0or\u00a0Present a challenge to the shopper\u00a0flows. If the transaction is exempted from 3D Secure 2, you might get an\u00a0Authorised\u00a0result code.\n\n\nTo optimize authorization rates, Adyen's Authentication Engine routes each payment to either the 3D Secure 2 or the 3D Secure 1 flow, based on issuer performance. See\u00a03D Secure fallback for more information.\n\n\nFor a complete list of\u00a0resultCode\u00a0values and the actions you need to take, see\u00a0Result codes.\n\n\n    \n\nGet the 3D Secure 2 device fingerprint\nIf your server receives an\u00a0 IdentifyShopper resultCode, start the 3D Secure 2\u00a0device fingerprinting process.\n\n\nGet the following values from the\u00a0\/authorise\u00a0response:\n\nthreeds2.threeDSServerTransID\nthreeds2.threeDSMethodURL\nthreeds2.threeDS2Token\n\n\n\nCreate objects and pass on the values of\u00a0threeds2.threeDSServerTransID\u00a0and\u00a0YOUR_3DS_METHOD_NOTIFICATION_URL. Next, use helper functions to base64url encode the data, create an iframe, and create a form that will send an HTTP POST to the\u00a0threeDSMethodURL.\nconst perform3DSDeviceFingerprint = (responseData) =&gt;\n{\n    const serverTransactionID = responseData.additionalData['threeds2.threeDSServerTransID'];\n    const threeDSMethodURL = responseData.additionalData['threeds2.threeDSMethodURL'];\n    const threedsContainer = document.getElementById('threedsContainer');\n    const dataObj = {\n        threeDSServerTransID : serverTransactionID,\n        threeDSMethodNotificationURL : YOUR_3DS_METHOD_NOTIFICATION_URL\n    };\n    const stringifiedDataObject = JSON.stringify(dataObj);\n    \/\/ Encode data\n    const base64URLencodedData = base64Url.encode(stringifiedDataObject);\n    const IFRAME_NAME = 'threeDSMethodIframe';\n\n    \/\/ Create hidden iframe\n    const iframe = createIframe(threedsContainer, IFRAME_NAME, '0', '0');\n    \/\/ Create a form that will use the iframe to POST data to the threeDSMethodURL\n    const form =  createForm('threedsMethodForm', threeDSMethodURL, IFRAME_NAME, 'threeDSMethodData', base64URLencodedData);\n    threedsContainer.appendChild(form);\n    setTimeout( function () {\n        threedsContainer.removeChild( form );\n    }, 1000 );\n    form.submit();\n};\n\n\nWait for the issuer's response posted in your\u00a0YOUR_3DS_METHOD_NOTIFICATION_URL\u00a0within 10 seconds after you sent the HTTP POST.\u00a0If do not get any response within 10 seconds, proceed to the next step.\nThe issuer will post the threeDSMethodData. This contains the base64encoded threeDSServerTransID which you can use to identify which request the webhook event is for.\n threeDSMethodData=eyJ0aHJlZURTU2VydmVyVHJhbnNJRCI6ImY4MDYyYjkyLTY2ZTktNGM1YS05NzlhLWY0NjVlNjZhNmU0OCJ9\n {\"threeDSServerTransID\":\"f8062b92-66e9-4c5a-979a-f465e66a6e48\"}\n\nTo trigger your front end to remove the iframe after your webhook receives a response or after 10 seconds has elapsed, see Handling the communication from webhooks to your front end.\n\n\n\nMake a POST\u00a0\/authorise3ds2\u00a0request from your server and include:\n\nthreeDS2Token\nthreeDSCompInd: If you received a response in YOUR_3DS_METHOD_NOTIFICATION_URL within 10 seconds, set this to Y. Otherwise, set this to N.\n\n\nYou can send additional parameters for better authorization rates, and to increase the chance of a frictionless flow. You do not have to send all the additional parameters.  Send parameters that you know you can provide accurately, or that are mandatory in specific scenarios.\n\n\n\n\nYou receive a response containing a\u00a0resultCode\u00a0that can either be:\n\nAuthorised\u00a0\u2013\u00a0Indicates that the\u00a03D Secure 2 authentication was frictionless, and the payment authorisation was successfully completed. This state serves as an indicator to proceed with the delivery of goods and services.\u00a0\nChallengeShopper\u00a0\u2013 The issuer has requested further shopper interaction. Perform the\u00a0Challenge flow.\n\nFor a complete list of\u00a0resultCode\u00a0values and the actions you need to take, see\u00a0Result codes.\n\n\n\n\n\nPresent a challenge\nIf your server receives a\u00a0ChallengeShopper\u00a0resultCode,\u00a0this means that the issuer would like to perform additional checks in order to verify that the shopper is indeed the cardholder.\n\n\nGet the following parameters from the\u00a0\/authorise\u00a0response or from\u00a0\/authorise3ds2\u00a0if you are proceeding from the\u00a0IdentifyShopper\u00a0flow.\n\nthreeds2.threeDS2Token\nthreeds2.threeDS2ResponseData.threeDSServerTransID\nthreeds2.threeDS2ResponseData.acsTransID\nthreeds2.threeDS2ResponseData.messageVersion\n\n\n\nCreate a\u00a0cReqData\u00a0object and pass on the values of\u00a0threeds2.threeDSServerTransID,\u00a0threeds2.threeDS2ResponseData.acsTransID,\u00a0threeds2.threeDS2ResponseData.messageVersion\u00a0and\u00a0challengeWindowSize.\u00a0\nSet the\u00a0challengeWindowSize\u00a0to any of the following specifications:\nidentifiersize\n01\n\n250px x 400px\n\n02\n\n390px x 400px\n\n03\n\n500px x 600px\n\n04\n\n600px x 400px\n\n05\n\n100% x 100%\n\nNext, base64url encode the\u00a0CReq\u00a0message, create an iframe, and create a form that will send an HTTP POST to the\u00a0threeds2.threeDS2ResponseData.acsURL.\nconst perform3DSChallenge = (responseData) =&gt;\n {\n    const challengeWindowSize = validateChallengeWindowSize('04');\/\/ Corresponds to a 600px x 400px iframe size\n\n    \/\/ Extract the ACS hosted url that will provide the content for the challenge iframe\n    const acsURL = responseData.additionalData['threeds2.threeDS2ResponseData.acsURL'];\n\n    \/\/ Collate the data required to make a cReq\n    const cReqData = {\n        threeDSServerTransID : responseData.additionalData['threeds2.threeDS2ResponseData.threeDSServerTransID'],\n        acsTransID : responseData.additionalData['threeds2.threeDS2ResponseData.acsTransID'],\n        messageVersion : responseData.additionalData['threeds2.threeDS2ResponseData.messageVersion'],\n        messageType : 'CReq',\n        challengeWindowSize\n    };\n\n    const stringifiedDataObject = JSON.stringify(cReqData);\n\n    \/\/ Encode data\n    const base64URLencodedData = base64Url.encode(stringifiedDataObject);\n\n    const IFRAME_NAME = 'threeDSChallengeIframe';\n\n    const threedsContainer = document.getElementById('threedsContainer');\n\n    const iframeSizesArr = getChallengeWindowSize(challengeWindowSize);\n\n    \/\/ Create iframe with challenge window dimensions\n    const iframe = createIframe(threedsContainer, IFRAME_NAME, iframeSizesArr[0], iframeSizesArr[1]);\n\n    \/\/ Create a form that will use the iframe to POST data to the acsURL\n    const form =  createForm('cReqForm', acsURL, IFRAME_NAME, 'creq', base64URLencodedData);\n\n    threedsContainer.appendChild(form);\n\n    setTimeout( function () {\n        threedsContainer.removeChild( form );\n    }, 1000 );\n\n    form.submit();\n};\n\n\nWait for the issuer's response which will be posted to\u00a0YOUR_3DS_NOTIFICATION_URL\u00a0within 10 minutes after you sent the HTTP POST.\u00a0 The response will contain the Challenge Response (CRes) in a base64url encoded format. If do not get any response within 10 minutes, proceed to the next step.\ncres=eyJtZXNzYWdlVHlwZSI6IkNSZXMiLCJtZXNzYWdlVmVyc2lvbiI6IjIuMS4wIiwidGhyZWVEU1NlcnZlclRyt...\nOnce you get the response,\u00a0Base64url decode the message and get the\u00a0transStatus\u00a0value.\n{\n  \"messageType\":\"CRes\",\n  \"messageVersion\":\"2.1.0\",\n  \"threeDSServerTransID\":\"5ef630b0-76d0-4fcb-8a17-c81ecc86cff7\",\n  \"acsTransID\":\"1f1bb4cc-05c9-49d0-a82c-e587c914a37b\",\n  \"acsUiType\":\"01\",\n  \"challengeCompletionInd\":\"Y\",\n  \"transStatus\":\"Y\"\n}\n\nTo trigger your front end to remove the iframe after your webhook endpoint receives a response or after 10 minutes has elapsed, see Handling the communication from notification URLs to your front end.\n\n\n\nMake a POST\u00a0\/authorise3ds2\u00a0request from your server and include\u00a0transStatus\u00a0and\u00a0threeds2.threeDS2Token\u00a0parameters.\n\nIf you do not receive a response in YOUR_3DS_NOTIFICATION_URL within 10 minutes, assume that something went wrong or the shopper aborted the transaction. In this case, send transStatus: U\u00a0to Adyen in order to order to finalize the payment.\n\n\n\n\nYou receive\u00a0Authorised\u00a0as the\u00a0resultCode\u00a0if the payment was successful.\n\n\n\n\n\nHandling the communication from notification URLs to your front end\nThe notification URLs\u00a0YOUR_3DS_METHOD_NOTIFICATION_URL\u00a0and\u00a0YOUR_3DS_NOTIFICATION_URL\u00a0on your server are the ideal places from where you should perform the next\u00a0\/authorise3ds2\u00a0request. However, you may want to communicate with your front end after performing the device fingerprinting or after presenting a challenge\u00a0in order to hide the iframes and to perform other actions if needed.\nIn case you do not have an existing implementation for your front end and back end communication, our recommended implementation is to:\n\nUse the\u00a0message\u00a0event on the front end to listen to a\u00a0window.postMessage\u00a0method from the pages running the iframes at the notification URLs. See sample codes below:\n\nAdd this in the notification URLs, running within the iframe:\n&lt;script type=\"text\/javascript\"&gt;\n \/\/ For IdentifyShopper (3DSMethod) flow\n \/\/ NOTE: This redirect of the iframe should have happened within 10 seconds of POST-ing the form to the\n \/\/ threeDSMethodURL otherwise threeDSCompInd should be set to 'N'\n     const data = {\n         type: 'identifyShopper',\n         threeDSCompInd: 'Y'\n     };\n \/\/ For ChallengeShopper flow\n \/\/ NOTE: This redirect of the iframe should have happened within 10 minutes of POST-ing the form\n \/\/ to the acsURL otherwise transStatus should be set to 'U'\n const data = {\n         type: 'challengeShopper',\n         transStatus: 'Y',\n threeDSServerTransID: threeds2.threeDS2ResponseData.threeDSServerTransID\n     };\n\n    window.parent.postMessage(data, YOUR_WEBSITE_DOMAIN);\n\n&lt;\/script&gt;\nAdd this in your website:\nwindow.addEventListener(\"message\", (e) =&gt;\n{\n    if(e.origin === YOUR_HOSTED_DOMAIN_FOR_THE_NOTIFICATION_URLS){\n        const eventData = e.data;\n        \/\/ IdentifyShopper (3DSMethod) response\n        if(eventData.hasOwnProperty('threeDSCompInd')){\n\n            \/\/ If you haven't already performed the next \/authorise3ds2 call from your notification URL this\n            \/\/ represents a good place to initiate the an API request\n            authorise3DS2RequestAfterIdentifyingShopper(eventData.threeDSCompInd);\n        }\n\n        \/\/ Challenge response\n        if(eventData.hasOwnProperty('transStatus') &amp;&amp; eventData.hasOwnProperty('threeDSServerTransID')){\n\n            \/\/ If you haven't already performed the next \/authorise3ds2 call from your notification URL this\n            \/\/ represents a good place to initiate the an API request\n            authorise3DS2RequestAfterChallenge(eventData.transStatus, eventData.threeDSServerTransID);\n        }\n\n        \/\/ Run code to remove the iframe from the '#threedsContainer' element\n        hideIframe();\n    }\n});\nTesting 3D Secure 2\nBefore going live, use the following card numbers and credentials to\u00a0test your integration.\nWe recommend testing each\u00a0Card Type.\nTo test how your integration handles different 3D Secure 2 authentication scenarios, use our test card numbers.\nAll our test cards use the following expiry dates and security codes:\n\n\n\nExpiry Date\nCVC\/CVV\nCID\n\n\n\n\n03\/2030\n737\n7373\n\n\n\nWhen prompted for 3D Secure 2 text challenges, use the following credentials:\n\nFor mobile, use password: 1234\nFor web, use password: password\n\n\n\n\nCard Type\nCard Number\n\n\n\n\nCartes Bancaires\n4035 5014 2814 6300\n\n\nMaestro \n  1\n\n5000 5500 0000 0029\n\n\nMastercard\n5454 5454 5454 5454\n\n\nVisa\n4917 6100 0000 0000\n\n\n\n 1 This card doesn't require a CVC.\nWhen you make a payment request with these cards, you'll receive the following result codes depending on your integration:\n\nRedirectShopper: You'll receive this result code if you are using the Redirect authentication.\nIdentifyShopper:  You'll receive this result code if you are using the Native authentication.\nChallengeShopper: You might get this result code after you submit the 3D Secure 2 device fingerprinting result in a Native authentication, indicating a challenge flow.\n\n\nTo test the web-based flow where the device fingerprinting step is skipped (because the issuer's ACS has not configured a threeDSMethodURL), and you get a ChallengeShopper resultCode immediately after submitting the payment request, use the following card:\n\n\n\nCard Type\nCard Number\n\n\n\n\nVisa\n4212 3456 7891 0006\n\n\n\nTo test the frictionless flow, specify in your payment request:\n\namount.value: 12002\n\nApp-based integration\nTo test different authentication scenarios for app-based integration, use the following test cards:\n\n\n\nCard number\nAuthentication scenario\n\n\n\n\n5201 2855 6567 2311\nBasic text authentication\n\n\n5201 2874 9905 2008\nBasic single select\n\n\n5201 2815 9233 1633\nBasic multi select\n\n\n5201 2888 2269 6974\nBasic out-of-band (OOB) authentication\n\n\n5201 2895 0084 3268\nHTML OOB authentication\n\n\n5201 2861 5377 1465\nApp single select then text authentication\n\n\n\nOther scenarios\n\n\n\nCard number\nScenario\n\n\n\n\n4199 3500 0000 0002\nThe card is not enrolled for 3D Secure transactions,\n\n\n5201 2829 9900 5515\nThere was a technical error.\n\n\n","type":"page","locale":"pt","boost":13,"hierarchy":{"lvl0":"Home","lvl1":"Online payments","lvl2":"Classic integrations for Ecommerce","lvl3":"Classic API integration","lvl4":"3D Secure authentication","lvl5":"Native 3D Secure 2 authentication","lvl6":"Browser-based integration","lvl7":"Helper functions"},"hierarchy_url":{"lvl0":"https:\/\/docs.adyen.com\/pt","lvl1":"https:\/\/docs.adyen.com\/pt\/online-payments","lvl2":"https:\/\/docs.adyen.com\/pt\/online-payments\/classic-integrations","lvl3":"https:\/\/docs.adyen.com\/pt\/online-payments\/classic-integrations\/classic-api-integration","lvl4":"https:\/\/docs.adyen.com\/pt\/online-payments\/classic-integrations\/classic-api-integration\/3d-secure-authentication","lvl5":"https:\/\/docs.adyen.com\/pt\/online-payments\/classic-integrations\/classic-api-integration\/3d-secure-authentication\/native-3ds2","lvl6":"https:\/\/docs.adyen.com\/pt\/online-payments\/classic-integrations\/classic-api-integration\/3d-secure-authentication\/native-3ds2\/browser-based-integration","lvl7":"\/pt\/online-payments\/classic-integrations\/classic-api-integration\/3d-secure-authentication\/native-3ds2\/browser-based-integration\/3d-secure-2-helper-functions"},"levels":8,"category":"Online Payments","category_color":"green","tags":["Helper","functions"]},"articleFiles":{"request--submit-challenge-result-2965743395.js":"<p alt=\"\">request--submit-challenge-result-2965743395.js<\/p>","request--submit-device-fingerprint-1431002943.js":"<p alt=\"\">request--submit-device-fingerprint-1431002943.js<\/p>","request-9483156992.js":"<p alt=\"\">request-9483156992.js<\/p>"}}
