@checkout.com/checkout-web-components

中文文档
2.0.0发布于 2026/11/05MITTypeScriptESM + CJS零依赖近 30 天下载 31.2万

Checkout Payment Components loader

原始使用文档
文档目录7 节
  1. Table of contents
  2. Documentation
  3. Installation
  4. Usage
  5. Example
  6. Releasing
  7. License

CheckoutWebComponents Loader

License: MIT

Loader for CheckoutWebComponents.


Table of contents


Documentation

For more information on how to use the CheckoutWebComponents, please refer to the CheckoutWebComponents documentation.

Installation

Use npm to install the package.

npm install @checkout.com/checkout-web-components

Usage

The loadCheckoutWebComponents function is the entry point for the library.

The function returns a Promise resolving with a CheckoutWebComponents instance, and handles loading the CheckoutWebComponents script. This instance can then be used to create a Flow component that can be mounted.

import { loadCheckoutWebComponents } from '@checkout.com/checkout-web-components';

Example

// Insert your public key here
const publicKey = '{your_public_key}';

// Initialise a new Checkout Web Components instance
const checkout = await loadCheckoutWebComponents({
  paymentSession,
  publicKey,
  environment: 'sandbox'
});

// You can now create and mount a Flow component using 'checkout'
const flowComponent = checkout.create('flow');

// Mount Flow component to div element with an ID of 'flow-container'
flowComponent.mount('#flow-container');

You can find/create your public key in the Developers section of your Checkout.com Production Dashboard or Checkout.com Sandbox Dashboard. See our API keys documentation for more information.


Releasing

  • Merge conventional-commit PRs into main.
  • Release-please opens or updates a Release PR with the version bump and CHANGELOG.md.
  • Merge the Release PR to create the GitHub Release and publish to npm.
  • Fallback: create a GitHub Release manually to trigger publish.

License

This project is licensed under the MIT License.

版本与发布记录

@checkout.com/checkout-web-components 共发布 24 个版本,首次发布于 2023/10/05;过去 12 个月发布了 10 个版本。

版本发布日期距今
2.0.0latest2026/11/054 天前
1.14.02026/10/051 个月前
1.13.02026/08/112 个月前
1.12.02026/07/313 个月前
1.11.02026/06/015 个月前
1.10.02026/04/286 个月前

关于 @checkout.com/checkout-web-components 的常见问题

@checkout.com/checkout-web-components 是什么?

Checkout Payment Components loader

如何安装 @checkout.com/checkout-web-components?

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

@checkout.com/checkout-web-components 支持 TypeScript 吗?

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

@checkout.com/checkout-web-components 支持 ESM 还是 CommonJS?

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

@checkout.com/checkout-web-components 可以商用吗?

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

@checkout.com/checkout-web-components 的下载量有多少?

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

@checkout.com/checkout-web-components 还在维护吗?

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