@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
@@ -17,16 +17,15 @@ List all gateway tokens stored for a payment method.
17
17
 
18
18
  <!-- UsageSnippet language="typescript" operationID="list_payment_method_payment_service_tokens" method="get" path="/payment-methods/{payment_method_id}/payment-service-tokens" -->
19
19
  ```typescript
20
- import { Gr4vy, withToken } from "@gr4vy/sdk";
21
- import fs from "fs";
20
+ import { Gr4vy } from "@gr4vy/sdk";
22
21
 
23
22
  const gr4vy = new Gr4vy({
24
- id: "example",
25
- server: "sandbox",
26
- merchantAccountId: "default",
27
- bearerAuth: withToken({
28
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
29
- }),
23
+ merchantAccountId: "<id>",
24
+ server: "sandbox",
25
+ id: "example",
26
+ bearerAuth: withToken({
27
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
28
+ }),
30
29
  });
31
30
 
32
31
  async function run() {
@@ -44,13 +43,18 @@ The standalone function version of this method:
44
43
 
45
44
  ```typescript
46
45
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
46
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
47
47
  import { paymentMethodsPaymentServiceTokensList } from "@gr4vy/sdk/funcs/paymentMethodsPaymentServiceTokensList.js";
48
48
 
49
49
  // Use `Gr4vyCore` for best tree-shaking performance.
50
50
  // You can create one instance of it to use across an application.
51
51
  const gr4vy = new Gr4vyCore({
52
52
  merchantAccountId: "<id>",
53
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
53
+ server: "sandbox",
54
+ id: "example",
55
+ bearerAuth: withToken({
56
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
57
+ }),
54
58
  });
55
59
 
56
60
  async function run() {
@@ -107,16 +111,15 @@ Create a gateway tokens for a payment method.
107
111
 
108
112
  <!-- UsageSnippet language="typescript" operationID="create_payment_method_payment_service_token" method="post" path="/payment-methods/{payment_method_id}/payment-service-tokens" -->
109
113
  ```typescript
110
- import { Gr4vy, withToken } from "@gr4vy/sdk";
111
- import fs from "fs";
114
+ import { Gr4vy } from "@gr4vy/sdk";
112
115
 
113
116
  const gr4vy = new Gr4vy({
114
- id: "example",
115
- server: "sandbox",
116
- merchantAccountId: "default",
117
- bearerAuth: withToken({
118
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
119
- }),
117
+ merchantAccountId: "<id>",
118
+ server: "sandbox",
119
+ id: "example",
120
+ bearerAuth: withToken({
121
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
122
+ }),
120
123
  });
121
124
 
122
125
  async function run() {
@@ -137,13 +140,18 @@ The standalone function version of this method:
137
140
 
138
141
  ```typescript
139
142
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
143
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
140
144
  import { paymentMethodsPaymentServiceTokensCreate } from "@gr4vy/sdk/funcs/paymentMethodsPaymentServiceTokensCreate.js";
141
145
 
142
146
  // Use `Gr4vyCore` for best tree-shaking performance.
143
147
  // You can create one instance of it to use across an application.
144
148
  const gr4vy = new Gr4vyCore({
145
149
  merchantAccountId: "<id>",
146
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
150
+ server: "sandbox",
151
+ id: "example",
152
+ bearerAuth: withToken({
153
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
154
+ }),
147
155
  });
148
156
 
149
157
  async function run() {
@@ -203,16 +211,15 @@ Delete a gateway tokens for a payment method.
203
211
 
204
212
  <!-- UsageSnippet language="typescript" operationID="delete_payment_method_payment_service_token" method="delete" path="/payment-methods/{payment_method_id}/payment-service-tokens/{payment_service_token_id}" -->
205
213
  ```typescript
206
- import { Gr4vy, withToken } from "@gr4vy/sdk";
207
- import fs from "fs";
214
+ import { Gr4vy } from "@gr4vy/sdk";
208
215
 
209
216
  const gr4vy = new Gr4vy({
210
- id: "example",
211
- server: "sandbox",
212
- merchantAccountId: "default",
213
- bearerAuth: withToken({
214
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
215
- }),
217
+ merchantAccountId: "<id>",
218
+ server: "sandbox",
219
+ id: "example",
220
+ bearerAuth: withToken({
221
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
222
+ }),
216
223
  });
217
224
 
218
225
  async function run() {
@@ -230,13 +237,18 @@ The standalone function version of this method:
230
237
 
231
238
  ```typescript
232
239
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
240
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
233
241
  import { paymentMethodsPaymentServiceTokensDelete } from "@gr4vy/sdk/funcs/paymentMethodsPaymentServiceTokensDelete.js";
234
242
 
235
243
  // Use `Gr4vyCore` for best tree-shaking performance.
236
244
  // You can create one instance of it to use across an application.
237
245
  const gr4vy = new Gr4vyCore({
238
246
  merchantAccountId: "<id>",
239
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
247
+ server: "sandbox",
248
+ id: "example",
249
+ bearerAuth: withToken({
250
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
251
+ }),
240
252
  });
241
253
 
242
254
  async function run() {
@@ -17,16 +17,15 @@ Returns a list of payouts made.
17
17
 
18
18
  <!-- UsageSnippet language="typescript" operationID="list_payouts" method="get" path="/payouts" -->
19
19
  ```typescript
20
- import { Gr4vy, withToken } from "@gr4vy/sdk";
21
- import fs from "fs";
20
+ import { Gr4vy } from "@gr4vy/sdk";
22
21
 
23
22
  const gr4vy = new Gr4vy({
24
- id: "example",
25
- server: "sandbox",
26
- merchantAccountId: "default",
27
- bearerAuth: withToken({
28
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
29
- }),
23
+ merchantAccountId: "<id>",
24
+ server: "sandbox",
25
+ id: "example",
26
+ bearerAuth: withToken({
27
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
28
+ }),
30
29
  });
31
30
 
32
31
  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 { payoutsList } from "@gr4vy/sdk/funcs/payoutsList.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() {
@@ -111,16 +115,15 @@ Creates a new payout.
111
115
 
112
116
  <!-- UsageSnippet language="typescript" operationID="create_payout" method="post" path="/payouts" -->
113
117
  ```typescript
114
- import { Gr4vy, withToken } from "@gr4vy/sdk";
115
- import fs from "fs";
118
+ import { Gr4vy } from "@gr4vy/sdk";
116
119
 
117
120
  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
- }),
121
+ merchantAccountId: "<id>",
122
+ server: "sandbox",
123
+ id: "example",
124
+ bearerAuth: withToken({
125
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
126
+ }),
124
127
  });
