Benefits to upgrading
Read our release notes to learn about the benefits of upgrading.
To upgrade from Web Drop-in/Components v5.x.x to v6.x.x, complete the following steps.
If you are upgrading from an earlier version, you need to follow a different migration guide:
Required API version
Using Web Drop-in/Components v6.0.0 requires Checkout API v69 or later.
Step 1: Use the new package
Step 2: Update import statements
Step 3: Update your configuration
Make the following changes to your configuration properties:
countryCode
is now a mandatory configuration property. Set it during theAdyenCheckout
initialization if you haven't already done so in the /sessions request.- The
setStatusAutomatically
property is no longer used. To disable the Drop-in animation, setdisableFinalAnimation
to true. - You can no longer set
installmentOptions
during theAdyenCheckout
instantiation. Set it directly in the Card configuration instead. - The
showBrandsUnderCardNumber
property is no longer used. Update your code accordingly. - The
showFormInstruction
property 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.
Step 4: Update creating an instance
In earlier versions of Drop-in/Components, creating an instance of a Component or the Drop-in used the AdyenCheckout.create()
method. We've updated this to use a constructor function instead.
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()
. You should call theactions.resolve()
method regardless of theresultCode
, 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.
Use the 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);
},
});
The onPaymentMethodsRequest
event is only evoked in the Advanced flow, as you do not need to request payment methods yourself in the Sessions flow.
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.
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.css
file 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 displayed below input fields.
However, you can still add placeholder text to input fields. Placeholder texts are no longer part of the translations
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:
Step 7: (Optional) update your express payment methods
Apple Pay
Express
The event handlers onShippingContactSelected()
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 configurationisExpress
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 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 your onSubmit()
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: