{"title":"Drop-in optional configuration","category":"default","creationDate":1781186417,"content":"<p>You can add configuration for additional customization of the payment flow.<\/p>\n<h2 id=\"import-drop-in-with-individual-payment-methods\">Import Drop-in with individual payment methods<\/h2>\n<p>To reduce bundle size, you can use <a href=\"https:\/\/webpack.js.org\/guides\/tree-shaking\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">tree shaking<\/a> to import only the payment methods you use. The smaller bundle size speeds up loading time. When you add a payment method after creating your integration, you must also import it.<\/p>\n<p>Install the <a href=\"https:\/\/www.npmjs.com\/package\/@adyen\/adyen-web\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Adyen Web Node package<\/a>:<\/p>\n<div data-component-wrapper=\"code-sample\">\n    <code-sample :title=\"''\" :id=\"''\" :code-data='[{\"language\":\"bash\",\"tabTitle\":\"\",\"content\":\"npm install @adyen\\\/adyen-web --save\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>Import Adyen Web into your application.<\/p>\n<div data-component-wrapper=\"code-sample\">\n    <code-sample :title=\"''\" :id=\"''\" :code-data=\"[{&quot;language&quot;:&quot;js&quot;,&quot;tabTitle&quot;:&quot;&quot;,&quot;content&quot;:&quot;import { AdyenCheckout, Dropin, Card, GooglePay, PayPal } from '@adyen\\\/adyen-web';\\nimport '@adyen\\\/adyen-web\\\/styles\\\/adyen.css';&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>When you import individual payment methods, you must include the <code>paymentMethodComponents<\/code> parameter in your <a href=\"#dropin\">Drop-in configuration<\/a>, specifying an array of the payment methods you imported.<\/p>\n<h2>AdyenCheckout object<\/h2>\n<p>The <code>AdyenCheckout<\/code> object represents one payment <a href=\"#create-payment-session\">session<\/a>. When you create it, you can set additional configuration parameters and event handlers.<\/p>\n<h3>Configuration parameters<\/h3>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">Parameter name<\/th>\n<th style=\"text-align: center;\">Required<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\"><code>secondaryAmount<\/code><\/td>\n<td style=\"text-align: center;\"><\/td>\n<td>Shows the payment amount in an additional currency on the <strong>Pay<\/strong> button. You must do the currency conversion and set the amount. <br> This object has properties: <ul> <li markdown=\"1\"><code>currency<\/code>: The three-character <a href=\"\/development-resources\/currency-codes\">ISO currency code<\/a>.<\/li> <li markdown=\"1\"><code>value<\/code>: The amount of the transaction, in <a href=\"\/development-resources\/currency-codes\">minor units<\/a>.<\/li> <li markdown=\"1\"><code>currencyDisplay<\/code>: Sets the <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Global_Objects\/Intl\/NumberFormat\/NumberFormat#currencydisplay\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">currency formatting<\/a>. Default: <strong>symbol<\/strong>.<\/li> <ul><\/td>\n<\/tr>\n<tr>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><code>donation<\/code><\/td>\n<td style=\"text-align: center;\"><\/td>\n<td>An object for configuring <a href=\"\/standard\/integration\/drop-in\/donations\">donations<\/a>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Event handlers<\/h3>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">Event handler name<\/th>\n<th style=\"text-align: center;\">Required<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\"><code>beforeSubmit(data, component, actions)<\/code><\/td>\n<td style=\"text-align: center;\"><\/td>\n<td>Create an event handler, called when the shopper selects the <strong>Pay<\/strong> button. <br> Allows you to add parameters to the  payment request that Drop-in makes. For example, you can add shopper details like <a href=\"https:\/\/docs.adyen.com\/api-explorer\/#\/CheckoutService\/latest\/post\/payments__reqParam_billingAddress\" class=\"codeLabel external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\n  <code>billingAddress<\/code>\n<\/a>, <a href=\"https:\/\/docs.adyen.com\/api-explorer\/#\/CheckoutService\/latest\/post\/payments__reqParam_deliveryAddress\" class=\"codeLabel external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\n  <code>deliveryAddress<\/code>\n<\/a>, <a href=\"https:\/\/docs.adyen.com\/api-explorer\/#\/CheckoutService\/latest\/payments__reqParam_shopperEmail\" class=\"codeLabel external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\n  <code>shopperEmail<\/code>\n<\/a>, or <a href=\"https:\/\/docs.adyen.com\/api-explorer\/#\/CheckoutService\/latest\/payments__reqParam_shopperName\" class=\"codeLabel external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\n  <code>shopperName<\/code>\n<\/a>. When the <code>beforeSubmit<\/code> event is triggered, you need to continue or stop the payment flow using methods available in the event handler: <ul><li markdown=\"1\">Continue the payment flow (<code>actions.resolve()<\/code>): You should call the <code>actions.resolve()<\/code> method regardless of the <code>resultCode<\/code>, including when the payment is unsuccessful.<\/li><li markdown=\"1\">Stop the payment flow (<code>actions.reject()<\/code>): Stop the payment flow only when your server-side API request to Adyen failed, or when experiencing network connection issues.<\/li><\/ul><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><a id=\"on-action-handled\"><\/a><code>onActionHandled<\/code><\/td>\n<td style=\"text-align: center;\"><\/td>\n<td>Create an event handler, called when an action, for example a QR code or 3D Secure 2 authentication screen, is shown to the shopper. The following <code>action.type<\/code> values trigger this callback: <ul> <li markdown=\"1\"><code>threeDS<\/code><\/li> <li markdown=\"1\"><code>qr<\/code><\/li> <li markdown=\"1\"><code>await<\/code><\/li> <\/ul> Returns data that contains: <ul> <li markdown=\"1\"><code>componentType<\/code>: The type of component that shows the action to the shopper.<\/li> <li markdown=\"1\"><code>actionDescription<\/code>: A description of the action shown to the shopper.<\/li> <\/ul><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><code>onChange(state, component)<\/code><\/td>\n<td style=\"text-align: center;\"><\/td>\n<td>Create an event handler, called when a change happens in the payment form.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Drop-in instance<\/h2>\n<p>The instance of <code>Dropin<\/code> represents the UI that the shopper interacts with to make a payment.<\/p>\n<h3>Configuration parameters<\/h3>\n<table>\n<thead>\n<tr>\n<th>Parameter name<\/th>\n<th>Required<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>paymentMethodComponents<\/code><\/td>\n<td>If you <a href=\"#import-drop-in-with-individual-payment-methods\">imported Drop-in with individual payment methods<\/a>.<\/td>\n<td>An array of the payment methods that you imported. For example: <code>[Card, PayPal, GooglePay, ApplePay, Ideal]<\/code>.<\/td>\n<\/tr>\n<tr>\n<td><span id=\"payment-methods-configuration-parameter\"><code>paymentMethodsConfiguration<\/code><\/span><\/td>\n<td><\/td>\n<td>Configuration for individual payment methods. The <a href=\"\/payment-methods\">payment method guide<\/a> for the individual payment method shows required and optional configuration. <br> If you include this in the configuration on your instance of <code>Dropin<\/code>, it overrides global payment method configuration on your instance of <code>AdyenCheckout<\/code>.<\/td>\n<\/tr>\n<tr>\n<td><code>openFirstPaymentMethod<\/code><\/td>\n<td><\/td>\n<td>When enabled, Drop-in opens the first payment method automatically on page load. <br> Default value: <strong>true<\/strong>.<\/td>\n<\/tr>\n<tr>\n<td><code>openFirstStoredPaymentMethod<\/code><\/td>\n<td><\/td>\n<td>When enabled, Drop-in opens the payment method with stored card details on page load. This option takes precedence over <code>openFirstPaymentMethod<\/code>. <br> Default value: <strong>true<\/strong>.<\/td>\n<\/tr>\n<tr>\n<td><code>openPaymentMethod.type<\/code><\/td>\n<td><\/td>\n<td>Automatically selects the specified payment method when Drop-in renders. Set the <a href=\"\/payment-methods\/payment-method-types\/\">payment method type<\/a> that you want to be automatically selected as the value.<\/td>\n<\/tr>\n<tr>\n<td><code>showStoredPaymentMethods<\/code><\/td>\n<td><\/td>\n<td>Shows or hides payment methods with stored card details. <br> Default value: <strong>true<\/strong>.<\/td>\n<\/tr>\n<tr>\n<td><code>showRemovePaymentMethodButton<\/code><\/td>\n<td><\/td>\n<td>Allows the shopper to remove a stored payment method. <br> Default value: <strong>false<\/strong>. <br> If using this prop, you must also implement the <code>onDisableStoredPaymentMethod<\/code> callback.<\/td>\n<\/tr>\n<tr>\n<td><code>showPaymentMethods<\/code><\/td>\n<td><\/td>\n<td>Shows or hides regular (not stored) payment methods. Set to <strong>false<\/strong>  if you only want to show payment methods with stored card details. <br> Default value: <strong>true<\/strong>.<\/td>\n<\/tr>\n<tr>\n<td><code>paymentMethodsConfiguration<\/code><\/td>\n<td><\/td>\n<td>Configuration for individual payment methods. The <a href=\"\/payment-methods\">payment method guides<\/a> have configuration options specific to each payment method. <br> If you include this in the configuration on your instance of <code>DropIn<\/code>, it overrides global payment method configuration on your instance of <code>AdyenCheckout<\/code>.<\/td>\n<\/tr>\n<tr>\n<td><code>redirectFromTopWhenInIframe<\/code><\/td>\n<td><\/td>\n<td>If your Drop-in is inside of an <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/iframe\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">iframe element<\/a>, set to <strong>true<\/strong> if you want redirects to be performed on the top-level window. <br> We recommend that you do not put Drop-in in an iframe.<\/td>\n<\/tr>\n<tr>\n<td><code>instantPaymentTypes<\/code><\/td>\n<td><\/td>\n<td>Moves payment methods to the top of the list of available payment methods. This is available for <a href=\"\/payment-methods\/apple-pay\/web-drop-in#instant-payment-button-configuration\">Apple Pay<\/a> and <a href=\"\/payment-methods\/google-pay\/web-drop-in#instant-payment-button-configuration\">Google Pay<\/a>.<\/td>\n<\/tr>\n<tr>\n<td><code>disableFinalAnimation<\/code><\/td>\n<td><\/td>\n<td>When enabled, disables the final animation after a shopper completes the payment (whether successful or failed). This lets you implement your own post-payment UI. <br> Default value: <strong>false<\/strong>.<\/td>\n<\/tr>\n<tr>\n<td><code>showRadioButton<\/code><\/td>\n<td><\/td>\n<td>When enabled, payment methods in the Drop-in have a <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Element\/input\/radio\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">radio button<\/a>. <br> Default value: <strong>false<\/strong>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Event handlers<\/h3>\n<table>\n<thead>\n<tr>\n<th>Event handler name<\/th>\n<th><\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>onReady()<\/code><\/td>\n<td><\/td>\n<td>Called when Drop-in is initialized and is ready for use.<\/td>\n<\/tr>\n<tr>\n<td><code>onSelect(component)<\/code><\/td>\n<td><\/td>\n<td>Called when the shopper selects a payment method.<\/td>\n<\/tr>\n<tr>\n<td><code>onDisableStoredPaymentMethod(storedPaymentMethodId, resolve, reject)<\/code><\/td>\n<td><\/td>\n<td>Called when a shopper removes a stored payment method. To remove the selected payment method, make a <strong>DELETE<\/strong> <code>storedPaymentMethods<\/code> request using the <code>storedPaymentMethodId<\/code>. Then call either <code>resolve()<\/code> or <code>reject()<\/code>, depending on the  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/delete\/storedPaymentMethods\/(storedPaymentMethodId)\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/storedPaymentMethods\/{storedPaymentMethodId}<\/a> response.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div data-component-wrapper=\"code-sample\">\n    <code-sample :title=\"'Drop-in configuration (when importing individual payment methods)'\" :id=\"''\" :code-data=\"[{&quot;language&quot;:&quot;js&quot;,&quot;tabTitle&quot;:&quot;&quot;,&quot;content&quot;:&quot;const dropinConfiguration = {\\n   \\\/\\\/ Required if you import individual payment methods.\\n   paymentMethodComponents: [Card, PayPal, GooglePay, ApplePay, Ideal],\\n   \\\/\\\/ Optional configuration.\\n   onReady: () =&gt; {},\\n   instantPaymentTypes: ['applepay', 'googlepay']\\n};&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<h2>See also<\/h2>\n<div class=\"see-also-links output-inline\" id=\"see-also\">\n<ul><li><a href=\"\/standard\/integration\/drop-in\/optional-server-configuration\"\n                        target=\"_self\"\n                        >\n                    Optional server configuration\n                <\/a><\/li><li><a href=\"\/standard\/integration\/drop-in\/customize-checkout\"\n                        target=\"_self\"\n                        >\n                    Customize the checkout experience\n                <\/a><\/li><\/ul><\/div>\n","url":"https:\/\/docs.adyen.com\/standard\/integration\/drop-in\/optional-drop-in-configuration","articleFields":{"description":"Add optional configuration to your Drop-in integration."},"algolia":{"url":"https:\/\/docs.adyen.com\/standard\/integration\/drop-in\/optional-drop-in-configuration","title":"Drop-in optional configuration","content":"You can add configuration for additional customization of the payment flow.\nImport Drop-in with individual payment methods\nTo reduce bundle size, you can use tree shaking to import only the payment methods you use. The smaller bundle size speeds up loading time. When you add a payment method after creating your integration, you must also import it.\nInstall the Adyen Web Node package:\n\n    \n\nImport Adyen Web into your application.\n\n    \n\nWhen you import individual payment methods, you must include the paymentMethodComponents parameter in your Drop-in configuration, specifying an array of the payment methods you imported.\nAdyenCheckout object\nThe AdyenCheckout object represents one payment session. When you create it, you can set additional configuration parameters and event handlers.\nConfiguration parameters\n\n\n\nParameter name\nRequired\nDescription\n\n\n\n\nsecondaryAmount\n\nShows the payment amount in an additional currency on the Pay button. You must do the currency conversion and set the amount.  This object has properties:  currency: The three-character ISO currency code. value: The amount of the transaction, in minor units. currencyDisplay: Sets the currency formatting. Default: symbol. \n\n\n\n\ndonation\n\nAn object for configuring donations.\n\n\n\nEvent handlers\n\n\n\nEvent handler name\nRequired\nDescription\n\n\n\n\nbeforeSubmit(data, component, actions)\n\nCreate an event handler, called when the shopper selects the Pay button.  Allows you to add parameters to the  payment request that Drop-in makes. For example, you can add shopper details like \n  billingAddress\n, \n  deliveryAddress\n, \n  shopperEmail\n, or \n  shopperName\n. When the beforeSubmit event is triggered, you need to continue or stop the payment flow using methods available in the event handler: Continue the payment flow (actions.resolve()): You should call the actions.resolve() method regardless of the resultCode, including when the payment is unsuccessful.Stop the payment flow (actions.reject()): Stop the payment flow only when your server-side API request to Adyen failed, or when experiencing network connection issues.\n\n\nonActionHandled\n\nCreate an event handler, called when an action, for example a QR code or 3D Secure 2 authentication screen, is shown to the shopper. The following action.type values trigger this callback:  threeDS qr await  Returns data that contains:  componentType: The type of component that shows the action to the shopper. actionDescription: A description of the action shown to the shopper. \n\n\nonChange(state, component)\n\nCreate an event handler, called when a change happens in the payment form.\n\n\n\nDrop-in instance\nThe instance of Dropin represents the UI that the shopper interacts with to make a payment.\nConfiguration parameters\n\n\n\nParameter name\nRequired\nDescription\n\n\n\n\npaymentMethodComponents\nIf you imported Drop-in with individual payment methods.\nAn array of the payment methods that you imported. For example: [Card, PayPal, GooglePay, ApplePay, Ideal].\n\n\npaymentMethodsConfiguration\n\nConfiguration for individual payment methods. The payment method guide for the individual payment method shows required and optional configuration.  If you include this in the configuration on your instance of Dropin, it overrides global payment method configuration on your instance of AdyenCheckout.\n\n\nopenFirstPaymentMethod\n\nWhen enabled, Drop-in opens the first payment method automatically on page load.  Default value: true.\n\n\nopenFirstStoredPaymentMethod\n\nWhen enabled, Drop-in opens the payment method with stored card details on page load. This option takes precedence over openFirstPaymentMethod.  Default value: true.\n\n\nopenPaymentMethod.type\n\nAutomatically selects the specified payment method when Drop-in renders. Set the payment method type that you want to be automatically selected as the value.\n\n\nshowStoredPaymentMethods\n\nShows or hides payment methods with stored card details.  Default value: true.\n\n\nshowRemovePaymentMethodButton\n\nAllows the shopper to remove a stored payment method.  Default value: false.  If using this prop, you must also implement the onDisableStoredPaymentMethod callback.\n\n\nshowPaymentMethods\n\nShows or hides regular (not stored) payment methods. Set to false  if you only want to show payment methods with stored card details.  Default value: true.\n\n\npaymentMethodsConfiguration\n\nConfiguration for individual payment methods. The payment method guides have configuration options specific to each payment method.  If you include this in the configuration on your instance of DropIn, it overrides global payment method configuration on your instance of AdyenCheckout.\n\n\nredirectFromTopWhenInIframe\n\nIf your Drop-in is inside of an iframe element, set to true if you want redirects to be performed on the top-level window.  We recommend that you do not put Drop-in in an iframe.\n\n\ninstantPaymentTypes\n\nMoves payment methods to the top of the list of available payment methods. This is available for Apple Pay and Google Pay.\n\n\ndisableFinalAnimation\n\nWhen enabled, disables the final animation after a shopper completes the payment (whether successful or failed). This lets you implement your own post-payment UI.  Default value: false.\n\n\nshowRadioButton\n\nWhen enabled, payment methods in the Drop-in have a radio button.  Default value: false.\n\n\n\nEvent handlers\n\n\n\nEvent handler name\n\nDescription\n\n\n\n\nonReady()\n\nCalled when Drop-in is initialized and is ready for use.\n\n\nonSelect(component)\n\nCalled when the shopper selects a payment method.\n\n\nonDisableStoredPaymentMethod(storedPaymentMethodId, resolve, reject)\n\nCalled when a shopper removes a stored payment method. To remove the selected payment method, make a DELETE storedPaymentMethods request using the storedPaymentMethodId. Then call either resolve() or reject(), depending on the  \/storedPaymentMethods\/{storedPaymentMethodId} response.\n\n\n\n\n    \n\nSee also\n\n\n                    Optional server configuration\n                \n                    Customize the checkout experience\n                \n","type":"page","locale":"en","boost":16,"hierarchy":{"lvl0":"Home","lvl1":"Standard payments integration","lvl2":"Build your integration","lvl3":"Drop-in","lvl4":"Drop-in optional configuration"},"hierarchy_url":{"lvl0":"https:\/\/docs.adyen.com\/","lvl1":"https:\/\/docs.adyen.com\/standard","lvl2":"https:\/\/docs.adyen.com\/standard\/integration","lvl3":"https:\/\/docs.adyen.com\/standard\/integration\/drop-in","lvl4":"\/standard\/integration\/drop-in\/optional-drop-in-configuration"},"levels":5,"category":"","category_color":"","tags":["Drop-in","optional","configuration"]}}
