# @bigcommerce/bigpay-client 中文文档

规范地址：https://npmcn.com/package/%40bigcommerce/bigpay-client/

版本：5\.31\.0
npm 元数据更新时间：2026-10-13T23:32:50.299Z
中文译文更新时间：2026-11-08T02:12:24.613Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40bigcommerce/bigpay-client
原文对照：https://npmcn.com/package/%40bigcommerce/bigpay-client/?lang=original
项目主页：https://github.com/bigcommerce/bigpay-client-js#readme
源码仓库：https://github.com/bigcommerce/bigpay-client-js

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：316 kB，103 个文件
- 模块格式：CommonJS
- TypeScript 类型：未声明
- 运行依赖：4 个
- 首次发布：2018-05-16T02:28:27.274Z
- 最新版本发布：2026-08-04T11:30:11.017Z
- 近 30 天下载量：9639（2026-10-08 至 2026-11-06，npm 官方下载统计）
- 已发布版本数：72（近 12 个月 2 个）

## 中文简介

BigPay 的 JavaScript 客户端

## 安装

```sh
npm install @bigcommerce/bigpay-client
```

也可以使用：`pnpm add @bigcommerce/bigpay-client`、`yarn add @bigcommerce/bigpay-client`、`bun add @bigcommerce/bigpay-client`

## README

# 大薪客户.js

[![Build Status](https://circleci.com/gh/bigcommerce/bigpay-client-js.svg?style=svg)](https://circleci.com/gh/bigcommerce/bigpay-client-js)

bigpay-client.js是一个客户端图书馆,用于向BigPay发布支付数据.

## 使用量

单位 `checkout.js`

```js
import { createClient } from 'bigpay-client';
import { getPaymentData } from './payment';

const client = createClient({
    host: 'https://payments.bigcommerce.com',
});

const data = getPaymentData();

client.submitPayment(data, (error, response) => {
    if (error) {
        throw error;
    }

    console.log(response);
});
```

单位 `payment.js`

```js
export default function getPaymentData() {
    return {
        authToken: 'aaa.bbb.ccc',
        billingAddress: {
            addressLine1: '1-3 Smail St',
            addressLine2: 'Ultimo',
            city: 'Sydney',
            company: 'BigCommerce',
            country: 'Australia',
            countryCode: 'AU',
            firstName: 'Foo',
            lastName: 'Bar',
            phone: '98765432',
            postCode: '2007',
            provinceCode: 'NSW',
            province: 'New South Wales',
        },
        cart: {
            currency: 'AUD',
            grandTotal: {
                integerAmount: 12000,
            },
            handling: {
                integerAmount: 0,
            },
            shipping: {
                integerAmount: 1000,
            },
            subtotal: {
                integerAmount: 10000,
            },
            taxTotal: {
                integerAmount: 1000,
            },
            items: [
                {
                    id: '123',
                    integerAmount: 10000,
                    integerAmountAfterDiscount: 10000,
                    integerDiscount: 0,
                    integerTax: 1000,
                    integerUnitPrice: 10000,
                    integerUnitPriceAfterDiscount: 10000,
                    name: 'Cheese',
                    quantity: 1,
                    sku: '123456789',
                    type: 'ItemPhysicalEntity',
                },
            ],
        },
        customer: {
            customerId: '123',
            email: 'email@bigcommerce.com',
            firstName: 'Foo',
            lastName: 'Bar',
            name: 'Foo Bar',
            phoneNumber: '98765432',
        },
        order: {
            currency: 'AUD',
            grandTotal: {
                integerAmount: 12000,
            },
            handling: {
                integerAmount: 0,
            },
            orderId: '123',
            shipping: {
                integerAmount: 1000,
            },
            subtotal: {
                integerAmount: 10000,
            },
            taxTotal: {
                integerAmount: 1000,
            },
            token: 'abc123',
        },
        payment: {
            ccCvv: '123',
            ccExpiry: {
                month: 1,
                year: 2018,
            },
            ccName: 'Foo Bar',
            ccNumber: '4007000000027',
            ccCustomerCode: 'XYZ',
        },
        paymentMethod: {
            id: 'paypalprous',
            type: 'PAYMENT_TYPE_API',
        },
        quoteMeta: {
            request: {
                deviceSessionId: 'xyz123',
                geoCountryCode: 'AU',
                sessionHash: 'abc123',
            },
        },
        shippingAddress: {
            addressLine1: '685 Market St',
            addressLine2: 'Third Floor',
            city: 'San Francisco',
            company: 'BigCommerce',
            country: 'United States',
            countryCode: 'US',
            firstName: 'Joe',
            lastName: 'Bar',
            phone: '98765432',
            postCode: '94105',
            provinceCode: 'CA',
            province: 'California',
        },
        source: 'bcapp-checkout-uco',
        store: {
            cartLink: '/cart',
            checkoutLink: '/checkout',
            countryCode: 'AU',
            currencyCode: 'AUD',
            orderConfirmationLink: '/order-confirmation',
            shopPath: '/',
            storeHash: 's123456789',
            storeId: '100',
            storeLanguage: 'en-AU',
            storeName: 'Test Store',
        },
    };
}
```

## 发展

```sh
npm install
```

与其他项目的联系:

内部 `bigpay-client-js`

```sh
npm link
npm build -- --watch
```

其他项目:

```sh
npm link @bigcommerce/bigpay-client
npm run dev
```

要运行单元测试 :

```sh
npm test
```

要发布新版本 :

```sh
npm run release
```

## 常见问题

### @bigcommerce/bigpay-client 是什么？

BigPay 的 JavaScript 客户端

### 如何安装 @bigcommerce/bigpay-client？

在项目目录运行 npm install @bigcommerce/bigpay-client，或使用 pnpm add / yarn add / bun add。

### @bigcommerce/bigpay-client 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/bigcommerce\_\_bigpay-client 是否存在。

### @bigcommerce/bigpay-client 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @bigcommerce/bigpay-client 可以商用吗？

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

### @bigcommerce/bigpay-client 的下载量有多少？

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

### @bigcommerce/bigpay-client 还在维护吗？

最新版本 5\.31\.0 发布于 2026/08/04（3 个月前）；至今共发布 72 个版本，其中过去 12 个月发布了 2 个；首次发布于 2018/05/16。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

