@gr4vy/sdk 1.1.28 → 1.1.30

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 (63) hide show
  1. package/FUNCTIONS.md +9 -9
  2. package/README.md +91 -61
  3. package/docs/sdks/all/README.md +9 -13
  4. package/docs/sdks/auditlogs/README.md +9 -13
  5. package/docs/sdks/balances/README.md +9 -13
  6. package/docs/sdks/buyers/README.md +45 -65
  7. package/docs/sdks/cardschemedefinitions/README.md +9 -13
  8. package/docs/sdks/checkoutsessions/README.md +36 -52
  9. package/docs/sdks/cryptogram/README.md +9 -13
  10. package/docs/sdks/digitalwallets/README.md +45 -65
  11. package/docs/sdks/domains/README.md +18 -26
  12. package/docs/sdks/events/README.md +9 -13
  13. package/docs/sdks/executions/README.md +27 -39
  14. package/docs/sdks/giftcards/README.md +36 -52
  15. package/docs/sdks/gr4vy/README.md +0 -83
  16. package/docs/sdks/gr4vygiftcards/README.md +9 -13
  17. package/docs/sdks/gr4vypaymentmethods/README.md +9 -13
  18. package/docs/sdks/gr4vyrefunds/README.md +27 -39
  19. package/docs/sdks/jobs/README.md +9 -13
  20. package/docs/sdks/merchantaccounts/README.md +36 -48
  21. package/docs/sdks/networktokens/README.md +45 -65
  22. package/docs/sdks/paymentlinks/README.md +36 -52
  23. package/docs/sdks/paymentmethods/README.md +36 -52
  24. package/docs/sdks/paymentoptions/README.md +9 -13
  25. package/docs/sdks/paymentservicedefinitions/README.md +27 -36
  26. package/docs/sdks/paymentservices/README.md +63 -91
  27. package/docs/sdks/paymentservicetokens/README.md +27 -39
  28. package/docs/sdks/payouts/README.md +27 -39
  29. package/docs/sdks/refunds/README.md +9 -13
  30. package/docs/sdks/reportexecutions/README.md +9 -13
  31. package/docs/sdks/reports/README.md +36 -52
  32. package/docs/sdks/sessions/README.md +27 -38
  33. package/docs/sdks/settlements/README.md +18 -26
  34. package/docs/sdks/shippingdetails/README.md +45 -65
  35. package/docs/sdks/transactions/README.md +63 -91
  36. package/examples/accountUpdaterJobsCreate.example.ts +37 -0
  37. package/examples/package-lock.json +2716 -0
  38. package/jsr.json +1 -1
  39. package/lib/config.d.ts +3 -3
  40. package/lib/config.js +3 -3
  41. package/models/operations/index.d.ts +0 -1
  42. package/models/operations/index.d.ts.map +1 -1
  43. package/models/operations/index.js +0 -1
  44. package/models/operations/index.js.map +1 -1
  45. package/package.json +1 -1
  46. package/sdk/sdk.d.ts +1 -5
  47. package/sdk/sdk.d.ts.map +1 -1
  48. package/sdk/sdk.js +0 -8
  49. package/sdk/sdk.js.map +1 -1
  50. package/src/lib/config.ts +3 -3
  51. package/src/models/operations/index.ts +0 -1
  52. package/src/sdk/sdk.ts +1 -17
  53. package/examples/browsePaymentMethodDefinitionsGet.example.ts +0 -27
  54. package/funcs/browsePaymentMethodDefinitionsGet.d.ts +0 -14
  55. package/funcs/browsePaymentMethodDefinitionsGet.d.ts.map +0 -1
  56. package/funcs/browsePaymentMethodDefinitionsGet.js +0 -130
  57. package/funcs/browsePaymentMethodDefinitionsGet.js.map +0 -1
  58. package/models/operations/browsepaymentmethoddefinitionsget.d.ts +0 -57
  59. package/models/operations/browsepaymentmethoddefinitionsget.d.ts.map +0 -1
  60. package/models/operations/browsepaymentmethoddefinitionsget.js +0 -96
  61. package/models/operations/browsepaymentmethoddefinitionsget.js.map +0 -1
  62. package/src/funcs/browsePaymentMethodDefinitionsGet.ts +0 -188
  63. package/src/models/operations/browsepaymentmethoddefinitionsget.ts +0 -149
