@gr4vy/sdk 1.1.30 → 1.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/FUNCTIONS.md +6 -1
  2. package/README.md +37 -32
  3. package/docs/sdks/all/README.md +13 -9
  4. package/docs/sdks/auditlogs/README.md +13 -9
  5. package/docs/sdks/balances/README.md +13 -9
  6. package/docs/sdks/buyers/README.md +65 -45
  7. package/docs/sdks/cardschemedefinitions/README.md +13 -9
  8. package/docs/sdks/checkoutsessions/README.md +52 -36
  9. package/docs/sdks/cryptogram/README.md +13 -9
  10. package/docs/sdks/digitalwallets/README.md +65 -45
  11. package/docs/sdks/domains/README.md +26 -18
  12. package/docs/sdks/events/README.md +13 -9
  13. package/docs/sdks/executions/README.md +39 -27
  14. package/docs/sdks/giftcards/README.md +52 -36
  15. package/docs/sdks/gr4vygiftcards/README.md +13 -9
  16. package/docs/sdks/gr4vypaymentmethods/README.md +13 -9
  17. package/docs/sdks/gr4vyrefunds/README.md +39 -27
  18. package/docs/sdks/jobs/README.md +13 -9
  19. package/docs/sdks/merchantaccounts/README.md +48 -36
  20. package/docs/sdks/networktokens/README.md +65 -45
  21. package/docs/sdks/paymentlinks/README.md +52 -36
  22. package/docs/sdks/paymentmethods/README.md +52 -36
  23. package/docs/sdks/paymentoptions/README.md +13 -9
  24. package/docs/sdks/paymentservicedefinitions/README.md +36 -27
  25. package/docs/sdks/paymentservices/README.md +91 -63
  26. package/docs/sdks/paymentservicetokens/README.md +39 -27
  27. package/docs/sdks/payouts/README.md +39 -27
  28. package/docs/sdks/refunds/README.md +13 -9
  29. package/docs/sdks/reportexecutions/README.md +13 -9
  30. package/docs/sdks/reports/README.md +52 -36
  31. package/docs/sdks/sessions/README.md +38 -27
  32. package/docs/sdks/settlements/README.md +26 -18
  33. package/docs/sdks/shippingdetails/README.md +65 -45
  34. package/docs/sdks/transactions/README.md +91 -63
  35. package/examples/accountUpdaterJobsCreate.example.ts +3 -8
  36. package/jsr.json +1 -1
  37. package/lib/config.d.ts +3 -3
  38. package/lib/config.js +3 -3
  39. package/lib/security.d.ts.map +1 -1
  40. package/lib/security.js.map +1 -1
  41. package/models/components/stripeconnectoptions.d.ts +5 -0
  42. package/models/components/stripeconnectoptions.d.ts.map +1 -1
  43. package/models/components/stripeconnectoptions.js +4 -0
  44. package/models/components/stripeconnectoptions.js.map +1 -1
  45. package/models/components/transactionevent.d.ts +2 -0
  46. package/models/components/transactionevent.d.ts.map +1 -1
  47. package/models/components/transactionevent.js +2 -0
  48. package/models/components/transactionevent.js.map +1 -1
  49. package/models/components/travelhuboptions.d.ts +5 -0
  50. package/models/components/travelhuboptions.d.ts.map +1 -1
  51. package/models/components/travelhuboptions.js +2 -0
  52. package/models/components/travelhuboptions.js.map +1 -1
  53. package/models/components/trustlyoptions.d.ts +5 -0
  54. package/models/components/trustlyoptions.d.ts.map +1 -1
  55. package/models/components/trustlyoptions.js +2 -0
  56. package/models/components/trustlyoptions.js.map +1 -1
  57. package/package.json +1 -1
  58. package/src/lib/config.ts +3 -3
  59. package/src/lib/security.ts +4 -1
  60. package/src/models/components/stripeconnectoptions.ts +9 -0
  61. package/src/models/components/transactionevent.ts +4 -0
  62. package/src/models/components/travelhuboptions.ts +7 -0
  63. package/src/models/components/trustlyoptions.ts +7 -0
  64. package/examples/package-lock.json +0 -2716
