# @adyen/api-library 中文文档

规范地址：https://npmcn.com/package/%40adyen/api-library/

版本：32\.3\.0
npm 元数据更新时间：2026-11-04T14:58:22.610Z
中文译文更新时间：2026-11-05T17:08:51.797Z
软件包许可：MIT

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

原始 npm 页面：https://www.npmjs.com/package/%40adyen/api-library
原文对照：https://npmcn.com/package/%40adyen/api-library/?lang=original
项目主页：https://github.com/Adyen/adyen-node-api-library#readme
源码仓库：https://github.com/Adyen/adyen-node-api-library

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

- 包体积（解压后）：12.7 MB，7398 个文件
- 模块格式：CommonJS
- TypeScript 类型：包内自带
- Node.js 要求：\>=18
- 运行依赖：2 个
- 首次发布：2019-07-08T11:15:22.612Z
- 最新版本发布：2026-11-04T14:58:22.197Z
- 近 30 天下载量：1025717（2026-10-05 至 2026-11-03，npm 官方下载统计）
- 已发布版本数：113（近 12 个月 8 个）

## 中文简介

节点JS的 Adyen API 库允许您与 Adyen APIs 合作.

## 安装

```sh
npm install @adyen/api-library
```

也可以使用：`pnpm add @adyen/api-library`、`yarn add @adyen/api-library`、`bun add @adyen/api-library`

## README

