@@ -89,10 +89,10 @@ Check for breaking changes on the [releases page](https://github.com/Adyen/adyen
89
89
90
90
``` javascript
91
91
// Step 1: Require the parts of the module you want to use
92
- const { Client , CheckoutAPI } = require (' @adyen/api-library' );
92
+ const { Client , CheckoutAPI , EnvironmentEnum } = require (' @adyen/api-library' );
93
93
94
94
// Step 2: Initialize the client object
95
- const client = new Client ({apiKey: " YOUR_API_KEY" , environment: " TEST" });
95
+ const client = new Client ({apiKey: " YOUR_API_KEY" , environment: EnvironmentEnum . TEST });
96
96
97
97
// Step 3: Initialize the API object
98
98
const checkoutApi = new CheckoutAPI (client);
@@ -143,7 +143,7 @@ Use the Node.js `require` function to load the `Client` and API objects from the
143
143
For example, to use the [ Checkout API] ( https://docs.adyen.com/api-explorer/Checkout/70/overview ) :
144
144
145
145
``` javascript
146
- const { Client , CheckoutAPI } = require (' @adyen/api-library' );
146
+ const { Client , CheckoutAPI , EnvironmentEnum } = require (' @adyen/api-library' );
147
147
```
148
148
149
149
### Step 2: Initialize the client object
@@ -155,7 +155,7 @@ Initialize the client object, passing the following:
155
155
For example:
156
156
157
157
``` javascript
158
- const client = new Client ({apiKey: " YOUR_API_KEY" , environment: " TEST" });
158
+ const client = new Client ({apiKey: " YOUR_API_KEY" , environment: EnvironmentEnum . TEST });
159
159
```
160
160
161
161
### Step 3: Initialize the API object
@@ -208,18 +208,18 @@ checkoutApi.PaymentsApi.payments(paymentRequest)
208
208
209
209
For APIS that require your [ Live URL Prefix] ( https://docs.adyen.com/development-resources/live-endpoints#live-url-prefix ) (Binlookup, BalanceControl, Checkout, Payout and Recurring) the client is set up as follows in order to start processing live payments:
210
210
``` typescript
211
- const { Client } = require (' @adyen/api-library' );
211
+ const { Client, EnvironmentEnum } = require (' @adyen/api-library' );
212
212
213
- const client = new Client ({apiKey: " YOUR_API_KEY" , environment: " LIVE" , liveEndpointUrlPrefix: " YOUR_LIVE_URL_PREFIX" });
213
+ const client = new Client ({apiKey: " YOUR_API_KEY" , environment: EnvironmentEnum . LIVE , liveEndpointUrlPrefix: " YOUR_LIVE_URL_PREFIX" });
214
214
```
215
215
216
216
### Usage in TypeScript
217
217
218
218
Alternatively, you can use the ` Types ` included in this module for Typescript and ` async ` syntax.
219
219
220
220
``` typescript
221
- const { Client, CheckoutAPI, Types } = require (' @adyen/api-library' );
222
- const client = new Client ({apiKey: " YOUR_API_KEY" , environment: " LIVE" , liveEndpointUrlPrefix: " YOUR_LIVE_URL_PREFIX" });
221
+ const { Client, EnvironmentEnum, CheckoutAPI, Types } = require (' @adyen/api-library' );
222
+ const client = new Client ({apiKey: " YOUR_API_KEY" , environment: EnvironmentEnum . LIVE , liveEndpointUrlPrefix: " YOUR_LIVE_URL_PREFIX" });
223
223
224
224
const makePaymentsRequest = async () => {
225
225
const paymentsRequest : Types .checkout .PaymentRequest = {
@@ -332,7 +332,7 @@ const client = new Client({ config });
332
332
const httpClient = new HttpURLConnectionClient ();
333
333
httpClient .proxy = { host: " http://google.com" , port: 8888 , };
334
334
335
- client .setEnvironment (' TEST' );
335
+ client .setEnvironment (EnvironmentEnum . TEST );
336
336
client .httpClient = httpClient;
337
337
338
338
// ... more code
@@ -343,12 +343,12 @@ For In-Person Payments integrations with the [Cloud Terminal API](https://docs.a
343
343
``` javascript
344
344
// Step 1: Require the parts of the module you want to use
345
345
const {Client , TerminalCloudAPI } from "@adyen /api -library ";
346
- const { Config , RegionEnum } = require (" @adyen/api-library" );
346
+ const { Config , EnvironmentEnum , RegionEnum } = require (" @adyen/api-library" );
347
347
348
348
// Step 2: Initialize the client object
349
349
const config = new Config ({
350
350
apiKey: " YOUR_API_KEY" ,
351
- environment: " LIVE" ,
351
+ environment: EnvironmentEnum . LIVE ,
352
352
region: RegionEnum .US
353
353
});
354
354
const client = new Client (config);
0 commit comments