@@ -18,16 +18,14 @@ List all merchant accounts in an instance.
18
18
 
19
19
  <!-- UsageSnippet language="typescript" operationID="list_merchant_accounts" method="get" path="/merchant-accounts" -->
20
20
  ```typescript
21
- import { Gr4vy, withToken } from "@gr4vy/sdk";
22
- import fs from "fs";
21
+ import { Gr4vy } from "@gr4vy/sdk";
23
22
 
24
23
  const gr4vy = new Gr4vy({
25
- id: "example",
26
- server: "sandbox",
27
- merchantAccountId: "default",
28
- bearerAuth: withToken({
29
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
30
- }),
24
+ server: "sandbox",
25
+ id: "example",
26
+ bearerAuth: withToken({
27
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
28
+ }),
31
29
  });
32
30
 
33
31
  async function run() {
@@ -47,12 +45,17 @@ The standalone function version of this method:
47
45
 
48
46
  ```typescript
49
47
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
48
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
50
49
  import { merchantAccountsList } from "@gr4vy/sdk/funcs/merchantAccountsList.js";
51
50
 
52
51
  // Use `Gr4vyCore` for best tree-shaking performance.
53
52
  // You can create one instance of it to use across an application.
54
53
  const gr4vy = new Gr4vyCore({
55
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
54
+ server: "sandbox",
55
+ id: "example",
56
+ bearerAuth: withToken({
57
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
58
+ }),
56
59
  });
57
60
 