![Node js](https://user-images.githubusercontent.com/62436079/207373079-9cf9377f-f530-4b02-a515-9b64ef7b06e7.png)

# 节点的 Adyen API 库

[![Version](https://img.shields.io/npm/v/@adyen/api-library.svg)](https://www.npmjs.com/package/@adyen/api-library) [![Build Status](https://github.com/adyen/Adyen-node-api-library/actions/workflows/npmpublish.yml/badge.svg)](https://github.com/Adyen/adyen-node-api-library/actions/workflows/npmpublish.yml) [![Coverage Status](https://coveralls.io/repos/github/Adyen/adyen-node-api-library/badge.svg?branch=main)](https://coveralls.io/github/Adyen/adyen-node-api-library?branch=main) [![Downloads](https://img.shields.io/npm/dm/@adyen/api-library.svg)](https://www.npmjs.com/package/@adyen/api-library) ![npm bundle size (scoped)](https://img.shields.io/bundlephobia/minzip/@adyen/api-library.svg) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Adyen_adyen-node-api-library&metric=alert_status)](https://sonarcloud.io/dashboard?id=Adyen_adyen-node-api-library)

这是我们建议与Adyen APIs整合的Node.js的官方Adyen API库.

## 支持的 APIs

该库支持以下内容:

| API 名称 | API 版本 | 说明 | API 对象 |
| --- | --- | --- | --- |
| [BIN 查询 API](https://docs.adyen.com/api-explorer/BinLookup/54/overview) | 五十四岁 | BIN Lookup API提供了基于给定的BIN检索信息的端点. | [宾查](https://npmcn.com/src/services/binLookupApi.ts) |
| [检查出 API](https://docs.adyen.com/api-explorer/Checkout/72/overview) | 页:1 | 我们最近的整合 接受在线支付. | [报出API](https://npmcn.com/src/services/checkout/index.ts) |
| [资本 API](https://docs.adyen.com/api-explorer/capital/1/overview) | 单曲 | 提供将 Adyen Capital 嵌入您的市场或平台的终点 . | [首都API](https://npmcn.com/src/services/capital/index.ts) |
| [云设备 API](https://docs.adyen.com/api-explorer/cloud-device-api/latest/overview) | 单曲 | 云设备售点溶液为云集. 我们最新的云通信内部支付系统. | [云德维西API](https://npmcn.com/src/services/clouddevice/index.ts) |
| [配置 API](https://docs.adyen.com/api-explorer/balanceplatform/2/overview) | 页:1 | 配置 API 使您能够创建一个平台,让您能够作为账户持有者登入您的用户,并创建余额账户、卡片和商业账户. | [平衡公式](https://npmcn.com/src/services/balancePlatform/index.ts) |
| [数据保护 API](https://docs.adyen.com/development-resources/data-protection-api) | 单曲 | Adyen 数据保护 API 为您提供了处理方法 [主题 Erasure 请求](https://gdpr-info.eu/art-17-gdpr/) 根据GDPR的授权。 使用我们的API提交删除shopper数据的请求,包括支付细节和其他相关信息(例如,交付地址或shopper电子邮件) | [数据保护](https://npmcn.com/src/services/dataProtectionApi.ts) |
| [文档收集器 API](https://docs.adyen.com/api-explorer/Document-Collector/1/overview) | 单曲 | 文件收集器 API 提供了跨境发票所需文件上传的终点. | [文档分类器API](https://npmcn.com/src/services/documentCollector/index.ts) |
| [法律实体管理](https://docs.adyen.com/api-explorer/legalentity/4/overview) | 页:1 | 管理载有核查所需信息的法律实体. | [法人 管理层](https://npmcn.com/src/services/legalEntityManagement/index.ts) |
| [本地/基于云的终端 API](https://docs.adyen.com/point-of-sale/terminal-api-reference) | \- 说吧 | 我们的卖点一体化。 就云通信而言,考虑迁移到 [云设备 API](https://docs.adyen.com/api-explorer/cloud-device-api/latest/overview) 用于构建个人支付云集. | [终端本地API](https://npmcn.com/src/services/terminalLocalAPI.ts) 或者说 [终端 CloudAPI](https://npmcn.com/src/services/terminalCloudAPI.ts) |
| [管理层 API](https://docs.adyen.com/api-explorer/Management/3/overview) | 页:1 | 配置和管理你的Adyen公司和商户、商店和支付终端. | [管理层](https://npmcn.com/src/services/management/index.ts) |
| [开放式银行业 API](https://docs.adyen.com/api-explorer/open-banking/1/overview) | 单曲 | 开放银行业的API为与第三方分享金融数据和服务提供了安全的终点. | [开放银行业务](https://npmcn.com/src/services/openbanking/index.ts) |
| [支付额 API](https://docs.adyen.com/api-explorer/Payment/68/overview) | 页:1 | 我们在线支付经典整合. | [经典集成API](https://npmcn.com/src/services/paymentApi.ts) |
| [支付 API](https://docs.adyen.com/api-explorer/Payout/68/overview) | 页:1 | 给客户寄钱的终点. | [付款](https://npmcn.com/src/services/payout/index.ts) |
| [平台 APIs](https://docs.adyen.com/classic-platforms/api) | \- 说吧 | 平台使用 Adyen 时的 API 集 。 这个API用于经典的集成. | [平台](https://npmcn.com/src/services/platforms.ts) |
| [账户 API](https://docs.adyen.com/api-explorer/Account/6/overview) | v6 数据 | 为您平台上与账户有关的实体的管理提供端点。 这些相关实体包括账户持有人、账户、银行账户、股东以及与核查有关的文件. | [账户](https://npmcn.com/src/services/platforms.ts) |
| [基金](https://docs.adyen.com/api-explorer/Fund/6/overview) | v6 数据 | 为您平台上账户的资金管理提供终点。 例如,这些管理业务包括将资金从一个账户转到另一个账户,向账户持有人支付资金,取回账户中的余额. | [基金](https://npmcn.com/src/services/platforms.ts) |
| [机载 API](https://docs.adyen.com/api-explorer/Hop/6/overview) | v6 数据 | 提供端点,用于生成与Adyen托管页面的链接,例如登入页面或PCI遵守问卷. 您可以为您的账户持有人提供这些链接,以便他们完成登入. | [主机登机 页次](https://npmcn.com/src/services/platforms.ts) |
| [通知配置 API](https://docs.adyen.com/api-explorer/NotificationConfiguration/6/overview) | v6 数据 | 提供设置和测试通知的结束点, 通知您在您的平台上发生的事件, 例如核查检查或付款完成后. | [通知配置](https://npmcn.com/src/services/resource/platforms/notificationConfiguration.ts) |
| [POS 终端管理 API](https://docs.adyen.com/api-explorer/postfmapi/1/overview) | ~单曲~ | ~管理售出点支付终端的终点.~ - 被消耗的:使用 [管理层 API](https://docs.adyen.com/api-explorer/Management/latest/overview) 管理你的终端机队. | [~终端管理~](https://npmcn.com/src/services/terminalManagementApi.ts) |
| [经常性 API](https://docs.adyen.com/api-explorer/Recurring/68/overview) | 页:1 | 管理已保存支付细节的终点 . | [经常性](https://npmcn.com/src/services/recurringApi.ts) |
| [会话认证 API](https://docs.adyen.com/api-explorer/sessionauthentication/1/overview) | **单曲** | 创建和管理集成所需的 JSON 网络托肯( JWT) [上岗](https://docs.adyen.com/platforms/onboard-users/components) 财务报告和审定财务报表 [平台经验](https://docs.adyen.com/platforms/build-user-dashboards) 组件. | [会话校正](https://npmcn.com/src/services/sessionAuthentication) |
| [存储值 API](https://docs.adyen.com/payment-methods/gift-cards/stored-value-api) | 页:1 | 管理在线和点售礼品卡等存储值卡. | [存储值](https://npmcn.com/src/services/storedValueApi.ts) |
| [转让 API](https://docs.adyen.com/api-explorer/transfers/4/overview) | 页:1 | 转账 API 提供了端点,可用于获取您所有交易的信息,在您的余额平台内移动资金,或者将资金从您的余额平台发送到转账工具. | [转账](https://npmcn.com/src/services/transfers/index.ts) |
| [争议 API](https://docs.adyen.com/api-explorer/Disputes/30/overview) | 第30个 | 你可以用这个 [争议 API](https://docs.adyen.com/risk-management/disputes-api) 将争议处理程序自动化,以便一旦争议启动,您就能够对争议作出反应和收费。 争议 API 允许您获取辩护理由, 提供和删除辩护文件, 并接受或维护争议 . | [争端](https://npmcn.com/src/services/disputesApi.ts) |
| [POS 移动 API](https://docs.adyen.com/api-explorer/possdk/68/overview) | 页:1 | POS 移动 API 用于 Adyen Android 或 iOS 之间的相互认证流 [POS 移动 SDK](https://docs.adyen.com/point-of-sale/ipp-mobile/) 还有Adyen支付平台 用于Android或iOS设备的POS Mobile SDK使企业能够使用像手机一样的商业现成(COTS)设备接受当面支付. 例如,Tap to Pay交易,或与读卡器结合在移动设备上的交易 | [POS 移动](https://npmcn.com/src/services/posMobileApi.ts) |
| [支付 API](https://docs.adyen.com/api-explorer/payments-app/1/overview) | 单曲 | 支付App API 用于在您的Android移动设备上注册和管理 Adyen 支付App . | [支付](https://npmcn.com/package/%40adyen/api-library/src/services/paymentsApp/paymentsAppApi.ts) |

## 支持的 Webhook 版本

库支持以下模式目录下的所有webhooks:

| 网络呼号 | 说明 | 型号名称 | 支持的版本 |
| --- | --- | --- | --- |
| [认证 Webhooks](https://docs.adyen.com/api-explorer/acs-webhook/1/overview) | Adyen 在卡持有者认证进程完成时发送此 Webhook, 无论是成功完成, 失败还是过期 . | [AcsWebhooks (英语)](https://npmcn.com/package/%40adyen/api-library/src/typings/acsWebhooks) | **单曲** |
| [平衡 Web 呼号](https://docs.adyen.com/api-explorer/balance-webhooks/1/overview) | Adyen 发送webhooks 通知您平衡平台的平衡变化. | [平衡网点](https://npmcn.com/package/%40adyen/api-library/src/main/java/com/adyen/model/balancewebhooks) | **单曲** |
| [配置 Webhooks 系统](https://docs.adyen.com/api-explorer/balanceplatform-webhooks/2/overview) | 你可以使用这些网点来建立你的执行。 例如,当某个能力状态发生变化时,您可以使用此信息来更新内部状态. | [配置](https://npmcn.com/package/%40adyen/api-library/src/typings/configurationWebhooks) | **页:1** |
| [争议网点](https://docs.adyen.com/api-explorer/dispute-webhooks/1/overview) | Adyen 发送 Webhooks 通知您的系统与争议相关的事件和回扣, 这样您就可以自动化您的争议处理进程 . | [争议网站](https://npmcn.com/package/%40adyen/api-library/src/typings/disputeWebhooks) | **单曲** |
| [负平衡警告网点](https://docs.adyen.com/api-explorer/negative-balance-warning-webhooks/1/overview) | 当账户持有者或余额账户存在需要补偿的负余额时,Adyen会发送webhooks警告您. | [负面屏蔽警告网站](https://npmcn.com/package/%40adyen/api-library/src/typings/negativeBalanceWarningWebhooks) | **单曲** |
| [管理 Webhooks](https://docs.adyen.com/api-explorer/ManagementNotification/3/overview) | Adyen 在使用 Management API 时, 使用 Webhooks 向您系统通报与您的 Adyen 公司和商号, 商店, 支付终端, 以及支付方法的事件 . | [管理网站](https://npmcn.com/package/%40adyen/api-library/src/typings/managementWebhooks) | **页:1** |
| [通知网点](https://docs.adyen.com/api-explorer/Webhooks/1/overview) | 我们用网友向您发送有关支付状况更新、新报告以及其他您可以订阅的事件的更新。 欲了解更多信息,请查阅我们的文档 | [通知](https://npmcn.com/package/%40adyen/api-library/src/typings/notification) | **单曲** |
| [中继授权 Webhooks](https://docs.adyen.com/api-explorer/relayed-authorisation-webhooks/4/overview) | Adyen 发送 Webhooks 通知您的系统与交易授权相关的事件 . | [中继认证 网络呼号](https://npmcn.com/package/%40adyen/api-library/src/typings/relayedAuthorizationWebhooks) | **页:1** |
| [报告 Webhooks](https://docs.adyen.com/api-explorer/report-webhooks/1/overview) | 您可以通过制作 HTTP 请求程序下载报告, 或者手动从您的平衡平台客户端区域下载报告 | [报 告](https://npmcn.com/package/%40adyen/api-library/src/typings/reportWebhooks) | **单曲** |
| [网络用户化](https://docs.adyen.com/api-explorer/Tokenization-webhooks/1/overview) | Adyen 发送webhooks 通知您 重复的符号的创建和更改 . | [符号化webhooks](https://npmcn.com/package/%40adyen/api-library/src/main/java/com/adyen/model/tokenizationwebhooks) | **单曲** |
| [交易 Webhooks](https://docs.adyen.com/api-explorer/transaction-webhooks/4/overview) | Adyen 发送webhooks 通知您的系统关于您的平台的进出转账. 你可以使用这些网点来建立你的执行。 例如,您可以使用这些信息更新您自己的仪表盘中的余额或者跟踪收到的资金. | [交易 网络呼号](https://npmcn.com/package/%40adyen/api-library/src/typings/transactionWebhooks) | **页:1** |
| [传输 Webhooks](https://docs.adyen.com/api-explorer/transfer-webhooks/4/overview) | 你可以使用这些网点来建立你的执行。 例如,您可以使用这些信息更新您自己的仪表盘中的余额或者跟踪收到的资金. | [转让](https://npmcn.com/package/%40adyen/api-library/src/typings/transferWebhooks) | **页:1** |

更多信息请参见我们 [文档](https://docs.adyen.com/) 或 [API 浏览器](https://docs.adyen.com/api-explorer/)。 。 。 .

## 在你开始之前

在开始整合之前:

-   [创建 Adyen 测试账户](https://docs.adyen.com/get-started-with-adyen#test-account)。 。 。 .
-   [设置您的 API 证书](https://docs.adyen.com/development-resources/api-credentials)。 。 。 .
-   [安装节点.js](https://nodejs.org/en/download/) 18版或稍后版本.

## 安装

安装 [节点JS软件包](https://www.npmjs.com/package/@adyen/api-library)数字 :

```bash
npm install --save @adyen/api-library
```

也可以下载 [在 GitHub 上发布](https://github.com/Adyen/adyen-node-api-library/releases)。 。 。 .

## 更新

要更新Node.JS软件包:

```bash
npm update @adyen/api-library
```

检查断开更改 [页 次](https://github.com/Adyen/adyen-node-api-library/releases/)。 。 。 .

## 使用量

```javascript
// Step 1: Require the parts of the module you want to use
const { Client, CheckoutAPI, EnvironmentEnum} = require('@adyen/api-library');

// Step 2: Initialize the client object
const client = new Client({apiKey: "YOUR_API_KEY", environment: EnvironmentEnum.TEST}); 

// Step 3: Initialize the API object
const checkoutApi = new CheckoutAPI(client);

// Step 4: Create the request object
  const paymentRequest = {
    amount: {
      currency: "USD",
      value: 1000 // value in minor units
    },
    reference: "Your order number",
    paymentMethod: {
      type: "scheme",
      encryptedCardNumber: "test_4111111111111111",
      encryptedExpiryMonth: "test_03",
      encryptedExpiryYear: "test_2030",
      encryptedSecurityCode: "test_737"
    },
    shopperReference: "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j",
    storePaymentMethod: true,
    shopperInteraction: "Ecommerce",
    recurringProcessingModel: "CardOnFile",
    returnUrl: "https://your-company.com/...",
    merchantAccount: "YOUR_MERCHANT_ACCOUNT"
  };
  
// Step 5: Make the request
checkoutApi.PaymentsApi.payments(paymentRequest)
  .then(paymentResponse => console.log(paymentResponse.pspReference))
  .catch(error => console.log(error));
```

如果您想要通过查询字符串参数, 您可以使用 `params` 从字段 [我请求](https://npmcn.com/src/typings/requestOptions.ts) (也用于一能键和其他头字段). 方法描述包含一个实例,说明您可以发送到API用于查询参数的可能值,就像API 探索器中所说的.

您也可以在请求中使用自定义 HTTP 头 `headers` 内部的属性 `IRequest.Options`。这可用于发送不属于标准API请求正文或查询参数的其他元数据或认证细节.

```typescript
const requestOptions: IRequest.Options = {
    headers: {
        "X-Custom-Header": "MyValue",
        "Another-Custom-Header": "AnotherValue"
    }
};
checkoutApi.PaymentsApi.payments(paymentRequest, requestOptions)
  .then(response => console.log("Payment successful:", response))
  .catch(error => console.error("Payment failed:", error));
```

```javascript
const requestOptions: IRequest.Options = {
    params: {
        limit: "5",
        offset: "10"
    }
};
await balancePlatformService.AccountHoldersApi.getAllBalanceAccountsOfAccountHolder("AH32272223222B5CM4MWJ892H", requestOptions);
```

### 第1步: 需要您想要使用的模块部分

使用节点.js `require` 函数以装入 `Client` 和 Adyen 模块中的 API 对象。 API 对象的名称见 [支持的 APIs](https://npmcn.com/package/%40adyen/api-library/#readme-supported-apis)。 。 。 .

例如,使用 [检查出 API](https://docs.adyen.com/api-explorer/Checkout/70/overview)数字 :

```javascript
const { Client, CheckoutAPI, EnvironmentEnum} = require('@adyen/api-library');
```

### 步骤2: 初始化客户端对象

初始化客户端对象,通过如下:

-   `apiKey`API 键入您 [从客户区生成](https://docs.adyen.com/development-resources/api-credentials#generate-api-key)。 。 。 .
-   `environment`: 对于试验环境,使用 **测试**对于活的环境,使用 **活着**。 。 。 .

例如:

```javascript
const client = new Client({apiKey: "YOUR_API_KEY", environment: EnvironmentEnum.TEST}); 
```

### 第3步: 初始化 API 对象

初始化您想要使用的 API 对象,通过 `client` 对象来自上一个步骤.

举例来说 [检查出 API](https://docs.adyen.com/api-explorer/Checkout/70/overview)数字 :

```javascript
const checkoutApi = new CheckoutAPI(client);
```

### 步骤 4: 创建请求对象

创建请求对象 。 例如,对于请求 `/payments` 结束点 :

```javascript
  const paymentRequest = {
    amount: {
      currency: "USD",
      value: 1000 // value in minor units
    },
    reference: "Your order number",
    paymentMethod: {
      type: "scheme",
      encryptedCardNumber: "test_4111111111111111",
      encryptedExpiryMonth: "test_03",
      encryptedExpiryYear: "test_2030",
      encryptedSecurityCode: "test_737"
    },
    shopperReference: "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j",
    storePaymentMethod: true,
    shopperInteraction: "Ecommerce",
    recurringProcessingModel: "CardOnFile",
    returnUrl: "https://your-company.com/...",
    merchantAccount: "YOUR_MERCHANT_ACCOUNT"
  };
```

### 步骤5:提出请求

使用 API 对象的方法来进行请求. 例如,要求 `/payments` 使用 `CheckoutAPI` 对象 :

```javascript
checkoutApi.PaymentsApi.payments(paymentRequest)
  .then(paymentResponse => console.log(paymentResponse.pspReference))
  .catch(error => console.log(error));
```

### 启用时的客户端设置

对于APIS,需要你 [现场 URL 前缀](https://docs.adyen.com/development-resources/live-endpoints#live-url-prefix) 客户端(Binookup,平衡控制,取出,支付和经常性)的设置如下,以便开始处理活期支付: 1

```typescript
const { Client, EnvironmentEnum } = require('@adyen/api-library');

const client = new Client({apiKey: "YOUR_API_KEY", environment: EnvironmentEnum.LIVE, liveEndpointUrlPrefix: "YOUR_LIVE_URL_PREFIX"}); 
```

### 类型脚本中使用

或者,你可以使用 `Types` 包含在本模块中的 Typescript和 `async` 语法.

```typescript
  const { Client, EnvironmentEnum, CheckoutAPI, Types } = require('@adyen/api-library');
  const client = new Client({apiKey: "YOUR_API_KEY", environment: EnvironmentEnum.LIVE, liveEndpointUrlPrefix: "YOUR_LIVE_URL_PREFIX"});

  const makePaymentsRequest = async () => {
    const paymentsRequest : Types.checkout.PaymentRequest = {
      amount: {
        currency: "USD",
        value: 1000 // Value in minor units.
      },
      reference: "Your order number",
      paymentMethod: {
        type: Types.checkout.CardDetails.TypeEnum.Scheme,
        encryptedCardNumber: "test_4111111111111111",
        encryptedExpiryMonth: "test_03",
        encryptedExpiryYear: "test_2030",
        encryptedSecurityCode: "test_737"
      },
      shopperReference: "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j",
      storePaymentMethod: true,
      shopperInteraction: Types.checkout.PaymentRequest.ShopperInteractionEnum.Ecommerce,
      recurringProcessingModel: Types.checkout.PaymentRequest.RecurringProcessingModelEnum.CardOnFile,
      returnUrl: "https://your-company.com/...",
      merchantAccount: "YOUR_MERCHANT_ACCOUNT"
    };
    const checkoutAPI = new CheckoutAPI(client);
    const paymentResponse : Types.checkout.PaymentResponse = await checkoutAPI.PaymentsApi.payments(paymentsRequest);
    console.log(paymentResponse.pspReference);
  }

  makePaymentsRequest();
```

#### 切换 JSON 字符串

在一些设置中,你可能需要去序列化JSON字符串来请求对象. 例如,在结合使用图书馆时 [投篮/组件](https://github.com/Adyen/adyen-web)。请使用内置去区域化功能:

```typescript
// Import the models
import { Types } from "@adyen/api-library";

// Deserialize using built-in ObjectSerializer class
const requestJson: JSON = JSON.parse(`YOUR_JSON_STRING`);
const paymentRequest: Types.checkout.PaymentRequest = await Types.checkout.ObjectSerializer.deserialize(requestJson,"PaymentRequest");
```

### 自定义 HTTP 客户端配置

默认, [节点.js https](https://nodejs.org/api/https.html) 用于提出 API 请求。 也可以设置自定义 `HttpClient` 送给你的 `Client` 对象.

**说明**: 当使用您的自定义时 `HttpClient`,您必须定义所有需要的属性(API密钥、内容类型、超时等)

例如,设置 `axios` 作为您的 HTTP 客户端 :

```javascript
const {Client, Config} = require('@adyen/api-library');
const axios = require("axios");
// ... more code
const config = new Config();
const client = new Client({
  config,
  httpClient: {
    async request(endpoint, json, config, isApiKeyRequired, requestOptions) {
        const response = await axios({
            method: 'POST',
            url: endpoint,
            data: JSON.parse(json),
            headers: {
                "X-API-Key": config.apiKey,
                "Content-type": "application/json"
            },
        });

        return response.data;
    }
  }
});
// ... more code
```

### 浏览和认证银行网站

(一) 分析账户记录通知要求网页浏览;

```typescript
// import models
import { Types, ConfigurationWebhooksHandler } from "@adyen/api-library";

const configurationWebhooksHandler = new ConfigurationWebhooksHandler(YOUR_BANKING_WEBHOOK);
const accountHolderNotificationRequest: Types.configurationWebhooks.AccountHolderNotificationRequest = configurationWebhooksHandler.getAccountHolderNotificationRequest();
```

也可以使用通用类型解析webhook,以防您事先不知道webhook类型. 在这种情况下,您可以检查webhook的实例,以便将其分析为相应的类型(或只是动态使用);

```typescript
const configurationWebhooksHandler = new ConfigurationWebhooksHandler(YOUR_BANKING_WEBHOOK);
const genericWebhook = configurationWebhooksHandler.getGenericWebhook();

if ("accountHolderCode" in genericWebhook) {
  console.log("This is an AccountHolderNotificationRequest");
} else if ("balanceAccountId" in genericWebhook) {
  console.log("This is a BalanceAccountNotificationRequest");
}
```

校验真实性(从 CA 取出 hmac 密钥和从 Webhook 信头取出签名);

```typescript
import { hmacValidator } from "@adyen/api-library";

const validator = new hmacValidator();
const isValid = validator.validateHMACSignature("YOUR_HMAC_KEY", "YOUR_HMAC_SIGNATURE", jsonString);
```

### 管理 Webhooks

管理网点也用同样的方法解析,使用 `ManagementWebhooksHandler`数字 :

```typescript
const managementWebhooksHandler = new ManagementWebhooksHandler(YOUR_MANAGEMENT_WEBHOOK);
const genericWebhook = managementWebhooksHandler.getGenericWebhook();
```

### 代理配置

要配置代理连接,请设置 `proxy` 您的财产 `HttpURLConnectionClient` 对象.

例如:

```javascript
const {HttpURLConnectionClient, Client, Config, EnvironmentEnum} = require('@adyen/api-library');
// ... more code
const client = new Client({apiKey: "YOUR_API_KEY", environment: EnvironmentEnum.TEST}); 
const httpClient = new HttpURLConnectionClient();
httpClient.proxy = { host: "http://google.com", port: 8888,  };

client.httpClient = httpClient;

// ... more code
```

## 亲自支付整合

构建内容丰富的特性 [亲自付款](https://docs.adyen.com/point-of-sale/) 整合,以全球和地方支付方式接受世界各地的支付,并为您的客户创造出独特的购物体验.

### 使用 Cloud 设备 API

对于内部支付云集,建议的解决办法是: [云设备 API](https://docs.adyen.com/api-explorer/cloud-device-api/1/overview)。 。 。 .

检查 [云设备 API 读取](https://npmcn.com/package/%40adyen/api-library/doc/CloudDeviceApi.md)。 。 。 .

如果您正在使用终端( Cloud) API, 请参见 [移徙指南](https://npmcn.com/package/%40adyen/api-library/doc/MigratingToCloudDeviceApi.md)。 。 。 .

### 使用终端 API

与 [终端 API](https://docs.adyen.com/api-explorer/terminal-api/1/overview) 您可以以下列方式发送和接收终端 API 消息:

-   本地通信:使用您本地网络,您的POS系统将请求直接发送到终端的IP地址,并同步接收结果.
-   云通信:使用互联网访问云 `/sync` 财务报告和审定财务报表 `/async` 结束点。 考虑通过 [云设备 API](https://npmcn.com/package/%40adyen/api-library/doc/CloudDeviceApi.md) 换句话说.

检查 [终端API 读取器](https://npmcn.com/package/%40adyen/api-library/doc/TerminalApi.md)。 。 。 .

## 反馈

我们珍视你的投入! 帮助我们加强API图书馆,并通过提供反馈来改善整合经验. 请花点时间填一下 [我们的反馈表](https://forms.gle/A4EERrR6CWgKWe5r9) 分享你的想法、建议或想法.

## 实例整合

克隆我们的 [节点集成](https://github.com/adyen-examples/adyen-node-online-payments) 以查看如何使用用于Node.js的 Adyen API 库。 集成内容包括强调关键特征和概念的代码注释.

## 捐款

我们强烈鼓励你通过以下方式为这个存放处作出贡献:

-   新增功能和功能.
-   修复错误和问题.
-   总体改进.

为了学习如何创建拉动请求,读读我们 [捐款准则](https://npmcn.com/package/%40adyen/api-library/CONTRIBUTING.md)。 。 。 .

## 支助

请求特性、报告错误或报告安全弱点, [创建 GitHub 问题](https://github.com/Adyen/adyen-node-api-library/issues/new/choose)。 。 。 .

有其它问题请联系我们 [支助小组](https://www.adyen.help/)。 。 。 .

## 许可证

此寄存器可在 [麻省理工学院许可证](https://npmcn.com/package/%40adyen/api-library/LICENSE)。 。 。 .

## 另见

-   [实例整合](https://github.com/adyen-examples/adyen-node-online-payments)

## 常见问题

### @adyen/api-library 是什么？

节点JS的 Adyen API 库允许您与 Adyen APIs 合作\.

### 如何安装 @adyen/api-library？

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

### @adyen/api-library 支持 TypeScript 吗？

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

### @adyen/api-library 支持 ESM 还是 CommonJS？

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

### @adyen/api-library 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=18。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @adyen/api-library 可以商用吗？

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

### @adyen/api-library 的下载量有多少？

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

### @adyen/api-library 还在维护吗？

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