package/FUNCTIONS.md CHANGED
@@ -20,27 +20,27 @@ specific category of applications.
20
20
 
21
21
  ```typescript
22
22
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
23
- import { withToken } from "@gr4vy/sdk/lib/auth.js";
24
- import { browsePaymentMethodDefinitionsGet } from "@gr4vy/sdk/funcs/browsePaymentMethodDefinitionsGet.js";
23
+ import { accountUpdaterJobsCreate } from "@gr4vy/sdk/funcs/accountUpdaterJobsCreate.js";
25
24
 
26
25
  // Use `Gr4vyCore` for best tree-shaking performance.
27
26
  // You can create one instance of it to use across an application.
28
27
  const gr4vy = new Gr4vyCore({
29
28
  merchantAccountId: "<id>",
30
- server: "sandbox",
31
- id: "example",
32
- bearerAuth: withToken({
33
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
34
- }),
29
+ bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
35
30
  });
36
31
 
37
32
  async function run() {
38
- const res = await browsePaymentMethodDefinitionsGet(gr4vy);
33
+ const res = await accountUpdaterJobsCreate(gr4vy, {
34
+ paymentMethodIds: [
35
+ "ef9496d8-53a5-4aad-8ca2-00eb68334389",
36
+ "f29e886e-93cc-4714-b4a3-12b7a718e595",
37
+ ],
38
+ });
39
39
  if (res.ok) {
40
40
  const { value: result } = res;
41
41
  console.log(result);
42
42
  } else {
43
- console.log("browsePaymentMethodDefinitionsGet failed:", res.error);
43
+ console.log("accountUpdaterJobsCreate failed:", res.error);
44
44
  }
45
45
  }
46
46
 
package/README.md CHANGED
@@ -315,9 +315,6 @@ try {
315
315
 
316
316
  * [list](docs/sdks/balances/README.md#list) - List gift card balances
317
317
 
318
- ### [Gr4vy SDK](docs/sdks/gr4vy/README.md)
319
-
320
- * [browsePaymentMethodDefinitionsGet](docs/sdks/gr4vy/README.md#browsepaymentmethoddefinitionsget) - Browse
321
318
 
322
319
  ### [merchantAccounts](docs/sdks/merchantaccounts/README.md)
323
320
 
@@ -453,13 +450,14 @@ try {
453
450
 
454
451
  ### Example
455
452
  ```typescript
456
- import { Gr4vy } from "@gr4vy/sdk";
453
+ import { Gr4vy, withToken } from "@gr4vy/sdk";
457
454
  import * as errors from "@gr4vy/sdk/models/errors";
455
+ import fs from "fs";
458
456
 
