* Update dependency webpack to v4.36.1 * Update dependency @types/node to v11.13.18 * Update babel monorepo to v7.5.5 * Update dependency eslint to v6.1.0 * Update typescript-eslint monorepo to v1.13.0 * Update dependency webpack to v4.37.0 * Update dependency webpack to v4.38.0 * Change 'code' to 'statusCode' on Exception * Change base mock Promise.reject to throw * Update README.md * improve tests for checkout * improve bin lookup tests * improve checkout utility test * improve payout tests * improve terminal and recurring tests * improve local terminal tests * Update dependency @types/jest to v24.0.16 * add httpClient tests * Pin dependency @types/nock to 10.0.3 * Update dependency nock to v11.0.0-beta.30 * Update dependency webpack to v4.39.0 * Update dependency nock to v11.0.0-beta.31 * Update dependency webpack to v4.39.1 * Fixes HTTP Proxy (#56) * Fixes HTTP Proxy * remove manual proxy config, adds http-proxy-agen libt * add promise back to doPostRequest method * Release v2.0.0 (#49)
Adyen Node.js API Library
The Adyen API Library for NodeJS enables you to work with Adyen APIs and Hosted Payment Pages.
Integration
The Library supports all APIs under the following services:
- checkout
- checkout utility
- payments
- modifications
- payouts
- recurring
- notifications
- BIN lookup
Requirements
- Node 8.1.1 or higher
Installation
You can use NPM to add our library to your project
NPM
npm install --save @adyen/api-library
Documentation
- https://docs.adyen.com/developers/development-resources/libraries
- https://docs.adyen.com/developers/checkout/api-integration
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;
...
Support
If you have any problems, questions or suggestions, create an issue here or send your inquiry to support@adyen.com.
Licence
MIT license. For more information, see the LICENSE file.
Other
You can find examples inside the examples folder in this repo.