@adyen/adyen-web

中文文档
6.48.1发布于 2026/11/05MITTypeScriptESM + CJS构建来源已验证近 30 天下载 239.1万

npm

原始使用文档
文档目录15 节
  1. Prerequisites
  2. Drop-in/Components lifecycle
  3. Installation
  4. Node package manager
  5. Using a <script> tag
  6. Running the Development Environment
  7. Localization
  8. Styling
  9. Overriding styles example
  10. Style the secured fields
  11. Analytics and data tracking
  12. Contributing
  13. See also
  14. Support
  15. License

npm

Web

Adyen Web

Adyen Web provides you with the building blocks to create a checkout experience for your shoppers, allowing them to pay using the payment method of their choice.

You can integrate with Adyen Web in two ways:

  • Web Drop-in: an all-in-one solution, the quickest way to accept payments on your website.
  • Web Components: one Component per payment method and combine with your own payments form logic.

Prerequisites

Drop-in/Components lifecycle

Major versionStateDeprecatedEnd-of-life
6.x.xActive------
5.x.xInactiveTBATBA
4.x.xEnd-of-lifeAugust 2025August 2026
3.x.xEnd-of-lifeOctober 2024October 2025

More information about our versioning and the Drop-in/Components lifecycle can be found here

Installation

We only provide full support when you use one of these methods of installation.

Node package manager

  1. Install the Adyen Web Node package:
npm install @adyen/adyen-web --save
  1. Import Adyen Web into your application:
import { AdyenCheckout } from '@adyen/adyen-web';
import '@adyen/adyen-web/styles/adyen.css';

Using a <script> tag

You can also import Adyen Web using a <script> tag, as shown in the Web Components integration guide.

Running the Development Environment

Requirements:

  • Node v24
  • Yarn (Using Corepack - Run corepack enable after installing Node)

To run the environment:

  1. Clone this repository.
  2. Create a .env file on your project's root folder following the example in env.default and fill in the environment variables.
  3. Install the dependencies by running:
yarn install
  1. If you are running the project by the first time, run the build script
yarn build
  1. Run the development environment, which starts a server listening on http://localhost:3020:
yarn start

Localization

We include UI localizations for many languages. You can check the languages and their respective translations here. Furthermore, it is possible to customize the current translation replacing the default text with your own text in case you want that.

Styling

Adyen Web is themeable and utilizes CSS variables that can be overridden in order to achieve the desired style.

Overriding styles example

For elements that are not inside iframes, you can customize the styles by overriding these styles in a css file. Most of our styles are defined with css variables with default values. To override those styles, you can inspect the DOM and change the value for the css variables either at the root level or by targeting specific elements. Be aware that if you change the values for css variables at the root level, you are also changing the styles for all the child elements that are using the same css variables.

  1. Create override.css with the variables that you would like to style

    :root {
        --adyen-sdk-color-background-secondary: #f7f7f8;
    }
    
  2. Make sure to import the override.css after importing library's main CSS

    import '@adyen/adyen-web/styles/adyen.css';
    import './override.css';
    

Where do we define those css variables and what is the default value?

