--- title: "Helper functions" description: "Simplify your 3D Secure 2 implementation web implementation with our helper functions." url: "https://docs.adyen.com/online-payments/classic-integrations/classic-api-integration/3d-secure-authentication/native-3ds2/browser-based-integration/3d-secure-2-helper-functions" source_url: "https://docs.adyen.com/online-payments/classic-integrations/classic-api-integration/3d-secure-authentication/native-3ds2/browser-based-integration/3d-secure-2-helper-functions.md" canonical: "https://docs.adyen.com/online-payments/classic-integrations/classic-api-integration/3d-secure-authentication/native-3ds2/browser-based-integration/3d-secure-2-helper-functions" last_modified: "2019-08-05T11:17:00+02:00" language: "en" --- # Helper functions Simplify your 3D Secure 2 implementation web implementation with our helper functions. [View source](/online-payments/classic-integrations/classic-api-integration/3d-secure-authentication/native-3ds2/browser-based-integration/3d-secure-2-helper-functions.md) **Adyen is no longer developing the Classic API integration** This page is for the Classic API (`/authorise`) integration, which we no longer accept new integrations with. We strongly recommend migrating to the newer [3D Secure 2 helper functions on Checkout API](/checkout-build-your-own-3ds2/checkout-api-helper-functions) integration. To use this newer integration, you must also [migrate to the Checkout API](/online-payments/upgrade-your-integration/migrate-to-checkout-api). Use our helper functions to: * Collect browser info and store data in properties required in the EMVCo specifications. * Perform base64url encoding and decoding. * Create an iframe with an onload event listener for the 3D Secure 2 device fingerprinting and challenge results. * Create a form with a target attribute to send the issuer requests for 3D Secure 2 device fingerprinting and the challenge. * Configure the challenge window size according to the EMVCo specifications. 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 [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other). ## Before you begin Before you begin to integrate, make sure you have followed the [Get started with Adyen guide](/get-started-with-adyen) to: * Get an overview of the steps needed to accept live payments. * Create your test account. After you have created your test account: 1. [Get your API Key](/development-resources/api-credentials#generate-api-key). Save a copy as you'll need it for API calls you make to the Adyen payments platform. 2. Install one of our [Libraries](/development-resources/libraries) to connect with the Adyen APIs. For more information on these steps, refer to [Get started with Adyen](/get-started-with-adyen). 3. 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. * `YOUR_3DS_METHOD_NOTIFICATION_URL`: Absolute URL to where the issuer can post the result of the 3D Secure device fingerprinting process.  * `YOUR_3DS_NOTIFICATION_URL`: Absolute URL to where the issuer can post a base64url encoded Challenge Response (`CRes`) message, containing the challenge result. 4. Import our helper functions by: * Cloning our repository from  and importing the files into your project.  ```js import collectBrowserInfo from "./browser"; import base64Url from "./base64url"; import createIframe from "./iframe"; import createForm from "./form"; import {validateChallengeWindowSize, getChallengeWindowSize} from "./config.js"; ``` * Or by building the file, hosting it, and then embedding it in your page.  ```xml ``` Add this in your website: ```js window.addEventListener("message", (e) => { if(e.origin === YOUR_HOSTED_DOMAIN_FOR_THE_NOTIFICATION_URLS){ const eventData = e.data; // IdentifyShopper (3DSMethod) response if(eventData.hasOwnProperty('threeDSCompInd')){ // If you haven't already performed the next /authorise3ds2 call from your notification URL this // represents a good place to initiate the an API request authorise3DS2RequestAfterIdentifyingShopper(eventData.threeDSCompInd); } // Challenge response if(eventData.hasOwnProperty('transStatus') && eventData.hasOwnProperty('threeDSServerTransID')){ // If you haven't already performed the next /authorise3ds2 call from your notification URL this // represents a good place to initiate the an API request authorise3DS2RequestAfterChallenge(eventData.transStatus, eventData.threeDSServerTransID); } // Run code to remove the iframe from the '#threedsContainer' element hideIframe(); } }); ``` ## Testing 3D Secure 2 Before going live, use the following card numbers and credentials to test your integration. We recommend testing each **Card Type**. To test how your integration handles different 3D Secure 2 authentication scenarios, use our test card numbers. All our test cards use the following expiry dates and security codes: | Expiry Date | CVC/CVV | CID | | ----------- | ------- | ---- | | 03/2030 | 737 | 7373 | When prompted for 3D Secure 2 text challenges, use the following credentials: * For mobile, use password: **1234** * For web, use password: **password** | Card Type | Card Number | | ------------------- | ------------------- | | Cartes Bancaires | 4035 5014 2814 6300 | | Maestro [1](#nocvc) | 5000 5500 0000 0029 | | Mastercard | 5454 5454 5454 5454 | | Visa | 4917 6100 0000 0000 | []()1 This card doesn't require a CVC. When you make a payment request with these cards, you'll receive the following result codes depending on your integration: * **RedirectShopper**: You'll receive this result code if you are using the [Redirect authentication](/online-payments/classic-integrations/classic-api-integration/3d-secure-authentication/3d-secure-1). * **IdentifyShopper**: You'll receive this result code if you are using the [Native authentication](/online-payments/classic-integrations/classic-api-integration/3d-secure-authentication/native-3ds2). * **ChallengeShopper**: You might get this result code after you submit the 3D Secure 2 device fingerprinting result in a Native authentication, indicating a challenge flow. To 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: | Card Type | Card Number | | --------- | ------------------- | | Visa | 4212 3456 7891 0006 | To test the frictionless flow, specify in your payment request: * `amount.value`: **12002** #### App-based integration To test different authentication scenarios for app-based integration, use the following test cards: | Card number | Authentication scenario | | ------------------- | ------------------------------------------ | | 5201 2855 6567 2311 | Basic text authentication | | 5201 2874 9905 2008 | Basic single select | | 5201 2815 9233 1633 | Basic multi select | | 5201 2888 2269 6974 | Basic out-of-band (OOB) authentication | | 5201 2895 0084 3268 | HTML OOB authentication | | 5201 2861 5377 1465 | App single select then text authentication | #### Other scenarios | Card number | Scenario | | ------------------- | ---------------------------------------------------- | | 4199 3500 0000 0002 | The card is not enrolled for 3D Secure transactions, | | 5201 2829 9900 5515 | There was a technical error. |