The examples below use . If you are on v5, the initialisation syntax differs — see Adyen's migration guide.
const { AdyenCheckout, Dropin } = window.AdyenWeb;
const checkout = await AdyenCheckout({
amount: { currency: 'EUR', value: 2800 },
paymentMethodsResponse: paymentMethods,
onSubmit: async (state, component, actions) => {
const res = await fetch('/api/payments', {
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ ...state.data, orderId: 592 }),
const { resultCode, action, order, donationToken } = await res.json();
if (!resultCode) return actions.reject();
actions.resolve({ resultCode, action, order, donationToken });
onAdditionalDetails: async (state, component, actions) => {
const res = await fetch('/api/payments/details', {
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ ...state.data, orderId: 592 }),
const { resultCode, action } = await res.json();
if (!resultCode) return actions.reject();
actions.resolve({ resultCode, action });
onPaymentCompleted: (result) => { },
onPaymentFailed: (result) => { },
new Dropin(checkout).mount('#dropin-container');
Two things to note about v6 specifically. countryCode is mandatory at initialisation. And onSubmit and onAdditionalDetails must call actions.resolve() or actions.reject() — the payment flow will not continue otherwise. In v5 you called component.handleAction() instead; that pattern no longer applies.
/api/payments receives state.data, adds the fields Adyen Web does not know about, signs the request, and forwards it:
POST /woocommerce/adyen/stores/{store_id}/payments
json
"returnUrl": "https://myshop.example.com/checkout/order-received/592/",
"amount": { "currency": "EUR", "value": 2800 },
"paymentMethod": { "...from state.data..." },
"browserInfo": { "...from state.data..." },
"metadata": { "wc_order_id": 592 }
Return the Midlayer's resultCode, action, and order to the browser. Store pspReference against the order before you respond.
/api/payments/details does the same against POST /woocommerce/adyen/stores/{store_id}/payment-details.