Css variableDefault valueScope
--adyen-sdk-color-label-primary#00112c #00112c- Label color inside payment forms, such as form instruction, form field labels and contextual / helper texts.
- Fieldset title color
- Input field text color
- Drop-in payment method header, order payment method header, default status text color.
- Bacs Edit button text color
- Introduction text color for Bank Transfer, Vouchers, Blik
- Donation status text color, campaign background color
- UPI, ANCV, Blik, MBWay await container text color
- Secondary, ghost buttons text color
- (Consent) checkbox label color
--adyen-sdk-color-label-secondary#5c687c #5c687c- Label color for the additional information in the drop-in payment method header.
- Disclaimer label color.
- QR count down label color.
- Readonly select and input color.
--adyen-sdk-color-label-tertiary#8d95a3 #8d95a3- Label color for the click to pay labels.
--adyen-sdk-color-label-disabled#8d95a3 #8d95a3- Label color for the disabled Click to Pay logout button.
- Disabled segment.
- Background color for the payment button in the loading state.
--adyen-sdk-color-label-critical#e22d2d #e22d2d- Border color for the error input fields and error validation message.
--adyen-sdk-color-label-highlight#0070f5 #0070f5- Link button color.
--adyen-sdk-color-label-on-color#ffffff #ffffff- Button text color.
- Donation campaign description text color.
- Checkbox check color.
--adyen-sdk-color-background-primary#ffffff #ffffff- Background color for the Secondary pay button.
- Background color for payment form elements: input element, radio, select, checkbox.
- Background color for drop-in unselected payment items.
--adyen-sdk-color-background-secondary#f7f7f8 #f7f7f8- Background color for drop-in selected payment method item.
- Background color for selected button inside button group (used in the Donation component).
--adyen-sdk-color-background-secondary-hover#eeeff1 #eeeff1- Background color for ghost button hover.
--adyen-sdk-color-background-secondary-active#e3e5e9 #e3e5e9- Background color for ghost button active.
--adyen-sdk-color-background-tertiary#eeeff1 #eeeff1- Background color for segmented control used by the UPI.
--adyen-sdk-color-background-disabled#eeeff1 #eeeff1- Background color for disabled form elements.
--adyen-sdk-color-background-critical-strong#e22d2d #e22d2d- Background color for drop-in remove stored payment methods confirmation button.
--adyen-sdk-color-background-inverse-primary-hover#5c687c #5c687c- Background color for hovering on payment button.
--adyen-sdk-color-background-always-dark#00112c #00112c- Background color for the primary payment button.
--adyen-sdk-color-background-always-dark-active#8d95a3 #8d95a3- Background color for the active and hovered primary payment button.
--adyen-sdk-color-background-critical-strong#e22d2d #e22d2d- Drop-in remove stored card confirmation, button background color
- Gift card alert background color
--adyen-sdk-color-outline-primary#dbdee2 #dbdee2- Drop-in payment method list item unselected border color.
- Highlighted issuers button box shadow color.
- Payment form elements (including checkbox and radio) border color.
--adyen-sdk-color-outline-primary-hover#c9cdd3 #c9cdd3- Drop-in payment method list item hover and unselected box-shadow color.
- Radio and checkbox hover not focused box-shadow color.
--adyen-sdk-color-outline-primary-active#00112c #00112c- Form input elements focused box-shadow and border color.
--adyen-sdk-color-outline-secondary#c9cdd3 #c9cdd3- Drop-in selected payment item border color.
- Drop-in default status container border color.
- UPI, ANCV, Blik, MBWay await container border color.
- QR code container border color.
--adyen-sdk-color-outline-tertiary#8d95a3 #8d95a3- Drop-in order payment border color, surcharge text color
- Gif card balance text color
- UPI, ANCV, Blik, MBWay await count down text color
- Radio, checkbox hover box-shadow color
- Pay / regular button focus box-shadow color
- Content separator color
--adyen-sdk-color-outline-disabled#dbdee2 #dbdee2- Secondary button disabled border color
--adyen-sdk-color-outline-critical#e22d2d #e22d2d- Drop down invalid button border color
--adyen-sdk-color-separator-primary#dbdee2 #dbdee2- Input, select, checkbox and radio form fields invalid border color
--adyen-sdk-text-caption-line-height18px- Various places that are not body / subtitle / title
--adyen-sdk-text-caption-font-size12px- Gift card alert message font size
- Drop-in payment method list item additional information text font size
- Disclaimer message text font size
- Form field instruction, contextual, error text font size
--adyen-sdk-text-body-font-size14px- Various places that are not title / sub title / caption
--adyen-sdk-text-body-line-height20px- Radio text line height
- Payme instruction line height
- Click to pay otp checkbox info line height
- Form field label line height
--adyen-sdk-text-body-font-weight400- Stored card expiry date input text font weight
--adyen-sdk-text-body-stronger-font-weight500- Selected issuer button text font weight
- Drop-in payment method list item title font weight
- Drop-in order header and deducted amount font weight
- Trustly description font weight
- Pay button text font weight
- UPI segmented control text font weight
--adyen-sdk-text-subtitle-font-size16px- Blik helper font size
- Trustly description header
- UPI, ANCV, Blik, MBWay await subtitle and indicator font size
- QR subtitle and indicator font size
- Input, drop down input fields text font size
- Voucher amount font size
--adyen-sdk-text-subtitle-font-weight500- Field set title font weight
--adyen-sdk-text-subtitle-stronger-font-weight600- Drop-in payment method list label font weight
--adyen-sdk-text-subtitle-line-height26px- Drop-in payment method list label line height
- Field set title line height
--adyen-sdk-text-title-font-size16px- Drop-in default final statuses font size
- Drop-in order header font size
- Drop-in payment method list item title font size
- Pay button text font size
- Directdebit_GB voucher result introduction font size
- Donation campaign title font size
--adyen-sdk-text-title-font-weight600- Click to pay header title font weight
--adyen-sdk-text-title-line-height26px- Stored card expiry date input text line height
--adyen-sdk-text-title-l-font-size24px- Voucher reference text font-size
--adyen-sdk-spacer-10032pxVarious places for dimensions
--adyen-sdk-spacer-11040pxVarious places for dimensions
--adyen-sdk-spacer-12048pxVarious places for dimensions
--adyen-sdk-spacer-13056pxVarious places for dimensions
--adyen-sdk-spacer-14064pxVarious places for dimensions
--adyen-sdk-spacer-0000pxVarious places for dimensions
--adyen-sdk-spacer-0102pxVarious places for dimensions
--adyen-sdk-spacer-0204pxVarious places for dimensions
--adyen-sdk-spacer-0306pxVarious places for dimensions
--adyen-sdk-spacer-0408pxVarious places for dimensions
--adyen-sdk-spacer-05010pxVarious places for dimensions
--adyen-sdk-spacer-06012pxVarious places for dimensions
--adyen-sdk-spacer-07016pxVarious places for dimensions
--adyen-sdk-spacer-08020pxVarious places for dimensions
--adyen-sdk-spacer-09024pxVarious places for dimensions
--adyen-sdk-border-radius-xs2pxVarious places for border radius
--adyen-sdk-border-radius-s4pxVarious places for border radius
--adyen-sdk-border-radius-m8pxVarious places for border radius
--adyen-sdk-border-radius-l12pxVarious places for border radius
--adyen-sdk-border-radius-xl24pxVarious places for border radius
--adyen-sdk-border-width-s1pxVarious places for border radius
--adyen-sdk-border-width-m2pxVarious places for border radius
--adyen-sdk-border-width-l3pxVarious places for border radius
--adyen-sdk-shadow-low0px 2px 4px rgba(0, 17, 44, 0.04), 0px 1px 2px rgba(0, 17, 44, 0.02)- Box shadow for Card available brand images and voucher brand images
- Box shadow for selected segment

