@gr4vy/sdk 1.5.8 → 1.6.1

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 (49) hide show
  1. package/examples/package-lock.json +1 -1
  2. package/jsr.json +1 -1
  3. package/lib/config.d.ts +3 -3
  4. package/lib/config.js +3 -3
  5. package/models/components/checkoutsession.d.ts +15 -0
  6. package/models/components/checkoutsession.d.ts.map +1 -1
  7. package/models/components/checkoutsession.js +8 -0
  8. package/models/components/checkoutsession.js.map +1 -1
  9. package/models/components/checkoutsessioncreate.d.ts +15 -0
  10. package/models/components/checkoutsessioncreate.d.ts.map +1 -1
  11. package/models/components/checkoutsessioncreate.js +8 -0
  12. package/models/components/checkoutsessioncreate.js.map +1 -1
  13. package/package.json +1 -1
  14. package/src/lib/config.ts +3 -3
  15. package/src/models/components/checkoutsession.ts +23 -0
  16. package/src/models/components/checkoutsessioncreate.ts +23 -0
  17. package/docs/sdks/all/README.md +0 -98
  18. package/docs/sdks/auditlogs/README.md +0 -100
  19. package/docs/sdks/balances/README.md +0 -123
  20. package/docs/sdks/buyers/README.md +0 -461
  21. package/docs/sdks/cardschemedefinitions/README.md +0 -96
  22. package/docs/sdks/checkoutsessions/README.md +0 -367
  23. package/docs/sdks/cryptogram/README.md +0 -103
  24. package/docs/sdks/digitalwallets/README.md +0 -465
  25. package/docs/sdks/domains/README.md +0 -197
  26. package/docs/sdks/events/README.md +0 -99
  27. package/docs/sdks/executions/README.md +0 -285
  28. package/docs/sdks/giftcards/README.md +0 -376
  29. package/docs/sdks/gr4vygiftcards/README.md +0 -98
  30. package/docs/sdks/gr4vypaymentmethods/README.md +0 -96
  31. package/docs/sdks/gr4vyrefunds/README.md +0 -279
  32. package/docs/sdks/jobs/README.md +0 -107
  33. package/docs/sdks/merchantaccounts/README.md +0 -382
  34. package/docs/sdks/networktokens/README.md +0 -467
  35. package/docs/sdks/paymentlinks/README.md +0 -381
  36. package/docs/sdks/paymentmethods/README.md +0 -376
  37. package/docs/sdks/paymentoptions/README.md +0 -97
  38. package/docs/sdks/paymentservicedefinitions/README.md +0 -281
  39. package/docs/sdks/paymentservices/README.md +0 -706
  40. package/docs/sdks/paymentservicetokens/README.md +0 -286
  41. package/docs/sdks/payouts/README.md +0 -298
  42. package/docs/sdks/refunds/README.md +0 -97
  43. package/docs/sdks/reportexecutions/README.md +0 -100
  44. package/docs/sdks/reports/README.md +0 -403
  45. package/docs/sdks/sessions/README.md +0 -289
  46. package/docs/sdks/settlements/README.md +0 -188
  47. package/docs/sdks/shippingdetails/README.md +0 -462
  48. package/docs/sdks/transactions/README.md +0 -752
  49. package/examples/README.md +0 -31
