• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Adyen/adyen-node-api-library: Adyen API Library for Node.js

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

Adyen/adyen-node-api-library

开源软件地址(OpenSource Url):

https://github.com/Adyen/adyen-node-api-library

开源编程语言(OpenSource Language):

TypeScript 99.7%

开源软件介绍(OpenSource Introduction):

Adyen Node.js API Library

Node.js CI Coverage Status Downloads npm bundle size (scoped) Version Quality Gate Status Total alerts Language grade: JavaScript

This is the officially supported NodeJS library for using Adyen's APIs.

Integration

The Library supports all APIs under the following services:

In addition it supports the following type collections:

For more information, refer to our documentation or the API Explorer.

Prerequisites

Installation

You can use NPM to add our library to your project

NPM

npm install --save @adyen/api-library

Alternatively, you can download the release on GitHub.

Using the library

General use with API key

Set up the client as a singleton resource; you can then use it to create service objects for the API calls that you make to Adyen:

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

General use with API key for live environment

    const client = new Client({apiKey: "YOUR_API_KEY", environment: "LIVE"});

General use with basic auth

    const client = new Client({username: "YOUR_USERNAME", password: "YOUR_PASSWORD", environment: "TEST"});

Custom HTTP Client Configuration

By default, NodeJS https will be used to submit requests to the API. But you can change that by injecting your own HttpClient on your client instance. In the example below, we use axios:

const {Client, Config} = require('@adyen/api-library');
const axios = require("axios");
...
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;
    }
  }
});
...

Proxy configuration

You can configure a proxy connection by injecting your own HttpURLConnectionClient on your client instance and changing the proxy setter value.

Example:

const {HttpURLConnectionClient, Client, Config} = require('@adyen/api-library');
...
const config = new Config();
const client = new Client({ config });
const httpClient = new HttpURLConnectionClient();
httpClient.proxy = { host: "http://google.com", port: 8888,  };

client.setEnvironment('TEST');
client.httpClient = httpClient;
...

Example integration

For a closer look at how our NodeJS library works, clone our example integration. This includes commented code, highlighting key features and concepts, and examples of API calls that can be made using the library.

Contributing

We strongly encourage you to join us in contributing to this repository so everyone can benefit from:

  • New features and functionality
  • Resolved bug fixes and issues
  • Any general improvements

Read our contribution guidelines to find out how to create a pull request.

Support

If you have a feature request, or spotted a bug or a technical problem, create a GitHub issue. For other questions, contact our support team.

Licence

This repository is available under the MIT license.

See also




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap