Skip to content

Commit b55677a

Browse files
committed
Update snippets in README
1 parent 345279d commit b55677a

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ Check for breaking changes on the [releases page](https://github.com/Adyen/adyen
8989

9090
``` javascript
9191
// 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');
9393

9494
// 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});
9696

9797
// Step 3: Initialize the API object
9898
const checkoutApi = new CheckoutAPI(client);
@@ -143,7 +143,7 @@ Use the Node.js `require` function to load the `Client` and API objects from the
143143
For example, to use the [Checkout API](https://docs.adyen.com/api-explorer/Checkout/70/overview):
144144

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

149149
### Step 2: Initialize the client object
@@ -155,7 +155,7 @@ Initialize the client object, passing the following:
155155
For example:
156156

157157
``` javascript
158-
const client = new Client({apiKey: "YOUR_API_KEY", environment: "TEST"});
158+
const client = new Client({apiKey: "YOUR_API_KEY", environment: EnvironmentEnum.TEST});
159159
```
160160

161161
### Step 3: Initialize the API object
@@ -208,18 +208,18 @@ checkoutApi.PaymentsApi.payments(paymentRequest)
208208

209209
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:
210210
``` typescript
211-
const { Client } = require('@adyen/api-library');
211+
const { Client, EnvironmentEnum } = require('@adyen/api-library');
212212

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"});
214214
```
215215

216216
### Usage in TypeScript
217217

218218
Alternatively, you can use the `Types` included in this module for Typescript and `async` syntax.
219219

220220
``` 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"});
223223

224224
const makePaymentsRequest = async () => {
225225
const paymentsRequest : Types.checkout.PaymentRequest = {
@@ -332,7 +332,7 @@ const client = new Client({ config });
332332
const httpClient = new HttpURLConnectionClient();
333333
httpClient.proxy = { host: "http://google.com", port: 8888, };
334334

335-
client.setEnvironment('TEST');
335+
client.setEnvironment(EnvironmentEnum.TEST);
336336
client.httpClient = httpClient;
337337

338338
// ... more code
@@ -343,12 +343,12 @@ For In-Person Payments integrations with the [Cloud Terminal API](https://docs.a
343343
``` javascript
344344
// Step 1: Require the parts of the module you want to use
345345
const {Client, TerminalCloudAPI} from "@adyen/api-library";
346-
const { Config, RegionEnum } = require("@adyen/api-library");
346+
const { Config, EnvironmentEnum, RegionEnum } = require("@adyen/api-library");
347347

348348
// Step 2: Initialize the client object
349349
const config = new Config({
350350
apiKey: "YOUR_API_KEY",
351-
environment: "LIVE",
351+
environment: EnvironmentEnum.LIVE,
352352
region: RegionEnum.US
353353
});
354354
const client = new Client(config);

0 commit comments

Comments
 (0)