459
457
  const gr4vy = new Gr4vy({
460
- merchantAccountId: "<id>",
461
- server: "sandbox",
462
458
  id: "example",
459
+ server: "sandbox",
460
+ merchantAccountId: "default",
463
461
  bearerAuth: withToken({
464
462
  privateKey: fs.readFileSync("private_key.pem", "utf8"),
465
463
  }),
@@ -467,7 +465,12 @@ const gr4vy = new Gr4vy({
467
465
 
468
466
  async function run() {
469
467
  try {
470
- const result = await gr4vy.browsePaymentMethodDefinitionsGet();
468
+ const result = await gr4vy.accountUpdater.jobs.create({
469
+ paymentMethodIds: [
470
+ "ef9496d8-53a5-4aad-8ca2-00eb68334389",
471
+ "f29e886e-93cc-4714-b4a3-12b7a718e595",
472
+ ],
473
+ });
471
474
 
472
475
  console.log(result);
473
476
  } catch (error) {
@@ -479,8 +482,12 @@ async function run() {
479
482
  console.log(error.headers);
480
483
 
481
484
  // Depending on the method different errors may be thrown
482
- if (error instanceof errors.HTTPValidationError) {
483
- console.log(error.data$.detail); // ValidationError[]
485
+ if (error instanceof errors.Error400) {
486
+ console.log(error.data$.type); // string
487
+ console.log(error.data$.code); // string
488
+ console.log(error.data$.status); // number
489
+ console.log(error.data$.message); // string
490
+ console.log(error.data$.details); // ErrorDetail[]
484
491
  }
485
492
  }
486
493
  }
@@ -493,18 +500,18 @@ run();
493
500
  ### Error Classes
494
501
  **Primary errors:**
495
502
  * [`Gr4vyError`](./src/models/errors/gr4vyerror.ts): The base class for HTTP error responses.
496
- * [`Error400`](./src/models/errors/error400.ts): The request was invalid. Status code `400`. *
497
- * [`Error401`](./src/models/errors/error401.ts): The request was unauthorized. Status code `401`. *
498
- * [`Error403`](./src/models/errors/error403.ts): The credentials were invalid or the caller did not have permission to act on the resource. Status code `403`. *
499
- * [`Error404`](./src/models/errors/error404.ts): The resource was not found. Status code `404`. *
500
- * [`Error405`](./src/models/errors/error405.ts): The request method was not allowed. Status code `405`. *
501
- * [`Error409`](./src/models/errors/error409.ts): A duplicate record was found. Status code `409`. *
503
+ * [`Error400`](./src/models/errors/error400.ts): The request was invalid. Status code `400`.
504
+ * [`Error401`](./src/models/errors/error401.ts): The request was unauthorized. Status code `401`.
505
+ * [`Error403`](./src/models/errors/error403.ts): The credentials were invalid or the caller did not have permission to act on the resource. Status code `403`.
506
+ * [`Error404`](./src/models/errors/error404.ts): The resource was not found. Status code `404`.
507
+ * [`Error405`](./src/models/errors/error405.ts): The request method was not allowed. Status code `405`.
508
+ * [`Error409`](./src/models/errors/error409.ts): A duplicate record was found. Status code `409`.
509
+ * [`Error425`](./src/models/errors/error425.ts): The request was too early. Status code `425`.
510
+ * [`Error429`](./src/models/errors/error429.ts): Too many requests were made. Status code `429`.
511
+ * [`Error500`](./src/models/errors/error500.ts): The server encountered an error. Status code `500`.
512
+ * [`Error502`](./src/models/errors/error502.ts): The server encountered an error. Status code `502`.
513
+ * [`Error504`](./src/models/errors/error504.ts): The server encountered an error. Status code `504`.
502
514
  * [`HTTPValidationError`](./src/models/errors/httpvalidationerror.ts): Validation Error. Status code `422`. *
503
- * [`Error425`](./src/models/errors/error425.ts): The request was too early. Status code `425`. *
504
- * [`Error429`](./src/models/errors/error429.ts): Too many requests were made. Status code `429`. *
505
- * [`Error500`](./src/models/errors/error500.ts): The server encountered an error. Status code `500`. *
506
- * [`Error502`](./src/models/errors/error502.ts): The server encountered an error. Status code `502`. *
507
- * [`Error504`](./src/models/errors/error504.ts): The server encountered an error. Status code `504`. *
508
515
 
509
516
  <details><summary>Less common errors (6)</summary>
510
517
 
@@ -547,21 +554,25 @@ If the selected server has variables, you may override its default values throug
547
554
  #### Example
548
555
 
549
556
  ```typescript
550
- import { Gr4vy } from "@gr4vy/sdk";
557
+ import { Gr4vy, withToken } from "@gr4vy/sdk";
558
+ import fs from "fs";
551
559
 
552
560
  const gr4vy = new Gr4vy({
553
- server: "production",
554
- id: "<id>",
555
- merchantAccountId: "<id>",
556
- server: "sandbox",
557
561
  id: "example",
562
+ server: "sandbox",
563
+ merchantAccountId: "default",
558
564
  bearerAuth: withToken({
559
565
  privateKey: fs.readFileSync("private_key.pem", "utf8"),
560
566
  }),
561
567
  });
562
568
 
563
569
  async function run() {
564
- const result = await gr4vy.browsePaymentMethodDefinitionsGet();
570
+ const result = await gr4vy.accountUpdater.jobs.create({
571
+ paymentMethodIds: [
572
+ "ef9496d8-53a5-4aad-8ca2-00eb68334389",
573
+ "f29e886e-93cc-4714-b4a3-12b7a718e595",
574
+ ],
575
+ });
565
576
 
566
577
  console.log(result);
567
578
  }
@@ -574,20 +585,25 @@ run();
574
585
 
575
586
  The default server can also be overridden globally by passing a URL to the `serverURL: string` optional parameter when initializing the SDK client instance. For example:
576
587
  ```typescript
577
- import { Gr4vy } from "@gr4vy/sdk";
588
+ import { Gr4vy, withToken } from "@gr4vy/sdk";
589
+ import fs from "fs";
578
590
 
579
591
  const gr4vy = new Gr4vy({
580
- serverURL: "https://api.sandbox.example.gr4vy.app",
581
- merchantAccountId: "<id>",
582
- server: "sandbox",
583
592
  id: "example",
593
+ server: "sandbox",
594
+ merchantAccountId: "default",
584
595
  bearerAuth: withToken({
585
596
  privateKey: fs.readFileSync("private_key.pem", "utf8"),
586
597
  }),
587
598
  });
588
599
 
589
600
  async function run() {
590
- const result = await gr4vy.browsePaymentMethodDefinitionsGet();
601
+ const result = await gr4vy.accountUpdater.jobs.create({
602
+ paymentMethodIds: [
603
+ "ef9496d8-53a5-4aad-8ca2-00eb68334389",
604
+ "f29e886e-93cc-4714-b4a3-12b7a718e595",
605
+ ],
606
+ });
591
607
 
592
608
  console.log(result);
593
609
  }
@@ -659,19 +675,25 @@ This SDK supports the following security scheme globally:
659
675
 
660
676
  To authenticate with the API the `bearerAuth` parameter must be set when initializing the SDK client instance. For example:
661
677
  ```typescript
662
- import { Gr4vy } from "@gr4vy/sdk";
678
+ import { Gr4vy, withToken } from "@gr4vy/sdk";
679
+ import fs from "fs";
663
680
 
664
681
  const gr4vy = new Gr4vy({
665
- server: "sandbox",
666
682
  id: "example",
683
+ server: "sandbox",
684
+ merchantAccountId: "default",
667
685
  bearerAuth: withToken({
668
686
  privateKey: fs.readFileSync("private_key.pem", "utf8"),
669
687
  }),
670
- merchantAccountId: "<id>",
671
688
  });
672
689
 
673
690
  async function run() {
674
- const result = await gr4vy.browsePaymentMethodDefinitionsGet();
691
+ const result = await gr4vy.accountUpdater.jobs.create({
692
+ paymentMethodIds: [
693
+ "ef9496d8-53a5-4aad-8ca2-00eb68334389",
694
+ "f29e886e-93cc-4714-b4a3-12b7a718e595",
695
+ ],
696
+ });
675
697
 
676
698
  console.log(result);
677
699
  }
@@ -720,19 +742,25 @@ yarn add @gr4vy/sdk zod
720
742
  ### Example
721
743
 
722
744
  ```typescript
723
- import { Gr4vy } from "@gr4vy/sdk";
745
+ import { Gr4vy, withToken } from "@gr4vy/sdk";
746
+ import fs from "fs";
724
747
 
725
748
  const gr4vy = new Gr4vy({
726
- merchantAccountId: "<id>",
727
- server: "sandbox",
728
749
  id: "example",
750
+ server: "sandbox",
751
+ merchantAccountId: "default",
729
752
  bearerAuth: withToken({
730
753
  privateKey: fs.readFileSync("private_key.pem", "utf8"),
731
754
  }),
732
755
  });
733
756
 
734
757
  async function run() {
735
- const result = await gr4vy.browsePaymentMethodDefinitionsGet();
758
+ const result = await gr4vy.accountUpdater.jobs.create({
759
+ paymentMethodIds: [
760
+ "ef9496d8-53a5-4aad-8ca2-00eb68334389",
761
+ "f29e886e-93cc-4714-b4a3-12b7a718e595",
762
+ ],
763
+ });
736
764
 
737
765
  console.log(result);
738
766
  }
@@ -755,12 +783,13 @@ syntax.
755
783
  Here's an example of one such pagination call:
756
784
 
757
785
  ```typescript
758
- import { Gr4vy } from "@gr4vy/sdk";
786
+ import { Gr4vy, withToken } from "@gr4vy/sdk";
787
+ import fs from "fs";
759
788
 
760
789
  const gr4vy = new Gr4vy({
761
- merchantAccountId: "<id>",
762
- server: "sandbox",
763
790
  id: "example",
791
+ server: "sandbox",
792
+ merchantAccountId: "default",
764
793
  bearerAuth: withToken({
765
794
  privateKey: fs.readFileSync("private_key.pem", "utf8"),
766
795
  }),
@@ -786,19 +815,25 @@ Some of the endpoints in this SDK support retries. If you use the SDK without a
786
815
 
787
816
  To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
788
817
  ```typescript
789
- import { Gr4vy } from "@gr4vy/sdk";
818
+ import { Gr4vy, withToken } from "@gr4vy/sdk";
819
+ import fs from "fs";
790
820
 
791
821
  const gr4vy = new Gr4vy({
792
- merchantAccountId: "<id>",
793
- server: "sandbox",
794
822
  id: "example",
823
+ server: "sandbox",
824
+ merchantAccountId: "default",
795
825
  bearerAuth: withToken({
796
826
  privateKey: fs.readFileSync("private_key.pem", "utf8"),
797
827
  }),
798
828
  });
799
829
 
800
830
  async function run() {
801
- const result = await gr4vy.browsePaymentMethodDefinitionsGet({
831
+ const result = await gr4vy.accountUpdater.jobs.create({
832
+ paymentMethodIds: [
833
+ "ef9496d8-53a5-4aad-8ca2-00eb68334389",
834
+ "f29e886e-93cc-4714-b4a3-12b7a718e595",
835
+ ],
836
+ }, {
802
837
  retries: {
803
838
  strategy: "backoff",
804
839
  backoff: {
@@ -820,29 +855,25 @@ run();
820
855
 
821
856
  If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
822
857
  ```typescript
823
- import { Gr4vy } from "@gr4vy/sdk";
858
+ import { Gr4vy, withToken } from "@gr4vy/sdk";
859
+ import fs from "fs";
824
860
 
825
861
  const gr4vy = new Gr4vy({
826
- retryConfig: {
827
- strategy: "backoff",
828
- backoff: {
829
- initialInterval: 1,
830
- maxInterval: 50,
831
- exponent: 1.1,
832
- maxElapsedTime: 100,
833
- },
834
- retryConnectionErrors: false,
835
- },
836
- merchantAccountId: "<id>",
837
- server: "sandbox",
838
862
  id: "example",
863
+ server: "sandbox",
864
+ merchantAccountId: "default",
839
865
  bearerAuth: withToken({
840
866
  privateKey: fs.readFileSync("private_key.pem", "utf8"),
841
867
  }),
842
868
  });
843
869
 
844
870
  async function run() {
845
- const result = await gr4vy.browsePaymentMethodDefinitionsGet();
871
+ const result = await gr4vy.accountUpdater.jobs.create({
872
+ paymentMethodIds: [
873
+ "ef9496d8-53a5-4aad-8ca2-00eb68334389",
874
+ "f29e886e-93cc-4714-b4a3-12b7a718e595",
875
+ ],
876
+ });
846
877
 
847
878
  console.log(result);
848
879
  }
@@ -903,7 +934,6 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
903
934
 
904
935
  - [`accountUpdaterJobsCreate`](docs/sdks/jobs/README.md#create) - Create account updater job
905
936
  - [`auditLogsList`](docs/sdks/auditlogs/README.md#list) - List audit log entries
906
- - [`browsePaymentMethodDefinitionsGet`](docs/sdks/gr4vy/README.md#browsepaymentmethoddefinitionsget) - Browse
907
937
  - [`buyersCreate`](docs/sdks/buyers/README.md#create) - Add a buyer
908
938
  - [`buyersDelete`](docs/sdks/buyers/README.md#delete) - Delete a buyer
909
939
  - [`buyersGet`](docs/sdks/buyers/README.md#get) - Get a buyer
@@ -15,15 +15,16 @@ Create a refund for all instruments on a transaction.
15
15
 
16
16
  <!-- UsageSnippet language="typescript" operationID="create_full_transaction_refund" method="post" path="/transactions/{transaction_id}/refunds/all" -->
17
17
  ```typescript
18
- import { Gr4vy } from "@gr4vy/sdk";
18
+ import { Gr4vy, withToken } from "@gr4vy/sdk";
19
+ import fs from "fs";
19
20
 
20
21
  const gr4vy = new Gr4vy({
21
- merchantAccountId: "<id>",
22
- server: "sandbox",
23
- id: "example",
24
- bearerAuth: withToken({
25
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
26
- }),
22
+ id: "example",
23
+ server: "sandbox",
24
+ merchantAccountId: "default",
25
+ bearerAuth: withToken({
26
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
27
+ }),
27
28
  });
28
29
 
29
30
  async function run() {
@@ -41,18 +42,13 @@ The standalone function version of this method:
41
42
 
42
43
  ```typescript
43
44
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
44
- import { withToken } from "@gr4vy/sdk/lib/auth.js";
45
45
  import { transactionsRefundsAllCreate } from "@gr4vy/sdk/funcs/transactionsRefundsAllCreate.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
- server: "sandbox",
52
- id: "example",
53
- bearerAuth: withToken({
54
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
55
- }),
51
+ bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
56
52
  });
57
53
 
58
54
  async function run() {
@@ -15,15 +15,16 @@ Returns a list of activity by dashboard users.
15
15
 
16
16
  <!-- UsageSnippet language="typescript" operationID="list_audit_logs" method="get" path="/audit-logs" -->
17
17
  ```typescript
18
- import { Gr4vy } from "@gr4vy/sdk";
18
+ import { Gr4vy, withToken } from "@gr4vy/sdk";
19
+ import fs from "fs";
19
20
 
20
21
  const gr4vy = new Gr4vy({
21
- merchantAccountId: "<id>",
22
- server: "sandbox",
23
- id: "example",
24
- bearerAuth: withToken({
25
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
26
- }),
22
+ id: "example",
23
+ server: "sandbox",
24
+ merchantAccountId: "default",
25
+ bearerAuth: withToken({
26
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
27
+ }),
27
28
  });
28
29
 
29
30
  async function run() {
@@ -43,18 +44,13 @@ The standalone function version of this method:
43
44
 
44
45
  ```typescript
45
46
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
46
- import { withToken } from "@gr4vy/sdk/lib/auth.js";
47
47
  import { auditLogsList } from "@gr4vy/sdk/funcs/auditLogsList.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
- server: "sandbox",
54
- id: "example",
55
- bearerAuth: withToken({
56
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
57
- }),
53
+ bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
58
54
  });
59
55
 
60
56
  async function run() {
@@ -15,15 +15,16 @@ Fetch the balances for one or more gift cards.
15
15
 
16
16
  <!-- UsageSnippet language="typescript" operationID="list_gift_card_balances" method="post" path="/gift-cards/balances" -->
17
17
  ```typescript
18
- import { Gr4vy } from "@gr4vy/sdk";
18
+ import { Gr4vy, withToken } from "@gr4vy/sdk";
19
+ import fs from "fs";
19
20
 
20
21
  const gr4vy = new Gr4vy({
21
- merchantAccountId: "<id>",
22
- server: "sandbox",
23
- id: "example",
24
- bearerAuth: withToken({
25
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
26
- }),
22
+ id: "example",
23
+ server: "sandbox",
24
+ merchantAccountId: "default",
25
+ bearerAuth: withToken({
26
+ privateKey: fs.readFileSync("private_key.pem", "utf8"),
27
+ }),
27
28
  });
28
29
 
29
30
  async function run() {
@@ -54,18 +55,13 @@ The standalone function version of this method:
54
55
 
55
56
  ```typescript
56
57
  import { Gr4vyCore } from "@gr4vy/sdk/core.js";
57
- import { withToken } from "@gr4vy/sdk/lib/auth.js";
58
58
  import { giftCardsBalancesList } from "@gr4vy/sdk/funcs/giftCardsBalancesList.js";
59
59
 
60
60
  // Use `Gr4vyCore` for best tree-shaking performance.
61
61
  // You can create one instance of it to use across an application.
62
62
  const gr4vy = new Gr4vyCore({
63
63
  merchantAccountId: "<id>",
64
- server: "sandbox",
65
- id: "example",
66
- bearerAuth: withToken({
67
- privateKey: fs.readFileSync("private_key.pem", "utf8"),
68
- }),
64
+ bearerAuth: process.env["GR4VY_BEARER_AUTH"] ?? "",
69
65
  });
70
66
 
71
67
  async function run() {