adyen-web: Production build not working with @adyen/adyen-web/auto
Describe the bug Hello ! We are in the process of migrating the library from 5.59.0 to 6.1.0 and we use Vite to build our project.
It seems that the @adyen/adyen-web/auto export doesn’t work as expected since we encounter these messages when running the production build and the Dropin does not show :
Dropin: You support the payment method ‘scheme’ but this component has not been configured. Make sure to import the Class ‘Card’ and then pass it in the Dropin’s ‘paymentMethodComponents’ config property if you wish to offer this payment method.
It works fine with the dev server.
To Reproduce Steps to reproduce the behavior:
- Build an app with vite and use
@adyen/adyen-web/auto - Mount dropin with just payment methods configurations
import { AdyenCheckout, CoreConfiguration, Dropin, DropinConfiguration } from '@adyen/adyen-web/auto';
const paymentMethodsConfiguration: DropinConfiguration['paymentMethodsConfiguration'] = {
card: {
autoFocus: true,
enableStoreDetails: true,
hasHolderName: process.env.REACT_APP_ADYEN_HOLDER_NAME === 'true',
},
};
new Dropin(checkout, {
paymentMethodsConfiguration,
}).mount(container.current);
Expected behavior Dropin should show.
Additional context
- “vite”: “^5.1.6”
- “@adyen/adyen-web”: “6.1.0”
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (9 by maintainers)
Hi @tlenclos - Unfortunately I didn’t have time to dig into this issue yet. I hope that by next week I will be able to investigate.
For now you can follow the workaround proposed here , it must work. And then once this issue is fix, you can just remove this code snippet
@jellevdv More specifically
UnionPay (SecurePay / UPOP)is a deprecated paymentMethod. Instead you shoudl be offeringUnionPay (CUP)via the card component instead. LikewiseJCBcan also be offered via the Card component. In essence both UnionPay(Cup) and JCB are card brands that, if configured in the Adyen CustomerArea, will show up as supported brands when you present a Card componentSame issue here, the components don’t seem to load using the /auto import 😥 We also used the same hack as above to fix the issue, we do have a fixed list of payment methods but can’t seem to find the correct components for all of them, as the mapping is not 1:1. Payment methods like UnionPay or JCB don’t seem to be in the following components list https://github.com/Adyen/adyen-web/blob/main/packages/lib/src/components/index.ts
We also had the same issue in an Open-WC project (Lit + rollup + babel).
For now we worked around by importing the components from @adyen/adyen-web instead.
import { components } from '@adyen/adyen-web';And in the function where we create our Dropin Configuration, we register the classes similar to how it’s done in the “auto” import:
const { ...Components } = components;const Classes = Object.keys(Components).map(key => Components[key]);AdyenCheckout.register(...Classes);