Benefits to upgrading
Read our release notes to learn about the benefits of upgrading. To upgrade from Web Drop-in/Components v3.x.x to v6.0.0, complete the following steps. If you are upgrading from a later version, you need to follow a different upgrade guide:Required API version
Using Web Drop-in/Components v6.0.0 requires Checkout API v69 or later.Step 1: Use the new package
- npm (recommended)
- Embed script and stylesheet
- Drop-in
- Components
- Drop-in
- Components
- Drop-in
- Card Component
Install this version of the Adyen Drop-in/Components Node.js package:
npm install @adyen/adyen-web@latest --save
Find the Subresource Integrity hashes for the latest version in our release notes.The base URLs for the script source are different for each environment. Use the one that corresponds to your live endpoint:
| Environment | URL |
|---|---|
| Test | https://checkoutshopper-test.cdn.adyen.com |
| Europe (EU) live | https://checkoutshopper-live.cdn.adyen.com |
| United States (US) live | https://checkoutshopper-live-us.cdn.adyen.com |
| Australia (AU) live | https://checkoutshopper-live-au.cdn.adyen.com |
| Northeast Asia (NEA) live | https://checkoutshopper-live-nea.cdn.adyen.com |
| India (IN) live | https://checkoutshopper-live-in.cdn.adyen.com |
<script src="https://checkoutshopper-test.cdn.adyen.com/checkoutshopper/sdk/6.0.0/adyen.js"
integrity="sha384-GDA6txYXS6ka6zCgDtLmgI80TQMlYST32KjDtdiyFi/k/zp9rXP64qbziIXVOI5h"
crossorigin="anonymous"></script>
<link rel="stylesheet"
href="https://checkoutshopper-test.cdn.adyen.com/checkoutshopper/sdk/6.0.0/adyen.css"
integrity="sha384-Gngchfiq4JxdVPMOwrUaDK70raLnMJ7IgBKi2OE0VSlbUeHysN7Mwd4aHREEvEAw"
crossorigin="anonymous">
Step 2: Update import statements
You can import Drop-in using npm or by embedding the scripts.To add new payment methods, you only need to add the payment method to you account.To add new payment methods, you need to:From v6 onwards, the
Using npm
Starting from Drop-in v6, we offer two ways of importing with npm:- Import Drop-in with all payment methods: this method resembles what you are used to before v6. You do not need to import individual payment methods, at the cost of a slower loading time.
- Import Drop-in with individual payment methods: this method uses tree shaking to let you import only the payment methods you use, speeding up loading time. However, adding new payment methods requires developer resources.
Import Drop-in with all payment methods
This method of importing resembles what you were used to before v6. With this method, you do not need to import every individual payment method for Drop-in. This allows for a simpler integration where adding a new payment method doesn’t require any development resources.However, this results in a larger bundle size and slower loading times, as all module exports are imported client-side. If a smaller bundle size and faster page load times is a priority to you, consider importing Drop-in with individual payment methods.For example, to load the Drop-in with all available payment methods:import { AdyenCheckout, Dropin } from '@adyen/adyen-web/auto'
Import Drop-in with individual payment methods
Our tree-shakable@adyen/adyen-web npm package lets your import only the Components you use. This reduces the bundle size and loading times.For example, to load the Drop-in with card payments, PayPal, Google Pay, Apple Pay and Cash App Pay:import { AdyenCheckout, Dropin, Card, PayPal, GooglePay, ApplePay, CashAppPay} from '@adyen/adyen-web'
- Add the payment methods to you account.
- Import them (see code sample above).
- Assign them to the
paymentMethodComponentsproperty within the Drop-in configuration.
Using embedded scripts
After you import the scripts, the Drop-in/Components resources are available on thewindow global variable.Before v6, you would use the window.AdyenCheckout() method to create an instance of AdyenCheckout:Before v6const checkout = new window.AdyenCheckout({ /* Configuration */ });
AdyenCheckout() function is a property of window.AdyenWeb, alongside Dropin and all the payment method-specific Components:From v6 onwardsconst { AdyenCheckout, Dropin, Card } = window.AdyenWeb;
const checkout = await AdyenCheckout({ /* Configuration */ });
You can import Components using npm or by embedding the scripts.For an overview of available Components, see The library’s Component exports. To know what Component you need for your payment methods, go to the payment method pages.If you do not find a specific Component for a payment method, and the payment method redirects the shopper, use the From v6 onwards, the
From v6 onwards**
**
**
**
Using npm
We’re introducing more granular imports for the@adyen/adyen-web package to let you load only the Components that you need, reducing the bundle size and improving overall performance.For example, to load only the card Component:import { AdyenCheckout, Card } from '@adyen/adyen-web'
Redirect Component. For example, for iDEAL:Use the Redirect Component for iDEALnew Redirect(checkout, { type: 'ideal' });
Using embedded scripts
After you import the scripts, the Drop-in/Components resources are available on thewindow global variable.Before v6, you would use the window.AdyenCheckout() method to create an instance of AdyenCheckout:Before v6const checkout = new window.AdyenCheckout({ /* Configuration */ });
AdyenCheckout() function is and property of window.AdyenWeb, alongside all the payment method-specific Components:From v6 onwardsconst { AdyenCheckout, Card, PayPal } = window.AdyenWeb;
Step 3: Update your configuration
Make the following changes to your configuration properties:countryCodeis now a mandatory configuration property. Set it during theAdyenCheckoutinitialization.- If you use the Sessions flow, you can also set
countryCodein the /sessions request.
- If you use the Sessions flow, you can also set
- The
setStatusAutomaticallyproperty is no longer used. To disable the Drop-in animation, setdisableFinalAnimationto true. - You can no longer set
installmentOptionsduring theAdyenCheckoutinstantiation. Set it directly in the Card configuration instead. - You can no longer set
paymentMethodsConfigurationduring theAdyenCheckoutinstantiation. Set it directly in the Drop-in configuration instead. - The
showBrandsUnderCardNumberproperty is no longer used. Update your code accordingly. - The
showFormInstructionproperty is no longer used. Update your code accordingly. - If you integrate with the custom card component, use the
onValidationError()event listener to access the field errors. - The
originKeyis no longer supported. Migrate to client key.
Component specific configuration
For certain components, some deprecated props were removed. Make sure that your integration uses the remaining props.**Card component and Custom card component
| Removed prop | Prop to use instead |
|---|---|
groupTypes | brands |
size | challengeWindowSize |
ariaLabels | No longer supported. Use translation fields instead. |
Configure aria labels through translation fields
Configuringaria-label attributes using the ariaLabels field inside the component is no longer supported. In v6, Aria-label attributes are read from translation fields.You can no longer configure the label property, the label is added automatically, aligning with the visual label for the field. This is to follow accessibility best practices.Before v6const customCard = checkout.create('securedfields', {
...
ariaLabels: {
lang: "en-US",
encryptedCardNumber: {
label: "Card number field",
iframeTitle: "Iframe for secured card number"
},
...
}
...
}).mount('#customCard-container');
const checkout = await AdyenCheckout({
locale: 'en-US',
translations: {
'en-US': {
"creditCard.encryptedCardNumber.aria.iframeTitle": "Iframe for secured card number",
}
}
/* ...Your other configurations */
});
Apple Pay component
| Removed prop | Prop to use instead |
|---|---|
amount | No longer needs to be configured. The Drop-in/Component takes this from the amount.value, passed to AdyenCheckout. |
currencyCode | No longer needs to be configured. The Drop-in/Component takes this from the amount.currency, passed to AdyenCheckout. |
configuration.merchantDisplayName | No longer needs to be configured. This value is returned when you make a /sessions request for the Sessions flow, or /paymentMethods request for the Advanced flow. |
configuration.merchantIdentifier | No longer needs to be configured. This value is returned when you make a /sessions request for the Sessions flow, or /paymentMethods request for the Advanced flow. |
Google Pay component
| Removed prop | Prop to use instead |
|---|---|
showButton | showPayButton |
merchantIdentifier | No longer supported. This value is returned when you make a /sessions request for the Sessions flow, or /paymentMethods request for the Advanced flow. |
IssuerList component
If you are configuring a list of issuers using theIssuerList component, make sure you use the issuers prop.This applies to the following payment methods: MOLPay, EPS, OpenBanking UK, Online Banking India, and Indian wallet or online payments through Billdesk or PayU.| Removed prop | Prop to use instead |
|---|---|
items | issuers |
Paypal component
| Removed prop | Prop to use instead |
|---|---|
intent | configuration.intent |
merchantId | configuration.merchantId |
Step 4: Update creating an instance
In earlier versions of Drop-in/Components, creating an instance of a Component or the Drop-in used theAdyenCheckout.create() method. We’ve updated this to use a constructor function instead.Before v6, creating an instance of Drop-in was as follows:Before v6From v6 onwards, creating an instance of Drop-in is as follows:From v6 onwardsIf you import through npm auto or embedded scripts, you do not need to set
const checkout = new AdyenCheckout({ /* Configuration */ });
const dropin = checkout.create('dropin').mount('#dropin')
const checkout = await AdyenCheckout({ /* Configuration */ });
const dropin = new Dropin(checkout, {
paymentMethodComponents: [Card, PayPal, GooglePay] // Only needed with tree-shakable npm package
paymentMethodsConfiguration: { /* Configuration */ }
}).mount('#dropin')
paymentMethodComponents.The Drop-in constructor function takes two positional arguments:- Your instance of
AdyenCheckout. - Your Drop-in configuration.
Before v6, creating an instance of the Card Component is as follows:Before v6From v6 onwards, creating an instance of the Card Component is as follows:From v6 onwardsThe Component constructor function takes two positional arguments:
The
These events handlers now have access to the new
This event now works both in the Sessions Flow and Advanced Flow.This event is no longer triggered for failed payments. For failed payments, we now use the
This is a new event, which is triggered when a payment fails. Previously, this event was part of
These events are used for partial payments.The
The
const checkout = new AdyenCheckout({ /* Configuration */ });
const card = checkout.create('card', {
hideCVC: true,
enableStoreDetails: true
}).mount('#card');
const checkout = await AdyenCheckout({
// configuration
});
const card = new Card(checkout, {
hideCVC: true,
enableStoreDetails: true
}).mount('#card');
- Your instance of
AdyenCheckout. - Your payment method-specific configuration.
Step 5: Update your event handlers
In v6, we’re introducing changes to several of the library’s event handlers:onValid
The onValid() event listener is no longer used. Remove it from your configuration.onSubmit and onAdditionalDetails
These events handlers now have access to the new actions parameter, which lets you:-
Continue the payment flow:
actions.resolve(). Callactions.resolve()and pass theresultCode, also when the payment is unsuccessful. -
Stop the payment flow:
actions.reject(). Stop the payment flow only in the following cases:- When your server’s request to Adyen’s API fails.
- When you experience network connection issues.
actions object to manage the payment flow, for example:const checkout = await AdyenCheckout({
// Insert your global configuration here
onSubmit: async (state, component, actions) => {
try {
const { action, order, resultCode, donationToken } = await makePayment(state.data);
if (!resultCode) actions.reject();
actions.resolve({
resultCode,
action,
order,
donationToken
});
} catch (error) {
actions.reject();
}
},
});
onPaymentCompleted
This event now works both in the Sessions Flow and Advanced Flow.This event is no longer triggered for failed payments. For failed payments, we now use the onPaymentFailed event handler instead.Once this event is triggered, initiate the successful transaction flow on your web page.onPaymentFailed
This is a new event, which is triggered when a payment fails. Previously, this event was part of onPaymentCompleted.This event is triggered when the resultCode of a payment is Cancelled, Error, or Refused.Once this event is triggered, initiate the failed transaction flow on your web page.onOrderCreated and onPaymentMethodsRequest
These events are used for partial payments.onOrderCreated is renamed to onOrderUpdated. Update your codebase accordingly.onPaymentMethodsRequest is a new event, which is triggered when a partial payment is made and the associated order isn’t fully paid. Use the event handler to request payment methods for a new payment:const checkout = await AdyenCheckout({
// core configuration
onPaymentMethodsRequest: async (data, { resolve, reject }) => {
const paymentMethods = await getPaymentMethods({
amount,
shopperLocale: data.locale,
order: data.order,
});
resolve(paymentMethods);
},
});
onPaymentMethodsRequest event is only evoked in the Advanced flow, as you do not need to request payment methods yourself in the Sessions flow.onError
The onError callback now returns:- an error object that contains details about the error
- a reference to the payment method component for which the error occurs
Step 6: Update your styling
Starting from v6.0.0, we use CSS custom properties to give you more fine-grained control over Drop-in and Components’ look and feel.For an overview of all available CSS variables, see our GitHub repository.If you previously added your own styles to Components, make sure that these styles are being applied, because this version introduces different class names and DOM structures.Although we recommend you use CSS custom properties to style your Drop-in and Components, you can still override the CSS class names as before.Overriding styles with custom properties
You can customize elements that are not inside an iFrame, by overriding the styles:- Create a CSS file
override.css, with the CSS variables you want to style::root { --adyen-sdk-color-background-secondary: #f7f7f8; } - Import the
override.cssfile after importing the Adyen library’s main CSS file:import '@adyen/adyen-web/styles/adyen.css'; import './override.css';
Update placeholder texts
Placeholders are no longer added by default. To enhance the accessibility and UX, they are replaced with permanently visible contextual elements, which are shown below input fields.However, you can still add placeholder text to input fields. Placeholder texts are no longer part of thetranslations object, but part of the payment method configuration, as the placeholder texts are specific to payment methods.For example, to update the placeholder text for the card number in the Card Component:Placeholders for cards in Drop-in
const dropin = new Dropin({
paymentMethodsConfiguration: {
card: {
placeholders: { cardNumber: 'Enter your card number' }
}
}
});
Placeholders in Card Component
This event is now triggered before the **
This event is now triggered before the **
const card = new Card(checkout, {
placeholders: { cardNumber: 'Enter your card number' }
});
Step 7: (Optional) update your express payment methods
**Apple Pay
Express
The event handlersonShippingContactSelected() and onShippingMethodSelected() now work only when the Apple Pay Component configuration isExpress is set to true.onAuthorized
This event is now triggered before the onSubmit event, and must be resolved or rejected to continue the payment flow. onAuthorized returns an object with the authorizedEvent (raw data from Apple Pay) along with the formatted billingAddress and deliveryAddress.Create an onAuthorized event handler to implement checks before continuing the payment flow:const applepay = new ApplePay(checkout, {
onAuthorized({ authorizedEvent, billingAddress, deliveryAddress }, actions) {
if (/* Your checks based on the raw data, billing and shipping address */) actions.resolve();
else actions.reject();
},
});
Google Pay
- The
isAvailable()method does not return a boolean flag anymore. It now works same as Apple Pay’sisAvailable(). - The event handler
onPaymentDataChanged()now works only when the Google Pay Component configurationisExpressis set to true.
onAuthorized
This event is now triggered before the onSubmit event, and must be resolved or rejected to continue the payment flow. onAuthorized returns an object with the authorizedEvent (raw data from Google Pay) along with the formatted billingAddress and deliveryAddress.Create an onAuthorized event handler to implement checks before continuing the payment flow:const googlepay = new GooglePay(checkout, {
onAuthorized({ authorizedEvent, billingAddress, deliveryAddress }, actions) {
if (/* Your checks based on the raw data, billing and shipping address */) actions.resolve();
else actions.reject();
},
});
PayPal
- The
onShopperDetails(shopperDetails, rawData, actions)event handler is renamed toonAuthorized({authorizedEvent, billingAddress, deliveryAddress}, actions). - The
onShippingChange()event handler is no longer supported. ImplementonShippingAddressChange()andonShippingOptionsChange()instead.
Step 8: (Optional) update your Giving integration
From v6 onwards, your Adyen Giving integration must use the Giving Campaign Manager Component.Step 9: (Optional) update partial payments in Advanced flow
If you use the Advanced flow and process partial payments, make the following change.Previously, you initiated the /paymentMethods call from youronSubmit() or onAdditionalDetails() event handlers to update the payment methods for the remaining amount to be paid. From v6 onwards, we introduce a new event handler named onPaymentMethodsRequest() for this use case.To use it, pass the order from the /payments call to the action.resolve() method in your onSubmit() or onAdditionalDetails() event handler:const checkout = await AdyenCheckout({
onSubmit: async (state, component, actions) => {
try {
const {
action,
order,
resultCode
} = await makePayment(state.data);
if (!resultCode) actions.reject();
actions.resolve({
resultCode,
action,
order,
});
} catch (error) {
console.error('An error occured in the onSubmit() event handler:', error);
actions.reject();
}
},
onPaymentMethodsRequest: async (data, actions) => {
// Merchant custom implementation to fetch payment methods
const paymentMethods = fetchPaymentMethods(data);
actions.resolve(paymentMethods);
},
});