Style the secured fields

To style the secured fields such as card number, CVC, and expiry date of a card, you can follow the link Styling card input fields.

Analytics and data tracking

Starting v5.16.0 the Drop-in and Components integrations contain analytics and tracking features that are turned on by default. Find out more about what we track and how you can control it.

Contributing

We merge every pull request into the main branch. We aim to keep main in good shape, which allows us to release a new version whenever we need to.

Have a look at our contributing guidelines to find out how to raise a pull request.

See also

Support

If you have a feature request, or spotted a bug or a technical problem, create an issue here.

For other questions, contact our support team.

License

This repository is available under the MIT license.

版本与发布记录

@adyen/adyen-web 共发布 251 个版本,首次发布于 2020/06/10;过去 12 个月发布了 39 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
6.48.1latest2026/11/05今天
6.48.0-alpha.e1e993bnext2026/11/041 天前
6.48.02026/10/288 天前
6.47.02026/10/1521 天前
6.47.0-alpha.41c41fe2026/10/0828 天前
6.47.0-alpha.eada81f2026/09/291 个月前

其他发布通道:alpha → 6.0.0-alpha.8,beta → 6.0.0-beta.1,inactive → 5.72.0,next → 6.48.0-alpha.e1e993b。

关于 @adyen/adyen-web 的常见问题

如何安装 @adyen/adyen-web?

在项目目录运行 npm install @adyen/adyen-web,或使用 pnpm add / yarn add / bun add。

@adyen/adyen-web 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@adyen/adyen-web 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@adyen/adyen-web 可以商用吗?

@adyen/adyen-web 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@adyen/adyen-web 的下载量有多少?

根据 npm 官方下载统计,@adyen/adyen-web 在 2026/10/05 – 2026/11/03 这 30 天内被下载 2,390,858 次,日均约 79,695 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@adyen/adyen-web 还在维护吗?

最新版本 6.48.1 发布于 2026/11/05(今天);至今共发布 251 个版本,其中过去 12 个月发布了 39 个;首次发布于 2020/06/10。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。