125
128
 
126
129
  async function run() {
@@ -146,13 +149,18 @@ The standalone function version of this method:
146
149
 
147
150
  ```typescript
148
151
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
152
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
149
153
  import { payoutsCreate } from "@gr4vy/sdk/funcs/payoutsCreate.js";
150
154
 
151
155
  // Use `Gr4vyCore` for best tree-shaking performance.
152
156
  // You can create one instance of it to use across an application.
153
157
  const gr4vy = new Gr4vyCore({
154
158
  merchantAccountId: "<id>",
155
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
159
+ server: "sandbox",
160
+ id: "example",
161
+ bearerAuth: withToken({
162
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
163
+ }),
156
164
  });
157
165
 
158
166
  async function run() {
@@ -216,16 +224,15 @@ Retrieves a payout.
216
224
 
217
225
  <!-- UsageSnippet language="typescript" operationID="get_payout" method="get" path="/payouts/{payout_id}" -->
218
226
  ```typescript
219
- import { Gr4vy, withToken } from "@gr4vy/sdk";
220
- import fs from "fs";
227
+ import { Gr4vy } from "@gr4vy/sdk";
221
228
 
222
229
  const gr4vy = new Gr4vy({
223
- id: "example",
224
- server: "sandbox",
225
- merchantAccountId: "default",
226
- bearerAuth: withToken({
227
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
228
- }),
230
+ merchantAccountId: "<id>",
231
+ server: "sandbox",
232
+ id: "example",
233
+ bearerAuth: withToken({
234
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
235
+ }),
229
236
  });
230
237
 
231
238
  async function run() {
@@ -243,13 +250,18 @@ The standalone function version of this method:
243
250
 
244
251
  ```typescript
245
252
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
253
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
246
254
  import { payoutsGet } from "@gr4vy/sdk/funcs/payoutsGet.js";
247
255
 
248
256
  // Use `Gr4vyCore` for best tree-shaking performance.
249
257
  // You can create one instance of it to use across an application.
250
258
  const gr4vy = new Gr4vyCore({
251
259
  merchantAccountId: "<id>",
252
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
260
+ server: "sandbox",
261
+ id: "example",
262
+ bearerAuth: withToken({
263
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
264
+ }),
253
265
  });
254
266
 
255
267
  async function run() {
@@ -15,16 +15,15 @@ Fetch a refund.
15
15
 
16
16
  <!-- UsageSnippet language="typescript" operationID="get_refund" method="get" path="/refunds/{refund_id}" -->
17
17
  ```typescript
18
- import { Gr4vy, withToken } from "@gr4vy/sdk";
19
- import fs from "fs";
18
+ import { Gr4vy } from "@gr4vy/sdk";
20
19
 
21
20
  const gr4vy = new Gr4vy({
22
- id: "example",
23
- server: "sandbox",
24
- merchantAccountId: "default",
25
- bearerAuth: withToken({
26
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
27
- }),
21
+ merchantAccountId: "<id>",
22
+ server: "sandbox",
23
+ id: "example",
24
+ bearerAuth: withToken({
25
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
26
+ }),
28
27
  });
29
28
 
30
29
  async function run() {
@@ -42,13 +41,18 @@ The standalone function version of this method:
42
41
 
43
42
  ```typescript
44
43
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
44
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
45
45
  import { refundsGet } from "@gr4vy/sdk/funcs/refundsGet.js";
46
46
 
47
47
  // Use `Gr4vyCore` for best tree-shaking performance.
48
48
  // You can create one instance of it to use across an application.
49
49
  const gr4vy = new Gr4vyCore({
50
50
  merchantAccountId: "<id>",
51
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
51
+ server: "sandbox",
52
+ id: "example",
53
+ bearerAuth: withToken({
54
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
55
+ }),
52
56
  });
53
57
 
54
58
  async function run() {
@@ -15,16 +15,15 @@ List all executed reports that have been generated.
15
15
 
16
16
  <!-- UsageSnippet language="typescript" operationID="list_all_report_executions" method="get" path="/report-executions" -->
17
17
  ```typescript
18
- import { Gr4vy, withToken } from "@gr4vy/sdk";
19
- import fs from "fs";
18
+ import { Gr4vy } from "@gr4vy/sdk";
20
19
 
21
20
  const gr4vy = new Gr4vy({
22
- id: "example",
23
- server: "sandbox",
24
- merchantAccountId: "default",
25
- bearerAuth: withToken({
26
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
27
- }),
21
+ merchantAccountId: "<id>",
22
+ server: "sandbox",
23
+ id: "example",
24
+ bearerAuth: withToken({
25
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
26
+ }),
28
27
  });
29
28
 
30
29
  async function run() {
@@ -44,13 +43,18 @@ The standalone function version of this method:
44
43
 
45
44
  ```typescript
46
45
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
46
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
47
47
  import { reportExecutionsList } from "@gr4vy/sdk/funcs/reportExecutionsList.js";
48
48
 
49
49
  // Use `Gr4vyCore` for best tree-shaking performance.
50
50
  // You can create one instance of it to use across an application.
51
51
  const gr4vy = new Gr4vyCore({
52
52
  merchantAccountId: "<id>",
53
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
53
+ server: "sandbox",
54
+ id: "example",
55
+ bearerAuth: withToken({
56
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
57
+ }),
54
58
  });
55
59
 
56
60
  async function run() {
@@ -18,16 +18,15 @@ List all configured reports that can be generated.
18
18
 
19
19
  <!-- UsageSnippet language="typescript" operationID="list_reports" method="get" path="/reports" -->
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() {
@@ -47,13 +46,18 @@ The standalone function version of this method:
47
46
 
48
47
  ```typescript
49
48
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
49
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
50
50
  import { reportsList } from "@gr4vy/sdk/funcs/reportsList.js";
51
51
 
52
52
  // Use `Gr4vyCore` for best tree-shaking performance.
53
53
  // You can create one instance of it to use across an application.
54
54
  const gr4vy = new Gr4vyCore({
55
55
  merchantAccountId: "<id>",
56
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
56
+ server: "sandbox",
57
+ id: "example",
58
+ bearerAuth: withToken({
59
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
60
+ }),
57
61
  });
58
62
 
59
63
  async function run() {
@@ -110,16 +114,15 @@ Create a new report.
110
114
 
111
115
  <!-- UsageSnippet language="typescript" operationID="add_report" method="post" path="/reports" -->
112
116
  ```typescript
113
- import { Gr4vy, withToken } from "@gr4vy/sdk";
114
- import fs from "fs";
117
+ import { Gr4vy } from "@gr4vy/sdk";
115
118
 
116
119
  const gr4vy = new Gr4vy({
117
- id: "example",
118
- server: "sandbox",
119
- merchantAccountId: "default",
120
- bearerAuth: withToken({
121
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
122
- }),
120
+ merchantAccountId: "<id>",
121
+ server: "sandbox",
122
+ id: "example",
123
+ bearerAuth: withToken({
124
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
125
+ }),
123
126
  });
124
127
 
125
128
  async function run() {
@@ -153,13 +156,18 @@ The standalone function version of this method:
153
156
 
154
157
  ```typescript
155
158
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
159
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
156
160
  import { reportsCreate } from "@gr4vy/sdk/funcs/reportsCreate.js";
157
161
 
158
162
  // Use `Gr4vyCore` for best tree-shaking performance.
159
163
  // You can create one instance of it to use across an application.
160
164
  const gr4vy = new Gr4vyCore({
161
165
  merchantAccountId: "<id>",
162
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
166
+ server: "sandbox",
167
+ id: "example",
168
+ bearerAuth: withToken({
169
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
170
+ }),
163
171
  });
164
172
 
165
173
  async function run() {
@@ -231,16 +239,15 @@ Fetches a report by its ID.
231
239
 
232
240
  <!-- UsageSnippet language="typescript" operationID="get_report" method="get" path="/reports/{report_id}" -->
233
241
  ```typescript
234
- import { Gr4vy, withToken } from "@gr4vy/sdk";
235
- import fs from "fs";
242
+ import { Gr4vy } from "@gr4vy/sdk";
236
243
 
237
244
  const gr4vy = new Gr4vy({
238
- id: "example",
239
- server: "sandbox",
240
- merchantAccountId: "default",
241
- bearerAuth: withToken({
242
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
243
- }),
245
+ merchantAccountId: "<id>",
246
+ server: "sandbox",
247
+ id: "example",
248
+ bearerAuth: withToken({
249
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
250
+ }),
244
251
  });
245
252
 
246
253
  async function run() {
@@ -258,13 +265,18 @@ The standalone function version of this method:
258
265
 
259
266
  ```typescript
260
267
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
268
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
261
269
  import { reportsGet } from "@gr4vy/sdk/funcs/reportsGet.js";
262
270
 
263
271
  // Use `Gr4vyCore` for best tree-shaking performance.
264
272
  // You can create one instance of it to use across an application.
265
273
  const gr4vy = new Gr4vyCore({
266
274
  merchantAccountId: "<id>",
267
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
275
+ server: "sandbox",
276
+ id: "example",
277
+ bearerAuth: withToken({
278
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
279
+ }),
268
280
  });
269
281
 
270
282
  async function run() {
@@ -320,16 +332,15 @@ Updates the configuration of a report.
320
332
 
321
333
  <!-- UsageSnippet language="typescript" operationID="update_report" method="put" path="/reports/{report_id}" -->
322
334
  ```typescript
323
- import { Gr4vy, withToken } from "@gr4vy/sdk";
324
- import fs from "fs";
335
+ import { Gr4vy } from "@gr4vy/sdk";
325
336
 
326
337
  const gr4vy = new Gr4vy({
327
- id: "example",
328
- server: "sandbox",
329
- merchantAccountId: "default",
330
- bearerAuth: withToken({
331
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
332
- }),
338
+ merchantAccountId: "<id>",
339
+ server: "sandbox",
340
+ id: "example",
341
+ bearerAuth: withToken({
342
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
343
+ }),
333
344
  });
334
345
 
335
346
  async function run() {
@@ -347,13 +358,18 @@ The standalone function version of this method:
347
358
 
348
359
  ```typescript
349
360
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
361
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
350
362
  import { reportsPut } from "@gr4vy/sdk/funcs/reportsPut.js";
351
363
 
352
364
  // Use `Gr4vyCore` for best tree-shaking performance.
353
365
  // You can create one instance of it to use across an application.
354
366
  const gr4vy = new Gr4vyCore({
355
367
  merchantAccountId: "<id>",
356
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
368
+ server: "sandbox",
369
+ id: "example",
370
+ bearerAuth: withToken({
371
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
372
+ }),
357
373
  });
358
374
 
359
375
  async function run() {
@@ -17,16 +17,15 @@ Create a session for use with Google Pay.
17
17
 
18
18
  <!-- UsageSnippet language="typescript" operationID="create_google_pay_digital_wallet_session" method="post" path="/digital-wallets/google/session" -->
19
19
  ```typescript
20
- import { Gr4vy, withToken } from "@gr4vy/sdk";
21
- import fs from "fs";
20
+ import { Gr4vy } from "@gr4vy/sdk";
22
21
 
23
22
  const gr4vy = new Gr4vy({
24
- id: "example",
25
- server: "sandbox",
26
- merchantAccountId: "default",
27
- bearerAuth: withToken({
28
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
29
- }),
23
+ merchantAccountId: "<id>",
24
+ server: "sandbox",
25
+ id: "example",
26
+ bearerAuth: withToken({
27
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
28
+ }),
30
29
  });
31
30
 
32
31
  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 { digitalWalletsSessionsGooglePay } from "@gr4vy/sdk/funcs/digitalWalletsSessionsGooglePay.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() {
@@ -110,16 +114,15 @@ Create a session for use with Apple Pay.
110
114
 
111
115
  <!-- UsageSnippet language="typescript" operationID="create_apple_pay_digital_wallet_session" method="post" path="/digital-wallets/apple/session" -->
112
116
  ```typescript
113
- import { Gr4vy, withToken } from "@gr4vy/sdk";
114
- import fs from "fs";
117
+ import { Gr4vy } from "@gr4vy/sdk";
115
118
 
116
119
  const gr4vy = new Gr4vy({
117
- id: "example",
118
- server: "sandbox",
119
- merchantAccountId: "default",
120
- bearerAuth: withToken({
121
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
122
- }),
120
+ merchantAccountId: "<id>",
121
+ server: "sandbox",
122
+ id: "example",
123
+ bearerAuth: withToken({
124
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
125
+ }),
123
126
  });
124
127
 
125
128
  async function run() {
@@ -140,13 +143,18 @@ The standalone function version of this method:
140
143
 
141
144
  ```typescript
142
145
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
146
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
143
147
  import { digitalWalletsSessionsApplePay } from "@gr4vy/sdk/funcs/digitalWalletsSessionsApplePay.js";
144
148
 
145
149
  // Use `Gr4vyCore` for best tree-shaking performance.
146
150
  // You can create one instance of it to use across an application.
147
151
  const gr4vy = new Gr4vyCore({
148
152
  merchantAccountId: "<id>",
149
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
153
+ server: "sandbox",
154
+ id: "example",
155
+ bearerAuth: withToken({
156
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
157
+ }),
150
158
  });
151
159
 
152
160
  async function run() {
@@ -205,16 +213,14 @@ Create a session for use with Click to Pay.
205
213
 
206
214
  <!-- UsageSnippet language="typescript" operationID="create_click_to_pay_digital_wallet_session" method="post" path="/digital-wallets/click-to-pay/session" -->
207
215
  ```typescript
208
- import { Gr4vy, withToken } from "@gr4vy/sdk";
209
- import fs from "fs";
216
+ import { Gr4vy } from "@gr4vy/sdk";
210
217
 
211
218
  const gr4vy = new Gr4vy({
212
- id: "example",
213
- server: "sandbox",
214
- merchantAccountId: "default",
215
- bearerAuth: withToken({
216
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
217
- }),
219
+ server: "sandbox",
220
+ id: "example",
221
+ bearerAuth: withToken({
222
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
223
+ }),
218
224
  });
219
225
 
220
226
  async function run() {
@@ -234,12 +240,17 @@ The standalone function version of this method:
234
240
 
235
241
  ```typescript
236
242
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
243
+ import { withToken } from "@gr4vy/sdk/lib/auth.js";
237
244
  import { digitalWalletsSessionsClickToPay } from "@gr4vy/sdk/funcs/digitalWalletsSessionsClickToPay.js";
238
245
 
239
246
  // Use `Gr4vyCore` for best tree-shaking performance.
240
247
  // You can create one instance of it to use across an application.
241
248
  const gr4vy = new Gr4vyCore({
242
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
249
+ server: "sandbox",
250
+ id: "example",
251
+ bearerAuth: withToken({
252
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
253
+ }),
243
254
  });
244
255
 
245
256
  async function run() {