58
61
  async function run() {
@@ -111,16 +114,14 @@ Create a new merchant account in an instance.
111
114
 
112
115
  <!-- UsageSnippet language="typescript" operationID="create_merchant_account" method="post" path="/merchant-accounts" -->
113
116
  ```typescript
114
- import { Gr4vy, withToken } from "@gr4vy/sdk";
115
- import fs from "fs";
117
+ import { Gr4vy } from "@gr4vy/sdk";
116
118
 
117
119
  const gr4vy = new Gr4vy({
118
- id: "example",
119
- server: "sandbox",
120
- merchantAccountId: "default",
121
- bearerAuth: withToken({
122
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
123
- }),
120
+ server: "sandbox",
121
+ id: "example",
122
+ bearerAuth: withToken({
123
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
124
+ }),
124
125
  });
125
126
 
126
127
  async function run() {
@@ -142,12 +143,17 @@ The standalone function version of this method:
142
143
 
143
144
  ```typescript
144
145
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
146
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
145
147
  import { merchantAccountsCreate } from "@gr4vy/sdk/funcs/merchantAccountsCreate.js";
146
148
 
147
149
  // Use `Gr4vyCore` for best tree-shaking performance.
148
150
  // You can create one instance of it to use across an application.
149
151
  const gr4vy = new Gr4vyCore({
150
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
152
+ server: "sandbox",
153
+ id: "example",
154
+ bearerAuth: withToken({
155
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
156
+ }),
151
157
  });
152
158
 
153
159
  async function run() {
@@ -206,16 +212,14 @@ Get info about a merchant account in an instance.
206
212
 
207
213
  <!-- UsageSnippet language="typescript" operationID="get_merchant_account" method="get" path="/merchant-accounts/{merchant_account_id}" -->
208
214
  ```typescript
209
- import { Gr4vy, withToken } from "@gr4vy/sdk";
210
- import fs from "fs";
215
+ import { Gr4vy } from "@gr4vy/sdk";
211
216
 
212
217
  const gr4vy = new Gr4vy({
213
- id: "example",
214
- server: "sandbox",
215
- merchantAccountId: "default",
216
- bearerAuth: withToken({
217
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
218
- }),
218
+ server: "sandbox",
219
+ id: "example",
220
+ bearerAuth: withToken({
221
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
222
+ }),
219
223
  });
220
224
 
221
225
  async function run() {
@@ -233,12 +237,17 @@ The standalone function version of this method:
233
237
 
234
238
  ```typescript
235
239
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
240
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
236
241
  import { merchantAccountsGet } from "@gr4vy/sdk/funcs/merchantAccountsGet.js";
237
242
 
238
243
  // Use `Gr4vyCore` for best tree-shaking performance.
239
244
  // You can create one instance of it to use across an application.
240
245
  const gr4vy = new Gr4vyCore({
241
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
246
+ server: "sandbox",
247
+ id: "example",
248
+ bearerAuth: withToken({
249
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
250
+ }),
242
251
  });
243
252
 
244
253
  async function run() {
@@ -293,16 +302,14 @@ Update info for a merchant account in an instance.
293
302
 
294
303
  <!-- UsageSnippet language="typescript" operationID="update_merchant_account" method="put" path="/merchant-accounts/{merchant_account_id}" -->
295
304
  ```typescript
296
- import { Gr4vy, withToken } from "@gr4vy/sdk";
297
- import fs from "fs";
305
+ import { Gr4vy } from "@gr4vy/sdk";
298
306
 
299
307
  const gr4vy = new Gr4vy({
300
- id: "example",
301
- server: "sandbox",
302
- merchantAccountId: "default",
303
- bearerAuth: withToken({
304
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
305
- }),
308
+ server: "sandbox",
309
+ id: "example",
310
+ bearerAuth: withToken({
311
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
312
+ }),
306
313
  });
307
314
 
308
315
  async function run() {
@@ -322,12 +329,17 @@ The standalone function version of this method:
322
329
 
323
330
  ```typescript
324
331
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
332
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
325
333
  import { merchantAccountsUpdate } from "@gr4vy/sdk/funcs/merchantAccountsUpdate.js";
326
334
 
327
335
  // Use `Gr4vyCore` for best tree-shaking performance.
328
336
  // You can create one instance of it to use across an application.
329
337
  const gr4vy = new Gr4vyCore({
330
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
338
+ server: "sandbox",
339
+ id: "example",
340
+ bearerAuth: withToken({
341
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
342
+ }),
331
343
  });
332
344
 
333
345
  async function run() {
@@ -19,16 +19,15 @@ List all network tokens stored for a payment method.
19
19
 
20
20
  <!-- UsageSnippet language="typescript" operationID="list_payment_method_network_tokens" method="get" path="/payment-methods/{payment_method_id}/network-tokens" -->
21
21
  ```typescript
22
- import { Gr4vy, withToken } from "@gr4vy/sdk";
23
- import fs from "fs";
22
+ import { Gr4vy } from "@gr4vy/sdk";
24
23
 
25
24
  const gr4vy = new Gr4vy({
26
- id: "example",
27
- server: "sandbox",
28
- merchantAccountId: "default",
29
- bearerAuth: withToken({
30
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
31
- }),
25
+ merchantAccountId: "<id>",
26
+ server: "sandbox",
27
+ id: "example",
28
+ bearerAuth: withToken({
29
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
30
+ }),
32
31
  });
33
32
 
34
33
  async function run() {
@@ -46,13 +45,18 @@ The standalone function version of this method:
46
45
 
47
46
  ```typescript
48
47
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
48
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
49
49
  import { paymentMethodsNetworkTokensList } from "@gr4vy/sdk/funcs/paymentMethodsNetworkTokensList.js";
50
50
 
51
51
  // Use `Gr4vyCore` for best tree-shaking performance.
52
52
  // You can create one instance of it to use across an application.
53
53
  const gr4vy = new Gr4vyCore({
54
54
  merchantAccountId: "<id>",
55
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
55
+ server: "sandbox",
56
+ id: "example",
57
+ bearerAuth: withToken({
58
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
59
+ }),
56
60
  });
57
61
 
58
62
  async function run() {
@@ -108,16 +112,15 @@ Provision a network token for a payment method.
108
112
 
109
113
  <!-- UsageSnippet language="typescript" operationID="create_payment_method_network_token" method="post" path="/payment-methods/{payment_method_id}/network-tokens" -->
110
114
  ```typescript
111
- import { Gr4vy, withToken } from "@gr4vy/sdk";
112
- import fs from "fs";
115
+ import { Gr4vy } from "@gr4vy/sdk";
113
116
 
114
117
  const gr4vy = new Gr4vy({
115
- id: "example",
116
- server: "sandbox",
117
- merchantAccountId: "default",
118
- bearerAuth: withToken({
119
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
120
- }),
118
+ merchantAccountId: "<id>",
119
+ server: "sandbox",
120
+ id: "example",
121
+ bearerAuth: withToken({
122
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
123
+ }),
121
124
  });
122
125
 
123
126
  async function run() {
@@ -138,13 +141,18 @@ The standalone function version of this method:
138
141
 
139
142
  ```typescript
140
143
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
144
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
141
145
  import { paymentMethodsNetworkTokensCreate } from "@gr4vy/sdk/funcs/paymentMethodsNetworkTokensCreate.js";
142
146
 
143
147
  // Use `Gr4vyCore` for best tree-shaking performance.
144
148
  // You can create one instance of it to use across an application.
145
149
  const gr4vy = new Gr4vyCore({
146
150
  merchantAccountId: "<id>",
147
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
151
+ server: "sandbox",
152
+ id: "example",
153
+ bearerAuth: withToken({
154
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
155
+ }),
148
156
  });
149
157
 
150
158
  async function run() {
@@ -204,16 +212,15 @@ Suspend a network token for a payment method.
204
212
 
205
213
  <!-- UsageSnippet language="typescript" operationID="suspend_payment_method_network_token" method="post" path="/payment-methods/{payment_method_id}/network-tokens/{network_token_id}/suspend" -->
206
214
  ```typescript
207
- import { Gr4vy, withToken } from "@gr4vy/sdk";
208
- import fs from "fs";
215
+ import { Gr4vy } from "@gr4vy/sdk";
209
216
 
210
217
  const gr4vy = new Gr4vy({
211
- id: "example",
212
- server: "sandbox",
213
- merchantAccountId: "default",
214
- bearerAuth: withToken({
215
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
216
- }),
218
+ merchantAccountId: "<id>",
219
+ server: "sandbox",
220
+ id: "example",
221
+ bearerAuth: withToken({
222
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
223
+ }),
217
224
  });
218
225
 
219
226
  async function run() {
@@ -231,13 +238,18 @@ The standalone function version of this method:
231
238
 
232
239
  ```typescript
233
240
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
241
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
234
242
  import { paymentMethodsNetworkTokensSuspend } from "@gr4vy/sdk/funcs/paymentMethodsNetworkTokensSuspend.js";
235
243
 
236
244
  // Use `Gr4vyCore` for best tree-shaking performance.
237
245
  // You can create one instance of it to use across an application.
238
246
  const gr4vy = new Gr4vyCore({
239
247
  merchantAccountId: "<id>",
240
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
248
+ server: "sandbox",
249
+ id: "example",
250
+ bearerAuth: withToken({
251
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
252
+ }),
241
253
  });
242
254
 
243
255
  async function run() {
@@ -294,16 +306,15 @@ Resume a suspended network token for a payment method.
294
306
 
295
307
  <!-- UsageSnippet language="typescript" operationID="resume_payment_method_network_token" method="post" path="/payment-methods/{payment_method_id}/network-tokens/{network_token_id}/resume" -->
296
308
  ```typescript
297
- import { Gr4vy, withToken } from "@gr4vy/sdk";
298
- import fs from "fs";
309
+ import { Gr4vy } from "@gr4vy/sdk";
299
310
 
300
311
  const gr4vy = new Gr4vy({
301
- id: "example",
302
- server: "sandbox",
303
- merchantAccountId: "default",
304
- bearerAuth: withToken({
305
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
306
- }),
312
+ merchantAccountId: "<id>",
313
+ server: "sandbox",
314
+ id: "example",
315
+ bearerAuth: withToken({
316
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
317
+ }),
307
318
  });
308
319
 
309
320
  async function run() {
@@ -321,13 +332,18 @@ The standalone function version of this method:
321
332
 
322
333
  ```typescript
323
334
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
335
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
324
336
  import { paymentMethodsNetworkTokensResume } from "@gr4vy/sdk/funcs/paymentMethodsNetworkTokensResume.js";
325
337
 
326
338
  // Use `Gr4vyCore` for best tree-shaking performance.
327
339
  // You can create one instance of it to use across an application.
328
340
  const gr4vy = new Gr4vyCore({
329
341
  merchantAccountId: "<id>",
330
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
342
+ server: "sandbox",
343
+ id: "example",
344
+ bearerAuth: withToken({
345
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
346
+ }),
331
347
  });
332
348
 
333
349
  async function run() {
@@ -384,16 +400,15 @@ Delete a network token for a payment method.
384
400
 
385
401
  <!-- UsageSnippet language="typescript" operationID="delete_payment_method_network_token" method="delete" path="/payment-methods/{payment_method_id}/network-tokens/{network_token_id}" -->
386
402
  ```typescript
387
- import { Gr4vy, withToken } from "@gr4vy/sdk";
388
- import fs from "fs";
403
+ import { Gr4vy } from "@gr4vy/sdk";
389
404
 
390
405
  const gr4vy = new Gr4vy({
391
- id: "example",
392
- server: "sandbox",
393
- merchantAccountId: "default",
394
- bearerAuth: withToken({
395
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
396
- }),
406
+ merchantAccountId: "<id>",
407
+ server: "sandbox",
408
+ id: "example",
409
+ bearerAuth: withToken({
410
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
411
+ }),
397
412
  });
398
413
 
399
414
  async function run() {
@@ -411,13 +426,18 @@ The standalone function version of this method:
411
426
 
412
427
  ```typescript
413
428
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
429
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
414
430
  import { paymentMethodsNetworkTokensDelete } from "@gr4vy/sdk/funcs/paymentMethodsNetworkTokensDelete.js";
415
431
 
416
432
  // Use `Gr4vyCore` for best tree-shaking performance.
417
433
  // You can create one instance of it to use across an application.
418
434
  const gr4vy = new Gr4vyCore({
419
435
  merchantAccountId: "<id>",
420
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
436
+ server: "sandbox",
437
+ id: "example",
438
+ bearerAuth: withToken({
439
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
440
+ }),
421
441
  });
422
442
 
423
443
  async function run() {
@@ -18,16 +18,15 @@ Create a new payment link.
18
18
 
19
19
  <!-- UsageSnippet language="typescript" operationID="add_payment_link" method="post" path="/payment-links" -->
20
20
  ```typescript
21
- import { Gr4vy, withToken } from "@gr4vy/sdk";
22
- import fs from "fs";
21
+ import { Gr4vy } from "@gr4vy/sdk";
23
22
 
24
23
  const gr4vy = new Gr4vy({
25
- id: "example",
26
- server: "sandbox",
27
- merchantAccountId: "default",
28
- bearerAuth: withToken({
29
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
30
- }),
24
+ merchantAccountId: "<id>",
25
+ server: "sandbox",
26
+ id: "example",
27
+ bearerAuth: withToken({
28
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
29
+ }),
31
30
  });
32
31
 
33
32
  async function run() {
@@ -49,13 +48,18 @@ The standalone function version of this method:
49
48
 
50
49
  ```typescript
51
50
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
51
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
52
52
  import { paymentLinksCreate } from "@gr4vy/sdk/funcs/paymentLinksCreate.js";
53
53
 
54
54
  // Use `Gr4vyCore` for best tree-shaking performance.
55
55
  // You can create one instance of it to use across an application.
56
56
  const gr4vy = new Gr4vyCore({
57
57
  merchantAccountId: "<id>",
58
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
58
+ server: "sandbox",
59
+ id: "example",
60
+ bearerAuth: withToken({
61
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
62
+ }),
59
63
  });
60
64
 
61
65
  async function run() {
@@ -115,16 +119,15 @@ List all created payment links.
115
119
 
116
120
  <!-- UsageSnippet language="typescript" operationID="list_payment_links" method="get" path="/payment-links" -->
117
121
  ```typescript
118
- import { Gr4vy, withToken } from "@gr4vy/sdk";
119
- import fs from "fs";
122
+ import { Gr4vy } from "@gr4vy/sdk";
120
123
 
121
124
  const gr4vy = new Gr4vy({
122
- id: "example",
123
- server: "sandbox",
124
- merchantAccountId: "default",
125
- bearerAuth: withToken({
126
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
127
- }),
125
+ merchantAccountId: "<id>",
126
+ server: "sandbox",
127
+ id: "example",
128
+ bearerAuth: withToken({
129
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
130
+ }),
128
131
  });
129
132
 
130
133
  async function run() {
@@ -144,13 +147,18 @@ The standalone function version of this method:
144
147
 
145
148
  ```typescript
146
149
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
150
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
147
151
  import { paymentLinksList } from "@gr4vy/sdk/funcs/paymentLinksList.js";
148
152
 
149
153
  // Use `Gr4vyCore` for best tree-shaking performance.
150
154
  // You can create one instance of it to use across an application.
151
155
  const gr4vy = new Gr4vyCore({
152
156
  merchantAccountId: "<id>",
153
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
157
+ server: "sandbox",
158
+ id: "example",
159
+ bearerAuth: withToken({
160
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
161
+ }),
154
162
  });
155
163
 
156
164
  async function run() {
@@ -210,16 +218,15 @@ Expire an existing payment link.
210
218
 
211
219
  <!-- UsageSnippet language="typescript" operationID="expire_payment_link" method="post" path="/payment-links/{payment_link_id}/expire" -->
212
220
  ```typescript
213
- import { Gr4vy, withToken } from "@gr4vy/sdk";
214
- import fs from "fs";
221
+ import { Gr4vy } from "@gr4vy/sdk";
215
222
 
216
223
  const gr4vy = new Gr4vy({
217
- id: "example",
218
- server: "sandbox",
219
- merchantAccountId: "default",
220
- bearerAuth: withToken({
221
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
222
- }),
224
+ merchantAccountId: "<id>",
225
+ server: "sandbox",
226
+ id: "example",
227
+ bearerAuth: withToken({
228
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
229
+ }),
223
230
  });
224
231
 
225
232
  async function run() {
@@ -237,13 +244,18 @@ The standalone function version of this method:
237
244
 
238
245
  ```typescript
239
246
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
247
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
240
248
  import { paymentLinksExpire } from "@gr4vy/sdk/funcs/paymentLinksExpire.js";
241
249
 
242
250
  // Use `Gr4vyCore` for best tree-shaking performance.
243
251
  // You can create one instance of it to use across an application.
244
252
  const gr4vy = new Gr4vyCore({
245
253
  merchantAccountId: "<id>",
246
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
254
+ server: "sandbox",
255
+ id: "example",
256
+ bearerAuth: withToken({
257
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
258
+ }),
247
259
  });
248
260
 
249
261
  async function run() {
@@ -299,16 +311,15 @@ Fetch the details for a payment link.
299
311
 
300
312
  <!-- UsageSnippet language="typescript" operationID="get_payment_link" method="get" path="/payment-links/{payment_link_id}" -->
301
313
  ```typescript
302
- import { Gr4vy, withToken } from "@gr4vy/sdk";
303
- import fs from "fs";
314
+ import { Gr4vy } from "@gr4vy/sdk";
304
315
 
305
316
  const gr4vy = new Gr4vy({
306
- id: "example",
307
- server: "sandbox",
308
- merchantAccountId: "default",
309
- bearerAuth: withToken({
310
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
311
- }),
317
+ merchantAccountId: "<id>",
318
+ server: "sandbox",
319
+ id: "example",
320
+ bearerAuth: withToken({
321
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
322
+ }),
312
323
  });
313
324
 
314
325
  async function run() {
@@ -326,13 +337,18 @@ The standalone function version of this method:
326
337
 
327
338
  ```typescript
328
339
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
340
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
329
341
  import { paymentLinksGet } from "@gr4vy/sdk/funcs/paymentLinksGet.js";
330
342
 
331
343
  // Use `Gr4vyCore` for best tree-shaking performance.
332
344
  // You can create one instance of it to use across an application.
333
345
  const gr4vy = new Gr4vyCore({
334
346
  merchantAccountId: "<id>",
335
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
347
+ server: "sandbox",
348
+ id: "example",
349
+ bearerAuth: withToken({
350
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
351
+ }),
336
352
  });
337
353
 
338
354
  async function run() {