@@ -1,752 +0,0 @@
1
- # Transactions
2
- (*transactions*)
3
-
4
- ## Overview
5
-
6
- ### Available Operations
7
-
8
- * [list](#list) - List transactions
9
- * [create](#create) - Create transaction
10
- * [get](#get) - Get transaction
11
- * [update](#update) - Manually update a transaction
12
- * [capture](#capture) - Capture transaction
13
- * [void](#void) - Void transaction
14
- * [cancel](#cancel) - Cancel transaction
15
- * [sync](#sync) - Sync transaction
16
-
17
- ## list
18
-
19
- Returns a paginated list of transactions for the merchant account, sorted by most recently updated. You can filter, sort, and search transactions using query parameters.
20
-
21
- ### Example Usage
22
-
23
- <!-- UsageSnippet language="typescript" operationID="list_transactions" method="get" path="/transactions" -->
24
- ```typescript
25
- import { Gr4vy, withToken } from "@gr4vy/sdk";
26
- import fs from "fs";
27
-
28
- const gr4vy = new Gr4vy({
29
- id: "example",
30
- server: "sandbox",
31
- merchantAccountId: "default",
32
- bearerAuth: withToken({
33
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
34
- }),
35
- });
36
-
37
- async function run() {
38
- const result = await gr4vy.transactions.list();
39
-
40
- for await (const page of result) {
41
- console.log(page);
42
- }
43
- }
44
-
45
- run();
46
- ```
47
-
48
- ### Standalone function
49
-
50
- The standalone function version of this method:
51
-
52
- ```typescript
53
- import { Gr4vyCore } from "@gr4vy/sdk/core.js";
54
- import { transactionsList } from "@gr4vy/sdk/funcs/transactionsList.js";
55
-
56
- // Use `Gr4vyCore` for best tree-shaking performance.
57
- // You can create one instance of it to use across an application.
58
- const gr4vy = new Gr4vyCore({
59
- merchantAccountId: "<id>",
60
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
61
- });
62
-
63
- async function run() {
64
- const res = await transactionsList(gr4vy);
65
- if (res.ok) {
66
- const { value: result } = res;
67
- for await (const page of result) {
68
- console.log(page);
69
- }
70
- } else {
71
- console.log("transactionsList failed:", res.error);
72
- }
73
- }
74
-
75
- run();
76
- ```
77
-
78
- ### Parameters
79
-
80
- | Parameter | Type | Required | Description |
81
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
82
- | `request` | [operations.ListTransactionsRequest](../../models/operations/listtransactionsrequest.md) | :heavy_check_mark: | The request object to use for the request. |
83
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
84
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
85
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
86
-
87
- ### Response
88
-
89
- **Promise\<[operations.ListTransactionsResponse](../../models/operations/listtransactionsresponse.md)\>**
90
-
91
- ### Errors
92
-
93
- | Error Type | Status Code | Content Type |
94
- | -------------------------- | -------------------------- | -------------------------- |
95
- | errors.Error400 | 400 | application/json |
96
- | errors.Error401 | 401 | application/json |
97
- | errors.Error403 | 403 | application/json |
98
- | errors.Error404 | 404 | application/json |
99
- | errors.Error405 | 405 | application/json |
100
- | errors.Error409 | 409 | application/json |
101
- | errors.HTTPValidationError | 422 | application/json |
102
- | errors.Error425 | 425 | application/json |
103
- | errors.Error429 | 429 | application/json |
104
- | errors.Error500 | 500 | application/json |
105
- | errors.Error502 | 502 | application/json |
106
- | errors.Error504 | 504 | application/json |
107
- | errors.SDKError | 4XX, 5XX | \*/\* |
108
-
109
- ## create
110
-
111
- Create a new transaction using a supported payment method. If additional buyer authorization is required, an approval URL will be returned. Duplicated gift card numbers are not supported.
112
-
113
- ### Example Usage
114
-
115
- <!-- UsageSnippet language="typescript" operationID="create_transaction" method="post" path="/transactions" -->
116
- ```typescript
117
- import { Gr4vy, withToken } from "@gr4vy/sdk";
118
- import fs from "fs";
119
-
120
- const gr4vy = new Gr4vy({
121
- id: "example",
122
- server: "sandbox",
123
- merchantAccountId: "default",
124
- bearerAuth: withToken({
125
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
126
- }),
127
- });
128
-
129
- async function run() {
130
- const result = await gr4vy.transactions.create({
131
- amount: 1299,
132
- currency: "EUR",
133
- store: true,
134
- isSubsequentPayment: true,
135
- merchantInitiated: true,
136
- asyncCapture: true,
137
- accountFundingTransaction: true,
138
- });
139
-
140
- console.log(result);
141
- }
142
-
143
- run();
144
- ```
145
-
146
- ### Standalone function
147
-
148
- The standalone function version of this method:
149
-
150
- ```typescript
151
- import { Gr4vyCore } from "@gr4vy/sdk/core.js";
152
- import { transactionsCreate } from "@gr4vy/sdk/funcs/transactionsCreate.js";
153
-
154
- // Use `Gr4vyCore` for best tree-shaking performance.
155
- // You can create one instance of it to use across an application.
156
- const gr4vy = new Gr4vyCore({
157
- merchantAccountId: "<id>",
158
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
159
- });
160
-
161
- async function run() {
162
- const res = await transactionsCreate(gr4vy, {
163
- amount: 1299,
164
- currency: "EUR",
165
- store: true,
166
- isSubsequentPayment: true,
167
- merchantInitiated: true,
168
- asyncCapture: true,
169
- accountFundingTransaction: true,
170
- });
171
- if (res.ok) {
172
- const { value: result } = res;
173
- console.log(result);
174
- } else {
175
- console.log("transactionsCreate failed:", res.error);
176
- }
177
- }
178
-
179
- run();
180
- ```
181
-
182
- ### Parameters
183
-
184
- | Parameter | Type | Required | Description | Example |
185
- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
186
- | `transactionCreate` | [components.TransactionCreate](../../models/components/transactioncreate.md) | :heavy_check_mark: | N/A | |
187
- | `merchantAccountId` | *string* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | |
188
- | `idempotencyKey` | *string* | :heavy_minus_sign: | A unique key that identifies this request. Providing this header will make this an idempotent request. We recommend using V4 UUIDs, or another random string with enough entropy to avoid collisions. | [object Object] |
189
- | `xForwardedFor` | *string* | :heavy_minus_sign: | The IP address to forward from the customer. Use this when calling<br/>our API from the server side to ensure the customer's address is<br/>passed to downstream services, rather than your server IP. | [object Object] |
190
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | |
191
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | |
192
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | |
193
-
194
- ### Response
195
-
196
- **Promise\<[components.TransactionOutput](../../models/components/transactionoutput.md)\>**
197
-
198
- ### Errors
199
-
200
- | Error Type | Status Code | Content Type |
201
- | -------------------------- | -------------------------- | -------------------------- |
202
- | errors.Error400 | 400 | application/json |
203
- | errors.Error401 | 401 | application/json |
204
- | errors.Error403 | 403 | application/json |
205
- | errors.Error404 | 404 | application/json |
206
- | errors.Error405 | 405 | application/json |
207
- | errors.Error409 | 409 | application/json |
208
- | errors.HTTPValidationError | 422 | application/json |
209
- | errors.Error425 | 425 | application/json |
210
- | errors.Error429 | 429 | application/json |
211
- | errors.Error500 | 500 | application/json |
212
- | errors.Error502 | 502 | application/json |
213
- | errors.Error504 | 504 | application/json |
214
- | errors.SDKError | 4XX, 5XX | \*/\* |
215
-
216
- ## get
217
-
218
- Retrieve the details of a transaction by its unique identifier.
219
-
220
- ### Example Usage
221
-
222
- <!-- UsageSnippet language="typescript" operationID="get_transaction" method="get" path="/transactions/{transaction_id}" -->
223
- ```typescript
224
- import { Gr4vy, withToken } from "@gr4vy/sdk";
225
- import fs from "fs";
226
-
227
- const gr4vy = new Gr4vy({
228
- id: "example",
229
- server: "sandbox",
230
- merchantAccountId: "default",
231
- bearerAuth: withToken({
232
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
233
- }),
234
- });
235
-
236
- async function run() {
237
- const result = await gr4vy.transactions.get("7099948d-7286-47e4-aad8-b68f7eb44591");
238
-
239
- console.log(result);
240
- }
241
-
242
- run();
243
- ```
244
-
245
- ### Standalone function
246
-
247
- The standalone function version of this method:
248
-
249
- ```typescript
250
- import { Gr4vyCore } from "@gr4vy/sdk/core.js";
251
- import { transactionsGet } from "@gr4vy/sdk/funcs/transactionsGet.js";
252
-
253
- // Use `Gr4vyCore` for best tree-shaking performance.
254
- // You can create one instance of it to use across an application.
255
- const gr4vy = new Gr4vyCore({
256
- merchantAccountId: "<id>",
257
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
258
- });
259
-
260
- async function run() {
261
- const res = await transactionsGet(gr4vy, "7099948d-7286-47e4-aad8-b68f7eb44591");
262
- if (res.ok) {
263
- const { value: result } = res;
264
- console.log(result);
265
- } else {
266
- console.log("transactionsGet failed:", res.error);
267
- }
268
- }
269
-
270
- run();
271
- ```
272
-
273
- ### Parameters
274
-
275
- | Parameter | Type | Required | Description | Example |
276
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
277
- | `transactionId` | *string* | :heavy_check_mark: | The ID of the transaction | [object Object] |
278
- | `merchantAccountId` | *string* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | |
279
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | |
280
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | |
281
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | |
282
-
283
- ### Response
284
-
285
- **Promise\<[components.TransactionOutput](../../models/components/transactionoutput.md)\>**
286
-
287
- ### Errors
288
-
289
- | Error Type | Status Code | Content Type |
290
- | -------------------------- | -------------------------- | -------------------------- |
291
- | errors.Error400 | 400 | application/json |
292
- | errors.Error401 | 401 | application/json |
293
- | errors.Error403 | 403 | application/json |
294
- | errors.Error404 | 404 | application/json |
295
- | errors.Error405 | 405 | application/json |
296
- | errors.Error409 | 409 | application/json |
297
- | errors.HTTPValidationError | 422 | application/json |
298
- | errors.Error425 | 425 | application/json |
299
- | errors.Error429 | 429 | application/json |
300
- | errors.Error500 | 500 | application/json |
301
- | errors.Error502 | 502 | application/json |
302
- | errors.Error504 | 504 | application/json |
303
- | errors.SDKError | 4XX, 5XX | \*/\* |
304
-
305
- ## update
306
-
307
- Manually updates a transaction.
308
-
309
- ### Example Usage
310
-
311
- <!-- UsageSnippet language="typescript" operationID="update_transaction" method="put" path="/transactions/{transaction_id}" -->
312
- ```typescript
313
- import { Gr4vy, withToken } from "@gr4vy/sdk";
314
- import fs from "fs";
315
-
316
- const gr4vy = new Gr4vy({
317
- id: "example",
318
- server: "sandbox",
319
- merchantAccountId: "default",
320
- bearerAuth: withToken({
321
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
322
- }),
323
- });
324
-
325
- async function run() {
326
- const result = await gr4vy.transactions.update({}, "7099948d-7286-47e4-aad8-b68f7eb44591");
327
-
328
- console.log(result);
329
- }
330
-
331
- run();
332
- ```
333
-
334
- ### Standalone function
335
-
336
- The standalone function version of this method:
337
-
338
- ```typescript
339
- import { Gr4vyCore } from "@gr4vy/sdk/core.js";
340
- import { transactionsUpdate } from "@gr4vy/sdk/funcs/transactionsUpdate.js";
341
-
342
- // Use `Gr4vyCore` for best tree-shaking performance.
343
- // You can create one instance of it to use across an application.
344
- const gr4vy = new Gr4vyCore({
345
- merchantAccountId: "<id>",
346
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
347
- });
348
-
349
- async function run() {
350
- const res = await transactionsUpdate(gr4vy, {}, "7099948d-7286-47e4-aad8-b68f7eb44591");
351
- if (res.ok) {
352
- const { value: result } = res;
353
- console.log(result);
354
- } else {
355
- console.log("transactionsUpdate failed:", res.error);
356
- }
357
- }
358
-
359
- run();
360
- ```
361
-
362
- ### Parameters
363
-
364
- | Parameter | Type | Required | Description | Example |
365
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
366
- | `transactionId` | *string* | :heavy_check_mark: | The ID of the transaction | [object Object] |
367
- | `transactionUpdate` | [components.TransactionUpdate](../../models/components/transactionupdate.md) | :heavy_check_mark: | N/A | |
368
- | `merchantAccountId` | *string* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | |
369
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | |
370
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | |
371
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | |
372
-
373
- ### Response
374
-
375
- **Promise\<[components.TransactionOutput](../../models/components/transactionoutput.md)\>**
376
-
377
- ### Errors
378
-
379
- | Error Type | Status Code | Content Type |
380
- | -------------------------- | -------------------------- | -------------------------- |
381
- | errors.Error400 | 400 | application/json |
382
- | errors.Error401 | 401 | application/json |
383
- | errors.Error403 | 403 | application/json |
384
- | errors.Error404 | 404 | application/json |
385
- | errors.Error405 | 405 | application/json |
386
- | errors.Error409 | 409 | application/json |
387
- | errors.HTTPValidationError | 422 | application/json |
388
- | errors.Error425 | 425 | application/json |
389
- | errors.Error429 | 429 | application/json |
390
- | errors.Error500 | 500 | application/json |
391
- | errors.Error502 | 502 | application/json |
392
- | errors.Error504 | 504 | application/json |
393
- | errors.SDKError | 4XX, 5XX | \*/\* |
394
-
395
- ## capture
396
-
397
- Captures a previously authorized transaction. You can capture the full or a partial amount, as long as it does not exceed the authorized amount (unless over-capture is enabled).
398
-
399
- ### Example Usage
400
-
401
- <!-- UsageSnippet language="typescript" operationID="capture_transaction" method="post" path="/transactions/{transaction_id}/capture" -->
402
- ```typescript
403
- import { Gr4vy, withToken } from "@gr4vy/sdk";
404
- import fs from "fs";
405
-
406
- const gr4vy = new Gr4vy({
407
- id: "example",
408
- server: "sandbox",
409
- merchantAccountId: "default",
410
- bearerAuth: withToken({
411
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
412
- }),
413
- });
414
-
415
- async function run() {
416
- const result = await gr4vy.transactions.capture({}, "7099948d-7286-47e4-aad8-b68f7eb44591");
417
-
418
- console.log(result);
419
- }
420
-
421
- run();
422
- ```
423
-
424
- ### Standalone function
425
-
426
- The standalone function version of this method:
427
-
428
- ```typescript
429
- import { Gr4vyCore } from "@gr4vy/sdk/core.js";
430
- import { transactionsCapture } from "@gr4vy/sdk/funcs/transactionsCapture.js";
431
-
432
- // Use `Gr4vyCore` for best tree-shaking performance.
433
- // You can create one instance of it to use across an application.
434
- const gr4vy = new Gr4vyCore({
435
- merchantAccountId: "<id>",
436
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
437
- });
438
-
439
- async function run() {
440
- const res = await transactionsCapture(gr4vy, {}, "7099948d-7286-47e4-aad8-b68f7eb44591");
441
- if (res.ok) {
442
- const { value: result } = res;
443
- console.log(result);
444
- } else {
445
- console.log("transactionsCapture failed:", res.error);
446
- }
447
- }
448
-
449
- run();
450
- ```
451
-
452
- ### Parameters
453
-
454
- | Parameter | Type | Required | Description | Example |
455
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
456
- | `transactionId` | *string* | :heavy_check_mark: | The ID of the transaction | [object Object] |
457
- | `transactionCaptureCreate` | [components.TransactionCaptureCreate](../../models/components/transactioncapturecreate.md) | :heavy_check_mark: | N/A | |
458
- | `prefer` | *string*[] | :heavy_minus_sign: | The preferred resource type in the response. | [object Object] |
459
- | `merchantAccountId` | *string* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | |
460
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | |
461
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | |
462
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | |
463
-
464
- ### Response
465
-
466
- **Promise\<[operations.CaptureTransactionResponseCaptureTransaction](../../models/operations/capturetransactionresponsecapturetransaction.md)\>**
467
-
468
- ### Errors
469
-
470
- | Error Type | Status Code | Content Type |
471
- | -------------------------- | -------------------------- | -------------------------- |
472
- | errors.Error400 | 400 | application/json |
473
- | errors.Error401 | 401 | application/json |
474
- | errors.Error403 | 403 | application/json |
475
- | errors.Error404 | 404 | application/json |
476
- | errors.Error405 | 405 | application/json |
477
- | errors.Error409 | 409 | application/json |
478
- | errors.HTTPValidationError | 422 | application/json |
479
- | errors.Error425 | 425 | application/json |
480
- | errors.Error429 | 429 | application/json |
481
- | errors.Error500 | 500 | application/json |
482
- | errors.Error502 | 502 | application/json |
483
- | errors.Error504 | 504 | application/json |
484
- | errors.SDKError | 4XX, 5XX | \*/\* |
485
-
486
- ## void
487
-
488
- Voids a previously authorized transaction. If the transaction was not yet successfully authorized, or was already captured, the void will not be processed. This operation releases the hold on the buyer's funds. Captured transactions can be refunded instead.
489
-
490
- ### Example Usage
491
-
492
- <!-- UsageSnippet language="typescript" operationID="void_transaction" method="post" path="/transactions/{transaction_id}/void" -->
493
- ```typescript
494
- import { Gr4vy, withToken } from "@gr4vy/sdk";
495
- import fs from "fs";
496
-
497
- const gr4vy = new Gr4vy({
498
- id: "example",
499
- server: "sandbox",
500
- merchantAccountId: "default",
501
- bearerAuth: withToken({
502
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
503
- }),
504
- });
505
-
506
- async function run() {
507
- const result = await gr4vy.transactions.void("7099948d-7286-47e4-aad8-b68f7eb44591");
508
-
509
- console.log(result);
510
- }
511
-
512
- run();
513
- ```
514
-
515
- ### Standalone function
516
-
517
- The standalone function version of this method:
518
-
519
- ```typescript
520
- import { Gr4vyCore } from "@gr4vy/sdk/core.js";
521
- import { transactionsVoid } from "@gr4vy/sdk/funcs/transactionsVoid.js";
522
-
523
- // Use `Gr4vyCore` for best tree-shaking performance.
524
- // You can create one instance of it to use across an application.
525
- const gr4vy = new Gr4vyCore({
526
- merchantAccountId: "<id>",
527
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
528
- });
529
-
530
- async function run() {
531
- const res = await transactionsVoid(gr4vy, "7099948d-7286-47e4-aad8-b68f7eb44591");
532
- if (res.ok) {
533
- const { value: result } = res;
534
- console.log(result);
535
- } else {
536
- console.log("transactionsVoid failed:", res.error);
537
- }
538
- }
539
-
540
- run();
541
- ```
542
-
543
- ### Parameters
544
-
545
- | Parameter | Type | Required | Description | Example |
546
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
547
- | `transactionId` | *string* | :heavy_check_mark: | The ID of the transaction | [object Object] |
548
- | `prefer` | *string*[] | :heavy_minus_sign: | The preferred resource type in the response. | [object Object] |
549
- | `merchantAccountId` | *string* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | |
550
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | |
551
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | |
552
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | |
553
-
554
- ### Response
555
-
556
- **Promise\<[operations.VoidTransactionResponseVoidTransaction](../../models/operations/voidtransactionresponsevoidtransaction.md)\>**
557
-
558
- ### Errors
559
-
560
- | Error Type | Status Code | Content Type |
561
- | -------------------------- | -------------------------- | -------------------------- |
562
- | errors.Error400 | 400 | application/json |
563
- | errors.Error401 | 401 | application/json |
564
- | errors.Error403 | 403 | application/json |
565
- | errors.Error404 | 404 | application/json |
566
- | errors.Error405 | 405 | application/json |
567
- | errors.Error409 | 409 | application/json |
568
- | errors.HTTPValidationError | 422 | application/json |
569
- | errors.Error425 | 425 | application/json |
570
- | errors.Error429 | 429 | application/json |
571
- | errors.Error500 | 500 | application/json |
572
- | errors.Error502 | 502 | application/json |
573
- | errors.Error504 | 504 | application/json |
574
- | errors.SDKError | 4XX, 5XX | \*/\* |
575
-
576
- ## cancel
577
-
578
- Cancels a pending transaction. If the transaction was successfully authorized, or was already captured, the cancel will not be processed.
579
-
580
- ### Example Usage
581
-
582
- <!-- UsageSnippet language="typescript" operationID="cancel_transaction" method="post" path="/transactions/{transaction_id}/cancel" -->
583
- ```typescript
584
- import { Gr4vy, withToken } from "@gr4vy/sdk";
585
- import fs from "fs";
586
-
587
- const gr4vy = new Gr4vy({
588
- id: "example",
589
- server: "sandbox",
590
- merchantAccountId: "default",
591
- bearerAuth: withToken({
592
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
593
- }),
594
- });
595
-
596
- async function run() {
597
- const result = await gr4vy.transactions.cancel("7099948d-7286-47e4-aad8-b68f7eb44591");
598
-
599
- console.log(result);
600
- }
601
-
602
- run();
603
- ```
604
-
605
- ### Standalone function
606
-
607
- The standalone function version of this method:
608
-
609
- ```typescript
610
- import { Gr4vyCore } from "@gr4vy/sdk/core.js";
611
- import { transactionsCancel } from "@gr4vy/sdk/funcs/transactionsCancel.js";
612
-
613
- // Use `Gr4vyCore` for best tree-shaking performance.
614
- // You can create one instance of it to use across an application.
615
- const gr4vy = new Gr4vyCore({
616
- merchantAccountId: "<id>",
617
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
618
- });
619
-
620
- async function run() {
621
- const res = await transactionsCancel(gr4vy, "7099948d-7286-47e4-aad8-b68f7eb44591");
622
- if (res.ok) {
623
- const { value: result } = res;
624
- console.log(result);
625
- } else {
626
- console.log("transactionsCancel failed:", res.error);
627
- }
628
- }
629
-
630
- run();
631
- ```
632
-
633
- ### Parameters
634
-
635
- | Parameter | Type | Required | Description | Example |
636
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
637
- | `transactionId` | *string* | :heavy_check_mark: | The ID of the transaction | [object Object] |
638
- | `merchantAccountId` | *string* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | |
639
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | |
640
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | |
641
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | |
642
-
643
- ### Response
644
-
645
- **Promise\<[components.TransactionCancel](../../models/components/transactioncancel.md)\>**
646
-
647
- ### Errors
648
-
649
- | Error Type | Status Code | Content Type |
650
- | -------------------------- | -------------------------- | -------------------------- |
651
- | errors.Error400 | 400 | application/json |
652
- | errors.Error401 | 401 | application/json |
653
- | errors.Error403 | 403 | application/json |
654
- | errors.Error404 | 404 | application/json |
655
- | errors.Error405 | 405 | application/json |
656
- | errors.Error409 | 409 | application/json |
657
- | errors.HTTPValidationError | 422 | application/json |
658
- | errors.Error425 | 425 | application/json |
659
- | errors.Error429 | 429 | application/json |
660
- | errors.Error500 | 500 | application/json |
661
- | errors.Error502 | 502 | application/json |
662
- | errors.Error504 | 504 | application/json |
663
- | errors.SDKError | 4XX, 5XX | \*/\* |
664
-
665
- ## sync
666
-
667
- Synchronizes the status of a transaction with the underlying payment service provider. This is useful for transactions in a pending state to check if they've been completed or failed. Only available for some payment service providers.
668
-
669
- ### Example Usage
670
-
671
- <!-- UsageSnippet language="typescript" operationID="sync_transaction" method="post" path="/transactions/{transaction_id}/sync" -->
672
- ```typescript
673
- import { Gr4vy, withToken } from "@gr4vy/sdk";
674
- import fs from "fs";
675
-
676
- const gr4vy = new Gr4vy({
677
- id: "example",
678
- server: "sandbox",
679
- merchantAccountId: "default",
680
- bearerAuth: withToken({
681
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
682
- }),
683
- });
684
-
685
- async function run() {
686
- const result = await gr4vy.transactions.sync("2ee546e0-3b11-478e-afec-fdb362611e22");
687
-
688
- console.log(result);
689
- }
690
-
691
- run();
692
- ```
693
-
694
- ### Standalone function
695
-
696
- The standalone function version of this method:
697
-
698
- ```typescript
699
- import { Gr4vyCore } from "@gr4vy/sdk/core.js";
700
- import { transactionsSync } from "@gr4vy/sdk/funcs/transactionsSync.js";
701
-
702
- // Use `Gr4vyCore` for best tree-shaking performance.
703
- // You can create one instance of it to use across an application.
704
- const gr4vy = new Gr4vyCore({
705
- merchantAccountId: "<id>",
706
- bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
707
- });
708
-
709
- async function run() {
710
- const res = await transactionsSync(gr4vy, "2ee546e0-3b11-478e-afec-fdb362611e22");
711
- if (res.ok) {
712
- const { value: result } = res;
713
- console.log(result);
714
- } else {
715
- console.log("transactionsSync failed:", res.error);
716
- }
717
- }
718
-
719
- run();
720
- ```
721
-
722
- ### Parameters
723
-
724
- | Parameter | Type | Required | Description |
725
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
726
- | `transactionId` | *string* | :heavy_check_mark: | N/A |
727
- | `merchantAccountId` | *string* | :heavy_minus_sign: | The ID of the merchant account to use for this request. |
728
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
729
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
730
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
731
-
732
- ### Response
733
-
734
- **Promise\<[components.TransactionOutput](../../models/components/transactionoutput.md)\>**
735
-
736
- ### Errors
737
-
738
- | Error Type | Status Code | Content Type |
739
- | -------------------------- | -------------------------- | -------------------------- |
740
- | errors.Error400 | 400 | application/json |
741
- | errors.Error401 | 401 | application/json |
742
- | errors.Error403 | 403 | application/json |
743
- | errors.Error404 | 404 | application/json |
744
- | errors.Error405 | 405 | application/json |
745
- | errors.Error409 | 409 | application/json |
746
- | errors.HTTPValidationError | 422 | application/json |
747
- | errors.Error425 | 425 | application/json |
748
- | errors.Error429 | 429 | application/json |
749
- | errors.Error500 | 500 | application/json |
750
- | errors.Error502 | 502 | application/json |
751
- | errors.Error504 | 504 | application/json |
752
- | errors.SDKError | 4XX, 5XX | \*/\* |