orb-billing 5.0.0 → 5.2.0

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 (96) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/core.d.ts +7 -4
  3. package/core.d.ts.map +1 -1
  4. package/core.js +16 -9
  5. package/core.js.map +1 -1
  6. package/core.mjs +16 -9
  7. package/core.mjs.map +1 -1
  8. package/index.d.mts +3 -0
  9. package/index.d.ts +3 -0
  10. package/index.d.ts.map +1 -1
  11. package/index.js +6 -2
  12. package/index.js.map +1 -1
  13. package/index.mjs +6 -2
  14. package/index.mjs.map +1 -1
  15. package/package.json +1 -1
  16. package/resource.d.ts +1 -1
  17. package/resource.d.ts.map +1 -1
  18. package/resource.js.map +1 -1
  19. package/resource.mjs.map +1 -1
  20. package/resources/credit-notes.d.ts +54 -0
  21. package/resources/credit-notes.d.ts.map +1 -1
  22. package/resources/credit-notes.js +25 -0
  23. package/resources/credit-notes.js.map +1 -1
  24. package/resources/credit-notes.mjs +25 -0
  25. package/resources/credit-notes.mjs.map +1 -1
  26. package/resources/customers/costs.d.ts +18 -18
  27. package/resources/customers/credits/ledger.d.ts +75 -29
  28. package/resources/customers/credits/ledger.d.ts.map +1 -1
  29. package/resources/customers/credits/ledger.js.map +1 -1
  30. package/resources/customers/credits/ledger.mjs.map +1 -1
  31. package/resources/customers/customers.d.ts +12 -4
  32. package/resources/customers/customers.d.ts.map +1 -1
  33. package/resources/dimensional-price-groups/dimensional-price-groups.d.ts +6 -2
  34. package/resources/dimensional-price-groups/dimensional-price-groups.d.ts.map +1 -1
  35. package/resources/events/backfills.d.ts +2 -2
  36. package/resources/events/events.d.ts +9 -3
  37. package/resources/events/events.d.ts.map +1 -1
  38. package/resources/invoice-line-items.d.ts +3 -0
  39. package/resources/invoice-line-items.d.ts.map +1 -1
  40. package/resources/invoices.d.ts +13 -4
  41. package/resources/invoices.d.ts.map +1 -1
  42. package/resources/invoices.js +1 -1
  43. package/resources/invoices.js.map +1 -1
  44. package/resources/invoices.mjs +1 -1
  45. package/resources/invoices.mjs.map +1 -1
  46. package/resources/items.d.ts +9 -3
  47. package/resources/items.d.ts.map +1 -1
  48. package/resources/metrics.d.ts +9 -3
  49. package/resources/metrics.d.ts.map +1 -1
  50. package/resources/plans/external-plan-id.d.ts +3 -1
  51. package/resources/plans/external-plan-id.d.ts.map +1 -1
  52. package/resources/plans/plans.d.ts +62 -4
  53. package/resources/plans/plans.d.ts.map +1 -1
  54. package/resources/plans/plans.js.map +1 -1
  55. package/resources/plans/plans.mjs.map +1 -1
  56. package/resources/prices/external-price-id.d.ts +3 -1
  57. package/resources/prices/external-price-id.d.ts.map +1 -1
  58. package/resources/prices/prices.d.ts +163 -49
  59. package/resources/prices/prices.d.ts.map +1 -1
  60. package/resources/prices/prices.js.map +1 -1
  61. package/resources/prices/prices.mjs.map +1 -1
  62. package/resources/shared.d.ts +768 -143
  63. package/resources/shared.d.ts.map +1 -1
  64. package/resources/shared.js.map +1 -1
  65. package/resources/shared.mjs.map +1 -1
  66. package/resources/subscription-changes.d.ts +6 -4
  67. package/resources/subscription-changes.d.ts.map +1 -1
  68. package/resources/subscriptions.d.ts +159 -59
  69. package/resources/subscriptions.d.ts.map +1 -1
  70. package/resources/subscriptions.js +1 -1
  71. package/resources/subscriptions.mjs +1 -1
  72. package/src/core.ts +17 -8
  73. package/src/index.ts +10 -0
  74. package/src/resource.ts +1 -1
  75. package/src/resources/credit-notes.ts +58 -0
  76. package/src/resources/customers/costs.ts +18 -18
  77. package/src/resources/customers/credits/ledger.ts +45 -31
  78. package/src/resources/customers/customers.ts +4 -4
  79. package/src/resources/dimensional-price-groups/dimensional-price-groups.ts +2 -2
  80. package/src/resources/events/backfills.ts +2 -2
  81. package/src/resources/events/events.ts +3 -3
  82. package/src/resources/invoice-line-items.ts +3 -0
  83. package/src/resources/invoices.ts +7 -4
  84. package/src/resources/items.ts +3 -3
  85. package/src/resources/metrics.ts +3 -3
  86. package/src/resources/plans/external-plan-id.ts +1 -1
  87. package/src/resources/plans/plans.ts +101 -33
  88. package/src/resources/prices/external-price-id.ts +1 -1
  89. package/src/resources/prices/prices.ts +69 -49
  90. package/src/resources/shared.ts +552 -143
  91. package/src/resources/subscription-changes.ts +4 -4
  92. package/src/resources/subscriptions.ts +59 -59
  93. package/src/version.ts +1 -1
  94. package/version.d.ts +1 -1
  95. package/version.js +1 -1
  96. package/version.mjs +1 -1
@@ -46,8 +46,8 @@ export class Ledger extends APIResource {
46
46
  * deductions take place from a non-expiring credit block.
47
47
  *
48
48
  * If there are multiple blocks with the same expiration date, Orb will deduct from
49
- * the block with the _lower cost basis_ first (e.g. trial credits with a $0 cost
50
- * basis before paid credits with a $5.00 cost basis).
49
+ * the block with the _lower cost basis_ first (e.g. trial credits with a \$0 cost
50
+ * basis before paid credits with a \$5.00 cost basis).
51
51
  *
52
52
  * It's also possible for a single usage event's deduction to _span_ credit blocks.
53
53
  * In this case, Orb will deduct from the next block, ending at the credit block
@@ -395,8 +395,8 @@ export class Ledger extends APIResource {
395
395
  * deductions take place from a non-expiring credit block.
396
396
  *
397
397
  * If there are multiple blocks with the same expiration date, Orb will deduct from
398
- * the block with the _lower cost basis_ first (e.g. trial credits with a $0 cost
399
- * basis before paid credits with a $5.00 cost basis).
398
+ * the block with the _lower cost basis_ first (e.g. trial credits with a \$0 cost
399
+ * basis before paid credits with a \$5.00 cost basis).
400
400
  *
401
401
  * It's also possible for a single usage event's deduction to _span_ credit blocks.
402
402
  * In this case, Orb will deduct from the next block, ending at the credit block
@@ -505,7 +505,7 @@ export interface AmendmentLedgerEntry {
505
505
  * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
506
506
  * `null`.
507
507
  */
508
- metadata: Record<string, string>;
508
+ metadata: { [key: string]: string };
509
509
 
510
510
  starting_balance: number;
511
511
  }
@@ -539,7 +539,7 @@ export interface CreditBlockExpiryLedgerEntry {
539
539
  * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
540
540
  * `null`.
541
541
  */
542
- metadata: Record<string, string>;
542
+ metadata: { [key: string]: string };
543
543
 
544
544
  starting_balance: number;
545
545
  }
@@ -573,7 +573,7 @@ export interface DecrementLedgerEntry {
573
573
  * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
574
574
  * `null`.
575
575
  */
576
- metadata: Record<string, string>;
576
+ metadata: { [key: string]: string };
577
577
 
578
578
  starting_balance: number;
579
579
 
@@ -613,7 +613,7 @@ export interface ExpirationChangeLedgerEntry {
613
613
  * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
614
614
  * `null`.
615
615
  */
616
- metadata: Record<string, string>;
616
+ metadata: { [key: string]: string };
617
617
 
618
618
  new_block_expiry_date: string | null;
619
619
 
@@ -649,7 +649,7 @@ export interface IncrementLedgerEntry {
649
649
  * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
650
650
  * `null`.
651
651
  */
652
- metadata: Record<string, string>;
652
+ metadata: { [key: string]: string };
653
653
 
654
654
  starting_balance: number;
655
655
 
@@ -688,7 +688,7 @@ export interface VoidInitiatedLedgerEntry {
688
688
  * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
689
689
  * `null`.
690
690
  */
691
- metadata: Record<string, string>;
691
+ metadata: { [key: string]: string };
692
692
 
693
693
  new_block_expiry_date: string;
694
694
 
@@ -728,7 +728,7 @@ export interface VoidLedgerEntry {
728
728
  * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
729
729
  * `null`.
730
730
  */
731
- metadata: Record<string, string>;
731
+ metadata: { [key: string]: string };
732
732
 
733
733
  starting_balance: number;
734
734
 
@@ -872,7 +872,7 @@ export declare namespace LedgerCreateEntryParams {
872
872
  * by setting the value to `null`, and the entire metadata mapping can be cleared
873
873
  * by setting `metadata` to `null`.
874
874
  */
875
- metadata?: Record<string, string | null> | null;
875
+ metadata?: { [key: string]: string | null } | null;
876
876
 
877
877
  /**
878
878
  * Can only be specified when entry_type=increment. How much, in the customer's
@@ -902,6 +902,13 @@ export declare namespace LedgerCreateEntryParams {
902
902
  */
903
903
  net_terms: number;
904
904
 
905
+ /**
906
+ * An ISO 8601 format date that denotes when this invoice should be dated in the
907
+ * customer's timezone. If not provided, the invoice date will default to the
908
+ * credit block's effective date.
909
+ */
910
+ invoice_date?: (string & {}) | (string & {}) | null;
911
+
905
912
  /**
906
913
  * An optional memo to display on the invoice.
907
914
  */
@@ -942,17 +949,12 @@ export declare namespace LedgerCreateEntryParams {
942
949
  * by setting the value to `null`, and the entire metadata mapping can be cleared
943
950
  * by setting `metadata` to `null`.
944
951
  */
945
- metadata?: Record<string, string | null> | null;
952
+ metadata?: { [key: string]: string | null } | null;
946
953
  }
947
954
 
948
955
  export interface AddExpirationChangeCreditLedgerEntryRequestParams {
949
956
  entry_type: 'expiration_change';
950
957
 
951
- /**
952
- * An ISO 8601 format date that identifies the origination credit block to expire
953
- */
954
- expiry_date: string | null;
955
-
956
958
  /**
957
959
  * A future date (specified in YYYY-MM-DD format) used for expiration change,
958
960
  * denoting when credits transferred (as part of a partial block expiration) should
@@ -985,12 +987,17 @@ export declare namespace LedgerCreateEntryParams {
985
987
  */
986
988
  description?: string | null;
987
989
 
990
+ /**
991
+ * An ISO 8601 format date that identifies the origination credit block to expire
992
+ */
993
+ expiry_date?: string | null;
994
+
988
995
  /**
989
996
  * User-specified key/value pairs for the resource. Individual keys can be removed
990
997
  * by setting the value to `null`, and the entire metadata mapping can be cleared
991
998
  * by setting `metadata` to `null`.
992
999
  */
993
- metadata?: Record<string, string | null> | null;
1000
+ metadata?: { [key: string]: string | null } | null;
994
1001
  }
995
1002
 
996
1003
  export interface AddVoidCreditLedgerEntryRequestParams {
@@ -1025,7 +1032,7 @@ export declare namespace LedgerCreateEntryParams {
1025
1032
  * by setting the value to `null`, and the entire metadata mapping can be cleared
1026
1033
  * by setting `metadata` to `null`.
1027
1034
  */
1028
- metadata?: Record<string, string | null> | null;
1035
+ metadata?: { [key: string]: string | null } | null;
1029
1036
 
1030
1037
  /**
1031
1038
  * Can only be specified when `entry_type=void`. The reason for the void.
@@ -1065,7 +1072,7 @@ export declare namespace LedgerCreateEntryParams {
1065
1072
  * by setting the value to `null`, and the entire metadata mapping can be cleared
1066
1073
  * by setting `metadata` to `null`.
1067
1074
  */
1068
- metadata?: Record<string, string | null> | null;
1075
+ metadata?: { [key: string]: string | null } | null;
1069
1076
  }
1070
1077
  }
1071
1078
 
@@ -1123,7 +1130,7 @@ export declare namespace LedgerCreateEntryByExternalIDParams {
1123
1130
  * by setting the value to `null`, and the entire metadata mapping can be cleared
1124
1131
  * by setting `metadata` to `null`.
1125
1132
  */
1126
- metadata?: Record<string, string | null> | null;
1133
+ metadata?: { [key: string]: string | null } | null;
1127
1134
 
1128
1135
  /**
1129
1136
  * Can only be specified when entry_type=increment. How much, in the customer's
@@ -1153,6 +1160,13 @@ export declare namespace LedgerCreateEntryByExternalIDParams {
1153
1160
  */
1154
1161
  net_terms: number;
1155
1162
 
1163
+ /**
1164
+ * An ISO 8601 format date that denotes when this invoice should be dated in the
1165
+ * customer's timezone. If not provided, the invoice date will default to the
1166
+ * credit block's effective date.
1167
+ */
1168
+ invoice_date?: (string & {}) | (string & {}) | null;
1169
+
1156
1170
  /**
1157
1171
  * An optional memo to display on the invoice.
1158
1172
  */
@@ -1193,17 +1207,12 @@ export declare namespace LedgerCreateEntryByExternalIDParams {
1193
1207
  * by setting the value to `null`, and the entire metadata mapping can be cleared
1194
1208
  * by setting `metadata` to `null`.
1195
1209
  */
1196
- metadata?: Record<string, string | null> | null;
1210
+ metadata?: { [key: string]: string | null } | null;
1197
1211
  }
1198
1212
 
1199
1213
  export interface AddExpirationChangeCreditLedgerEntryRequestParams {
1200
1214
  entry_type: 'expiration_change';
1201
1215
 
1202
- /**
1203
- * An ISO 8601 format date that identifies the origination credit block to expire
1204
- */
1205
- expiry_date: string | null;
1206
-
1207
1216
  /**
1208
1217
  * A future date (specified in YYYY-MM-DD format) used for expiration change,
1209
1218
  * denoting when credits transferred (as part of a partial block expiration) should
@@ -1236,12 +1245,17 @@ export declare namespace LedgerCreateEntryByExternalIDParams {
1236
1245
  */
1237
1246
  description?: string | null;
1238
1247
 
1248
+ /**
1249
+ * An ISO 8601 format date that identifies the origination credit block to expire
1250
+ */
1251
+ expiry_date?: string | null;
1252
+
1239
1253
  /**
1240
1254
  * User-specified key/value pairs for the resource. Individual keys can be removed
1241
1255
  * by setting the value to `null`, and the entire metadata mapping can be cleared
1242
1256
  * by setting `metadata` to `null`.
1243
1257
  */
1244
- metadata?: Record<string, string | null> | null;
1258
+ metadata?: { [key: string]: string | null } | null;
1245
1259
  }
1246
1260
 
1247
1261
  export interface AddVoidCreditLedgerEntryRequestParams {
@@ -1276,7 +1290,7 @@ export declare namespace LedgerCreateEntryByExternalIDParams {
1276
1290
  * by setting the value to `null`, and the entire metadata mapping can be cleared
1277
1291
  * by setting `metadata` to `null`.
1278
1292
  */
1279
- metadata?: Record<string, string | null> | null;
1293
+ metadata?: { [key: string]: string | null } | null;
1280
1294
 
1281
1295
  /**
1282
1296
  * Can only be specified when `entry_type=void`. The reason for the void.
@@ -1316,7 +1330,7 @@ export declare namespace LedgerCreateEntryByExternalIDParams {
1316
1330
  * by setting the value to `null`, and the entire metadata mapping can be cleared
1317
1331
  * by setting `metadata` to `null`.
1318
1332
  */
1319
- metadata?: Record<string, string | null> | null;
1333
+ metadata?: { [key: string]: string | null } | null;
1320
1334
  }
1321
1335
  }
1322
1336
 
@@ -273,7 +273,7 @@ export interface Customer {
273
273
  * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
274
274
  * `null`.
275
275
  */
276
- metadata: Record<string, string>;
276
+ metadata: { [key: string]: string };
277
277
 
278
278
  /**
279
279
  * The full name of the customer
@@ -546,7 +546,7 @@ export interface CustomerCreateParams {
546
546
  * by setting the value to `null`, and the entire metadata mapping can be cleared
547
547
  * by setting `metadata` to `null`.
548
548
  */
549
- metadata?: Record<string, string | null> | null;
549
+ metadata?: { [key: string]: string | null } | null;
550
550
 
551
551
  /**
552
552
  * This is used for creating charges or invoices in an external system via Orb.
@@ -731,7 +731,7 @@ export interface CustomerUpdateParams {
731
731
  * by setting the value to `null`, and the entire metadata mapping can be cleared
732
732
  * by setting `metadata` to `null`.
733
733
  */
734
- metadata?: Record<string, string | null> | null;
734
+ metadata?: { [key: string]: string | null } | null;
735
735
 
736
736
  /**
737
737
  * The full name of the customer
@@ -928,7 +928,7 @@ export interface CustomerUpdateByExternalIDParams {
928
928
  * by setting the value to `null`, and the entire metadata mapping can be cleared
929
929
  * by setting `metadata` to `null`.
930
930
  */
931
- metadata?: Record<string, string | null> | null;
931
+ metadata?: { [key: string]: string | null } | null;
932
932
 
933
933
  /**
934
934
  * The full name of the customer
@@ -94,7 +94,7 @@ export interface DimensionalPriceGroup {
94
94
  * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
95
95
  * `null`.
96
96
  */
97
- metadata: Record<string, string>;
97
+ metadata: { [key: string]: string };
98
98
 
99
99
  /**
100
100
  * The name of the dimensional price group
@@ -125,7 +125,7 @@ export interface DimensionalPriceGroupCreateParams {
125
125
  * by setting the value to `null`, and the entire metadata mapping can be cleared
126
126
  * by setting `metadata` to `null`.
127
127
  */
128
- metadata?: Record<string, string | null> | null;
128
+ metadata?: { [key: string]: string | null } | null;
129
129
  }
130
130
 
131
131
  export interface DimensionalPriceGroupListParams extends PageParams {}
@@ -384,14 +384,14 @@ export interface BackfillRevertResponse {
384
384
  export interface BackfillCreateParams {
385
385
  /**
386
386
  * The (exclusive) end of the usage timeframe affected by this backfill. By
387
- * default, Orb allows backfills up to 10 days in duration at a time. Reach out to
387
+ * default, Orb allows backfills up to 31 days in duration at a time. Reach out to
388
388
  * discuss extending this limit and your use case.
389
389
  */
390
390
  timeframe_end: string;
391
391
 
392
392
  /**
393
393
  * The (inclusive) start of the usage timeframe affected by this backfill. By
394
- * default, Orb allows backfills up to 10 days in duration at a time. Reach out to
394
+ * default, Orb allows backfills up to 31 days in duration at a time. Reach out to
395
395
  * discuss extending this limit and your use case.
396
396
  */
397
397
  timeframe_start: string;
@@ -451,7 +451,7 @@ export namespace EventSearchResponse {
451
451
  * A dictionary of custom properties. Values in this dictionary must be numeric,
452
452
  * boolean, or strings. Nested dictionaries are disallowed.
453
453
  */
454
- properties: Record<string, unknown>;
454
+ properties: { [key: string]: unknown };
455
455
 
456
456
  /**
457
457
  * An ISO 8601 format date with no timezone offset (i.e. UTC). This should
@@ -472,7 +472,7 @@ export interface EventUpdateParams {
472
472
  * A dictionary of custom properties. Values in this dictionary must be numeric,
473
473
  * boolean, or strings. Nested dictionaries are disallowed.
474
474
  */
475
- properties: Record<string, unknown>;
475
+ properties: { [key: string]: unknown };
476
476
 
477
477
  /**
478
478
  * An ISO 8601 format date with no timezone offset (i.e. UTC). This should
@@ -530,7 +530,7 @@ export namespace EventIngestParams {
530
530
  * A dictionary of custom properties. Values in this dictionary must be numeric,
531
531
  * boolean, or strings. Nested dictionaries are disallowed.
532
532
  */
533
- properties: Record<string, unknown>;
533
+ properties: { [key: string]: unknown };
534
534
 
535
535
  /**
536
536
  * An ISO 8601 format date with no timezone offset (i.e. UTC). This should
@@ -53,6 +53,9 @@ export interface InvoiceLineItemCreateResponse {
53
53
  */
54
54
  credits_applied: string;
55
55
 
56
+ /**
57
+ * @deprecated This field is deprecated in favor of `adjustments`
58
+ */
56
59
  discount: Shared.Discount | null;
57
60
 
58
61
  /**
@@ -131,7 +131,7 @@ export class Invoices extends APIResource {
131
131
  *
132
132
  * If the associated invoice has used the customer balance to change the amount
133
133
  * due, the customer balance operation will be reverted. For example, if the
134
- * invoice used $10 of customer balance, that amount will be added back to the
134
+ * invoice used \$10 of customer balance, that amount will be added back to the
135
135
  * customer balance upon voiding.
136
136
  *
137
137
  * If the invoice was used to purchase a credit block, but the invoice is not yet
@@ -358,7 +358,7 @@ export interface InvoiceFetchUpcomingResponse {
358
358
  * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
359
359
  * `null`.
360
360
  */
361
- metadata: Record<string, string>;
361
+ metadata: { [key: string]: string };
362
362
 
363
363
  minimum: Shared.Minimum | null;
364
364
 
@@ -575,6 +575,9 @@ export namespace InvoiceFetchUpcomingResponse {
575
575
  */
576
576
  credits_applied: string;
577
577
 
578
+ /**
579
+ * @deprecated This field is deprecated in favor of `adjustments`
580
+ */
578
581
  discount: Shared.Discount | null;
579
582
 
580
583
  /**
@@ -754,7 +757,7 @@ export interface InvoiceCreateParams {
754
757
  * by setting the value to `null`, and the entire metadata mapping can be cleared
755
758
  * by setting `metadata` to `null`.
756
759
  */
757
- metadata?: Record<string, string | null> | null;
760
+ metadata?: { [key: string]: string | null } | null;
758
761
 
759
762
  /**
760
763
  * When true, this invoice will be submitted for issuance upon creation. When
@@ -800,7 +803,7 @@ export interface InvoiceUpdateParams {
800
803
  * by setting the value to `null`, and the entire metadata mapping can be cleared
801
804
  * by setting `metadata` to `null`.
802
805
  */
803
- metadata?: Record<string, string | null> | null;
806
+ metadata?: { [key: string]: string | null } | null;
804
807
  }
805
808
 
806
809
  export interface InvoiceListParams extends PageParams {
@@ -71,7 +71,7 @@ export interface Item {
71
71
  * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
72
72
  * `null`.
73
73
  */
74
- metadata: Record<string, string>;
74
+ metadata: { [key: string]: string };
75
75
 
76
76
  name: string;
77
77
  }
@@ -102,7 +102,7 @@ export interface ItemCreateParams {
102
102
  * by setting the value to `null`, and the entire metadata mapping can be cleared
103
103
  * by setting `metadata` to `null`.
104
104
  */
105
- metadata?: Record<string, string | null> | null;
105
+ metadata?: { [key: string]: string | null } | null;
106
106
  }
107
107
 
108
108
  export interface ItemUpdateParams {
@@ -113,7 +113,7 @@ export interface ItemUpdateParams {
113
113
  * by setting the value to `null`, and the entire metadata mapping can be cleared
114
114
  * by setting `metadata` to `null`.
115
115
  */
116
- metadata?: Record<string, string | null> | null;
116
+ metadata?: { [key: string]: string | null } | null;
117
117
 
118
118
  name?: string | null;
119
119
  }
@@ -83,7 +83,7 @@ export interface BillableMetric {
83
83
  * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
84
84
  * `null`.
85
85
  */
86
- metadata: Record<string, string>;
86
+ metadata: { [key: string]: string };
87
87
 
88
88
  name: string;
89
89
 
@@ -116,7 +116,7 @@ export interface MetricCreateParams {
116
116
  * by setting the value to `null`, and the entire metadata mapping can be cleared
117
117
  * by setting `metadata` to `null`.
118
118
  */
119
- metadata?: Record<string, string | null> | null;
119
+ metadata?: { [key: string]: string | null } | null;
120
120
  }
121
121
 
122
122
  export interface MetricUpdateParams {
@@ -125,7 +125,7 @@ export interface MetricUpdateParams {
125
125
  * by setting the value to `null`, and the entire metadata mapping can be cleared
126
126
  * by setting `metadata` to `null`.
127
127
  */
128
- metadata?: Record<string, string | null> | null;
128
+ metadata?: { [key: string]: string | null } | null;
129
129
  }
130
130
 
131
131
  export interface MetricListParams extends PageParams {
@@ -55,7 +55,7 @@ export interface ExternalPlanIDUpdateParams {
55
55
  * by setting the value to `null`, and the entire metadata mapping can be cleared
56
56
  * by setting `metadata` to `null`.
57
57
  */
58
- metadata?: Record<string, string | null> | null;
58
+ metadata?: { [key: string]: string | null } | null;
59
59
  }
60
60
 
61
61
  export declare namespace ExternalPlanID {
@@ -152,7 +152,7 @@ export interface Plan {
152
152
  * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
153
153
  * `null`.
154
154
  */
155
- metadata: Record<string, string>;
155
+ metadata: { [key: string]: string };
156
156
 
157
157
  /**
158
158
  * @deprecated
@@ -265,36 +265,13 @@ export interface PlanCreateParams {
265
265
  * Prices for this plan. If the plan has phases, this includes prices across all
266
266
  * phases of the plan.
267
267
  */
268
- prices: Array<
269
- | Shared.NewPlanUnitPrice
270
- | Shared.NewPlanPackagePrice
271
- | Shared.NewPlanMatrixPrice
272
- | Shared.NewPlanTieredPrice
273
- | Shared.NewPlanTieredBPSPrice
274
- | Shared.NewPlanBPSPrice
275
- | Shared.NewPlanBulkBPSPrice
276
- | Shared.NewPlanBulkPrice
277
- | Shared.NewPlanThresholdTotalAmountPrice
278
- | Shared.NewPlanTieredPackagePrice
279
- | Shared.NewPlanTieredWithMinimumPrice
280
- | Shared.NewPlanUnitWithPercentPrice
281
- | Shared.NewPlanPackageWithAllocationPrice
282
- | Shared.NewPlanTierWithProrationPrice
283
- | Shared.NewPlanUnitWithProrationPrice
284
- | Shared.NewPlanGroupedAllocationPrice
285
- | Shared.NewPlanGroupedWithProratedMinimumPrice
286
- | Shared.NewPlanGroupedWithMeteredMinimumPrice
287
- | Shared.NewPlanMatrixWithDisplayNamePrice
288
- | Shared.NewPlanBulkWithProrationPrice
289
- | Shared.NewPlanGroupedTieredPackagePrice
290
- | Shared.NewPlanMaxGroupTieredPackagePrice
291
- | Shared.NewPlanScalableMatrixWithUnitPricingPrice
292
- | Shared.NewPlanScalableMatrixWithTieredPricingPrice
293
- | Shared.NewPlanCumulativeGroupedBulkPrice
294
- | Shared.NewPlanTieredPackageWithMinimumPrice
295
- | Shared.NewPlanMatrixWithAllocationPrice
296
- | Shared.NewPlanGroupedTieredPrice
297
- >;
268
+ prices: Array<PlanCreateParams.Price>;
269
+
270
+ /**
271
+ * Adjustments for this plan. If the plan has phases, this includes adjustments
272
+ * across all phases of the plan.
273
+ */
274
+ adjustments?: Array<PlanCreateParams.Adjustment> | null;
298
275
 
299
276
  /**
300
277
  * Free-form text which is available on the invoice PDF and the Orb invoice portal.
@@ -308,7 +285,7 @@ export interface PlanCreateParams {
308
285
  * by setting the value to `null`, and the entire metadata mapping can be cleared
309
286
  * by setting `metadata` to `null`.
310
287
  */
311
- metadata?: Record<string, string | null> | null;
288
+ metadata?: { [key: string]: string | null } | null;
312
289
 
313
290
  /**
314
291
  * The net terms determines the difference between the invoice date and the issue
@@ -317,6 +294,12 @@ export interface PlanCreateParams {
317
294
  */
318
295
  net_terms?: number | null;
319
296
 
297
+ /**
298
+ * Configuration of pre-defined phases, each with their own prices and adjustments.
299
+ * Leave unspecified for plans with a single phase.
300
+ */
301
+ plan_phases?: Array<PlanCreateParams.PlanPhase> | null;
302
+
320
303
  /**
321
304
  * The status of the plan to create (either active or draft). If not specified,
322
305
  * this defaults to active.
@@ -324,6 +307,91 @@ export interface PlanCreateParams {
324
307
  status?: 'active' | 'draft';
325
308
  }
326
309
 
310
+ export namespace PlanCreateParams {
311
+ export interface Price {
312
+ /**
313
+ * The allocation price to add to the plan.
314
+ */
315
+ allocation_price?: Shared.NewAllocationPrice | null;
316
+
317
+ /**
318
+ * The phase to add this price to.
319
+ */
320
+ plan_phase_order?: number | null;
321
+
322
+ /**
323
+ * The price to add to the plan
324
+ */
325
+ price?:
326
+ | Shared.NewPlanUnitPrice
327
+ | Shared.NewPlanPackagePrice
328
+ | Shared.NewPlanMatrixPrice
329
+ | Shared.NewPlanTieredPrice
330
+ | Shared.NewPlanTieredBPSPrice
331
+ | Shared.NewPlanBPSPrice
332
+ | Shared.NewPlanBulkBPSPrice
333
+ | Shared.NewPlanBulkPrice
334
+ | Shared.NewPlanThresholdTotalAmountPrice
335
+ | Shared.NewPlanTieredPackagePrice
336
+ | Shared.NewPlanTieredWithMinimumPrice
337
+ | Shared.NewPlanUnitWithPercentPrice
338
+ | Shared.NewPlanPackageWithAllocationPrice
339
+ | Shared.NewPlanTierWithProrationPrice
340
+ | Shared.NewPlanUnitWithProrationPrice
341
+ | Shared.NewPlanGroupedAllocationPrice
342
+ | Shared.NewPlanGroupedWithProratedMinimumPrice
343
+ | Shared.NewPlanGroupedWithMeteredMinimumPrice
344
+ | Shared.NewPlanMatrixWithDisplayNamePrice
345
+ | Shared.NewPlanBulkWithProrationPrice
346
+ | Shared.NewPlanGroupedTieredPackagePrice
347
+ | Shared.NewPlanMaxGroupTieredPackagePrice
348
+ | Shared.NewPlanScalableMatrixWithUnitPricingPrice
349
+ | Shared.NewPlanScalableMatrixWithTieredPricingPrice
350
+ | Shared.NewPlanCumulativeGroupedBulkPrice
351
+ | Shared.NewPlanTieredPackageWithMinimumPrice
352
+ | Shared.NewPlanMatrixWithAllocationPrice
353
+ | Shared.NewPlanGroupedTieredPrice
354
+ | null;
355
+ }
356
+
357
+ export interface Adjustment {
358
+ /**
359
+ * The definition of a new adjustment to create and add to the plan.
360
+ */
361
+ adjustment:
362
+ | Shared.NewPercentageDiscount
363
+ | Shared.NewUsageDiscount
364
+ | Shared.NewAmountDiscount
365
+ | Shared.NewMinimum
366
+ | Shared.NewMaximum;
367
+
368
+ /**
369
+ * The phase to add this adjustment to.
370
+ */
371
+ plan_phase_order?: number | null;
372
+ }
373
+
374
+ export interface PlanPhase {
375
+ /**
376
+ * Determines the ordering of the phase in a plan's lifecycle. 1 = first phase.
377
+ */
378
+ order: number;
379
+
380
+ /**
381
+ * Align billing cycle day with phase start date.
382
+ */
383
+ align_billing_with_phase_start_date?: boolean | null;
384
+
385
+ /**
386
+ * How many terms of length `duration_unit` this phase is active for. If null, this
387
+ * phase is evergreen and active indefinitely
388
+ */
389
+ duration?: number | null;
390
+
391
+ duration_unit?: 'daily' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual' | null;
392
+ }
393
+ }
394
+
327
395
  export interface PlanUpdateParams {
328
396
  /**
329
397
  * An optional user-defined ID for this plan resource, used throughout the system
@@ -337,7 +405,7 @@ export interface PlanUpdateParams {
337
405
  * by setting the value to `null`, and the entire metadata mapping can be cleared
338
406
  * by setting `metadata` to `null`.
339
407
  */
340
- metadata?: Record<string, string | null> | null;
408
+ metadata?: { [key: string]: string | null } | null;
341
409
  }
342
410
 
343
411
  export interface PlanListParams extends PageParams {
@@ -34,7 +34,7 @@ export interface ExternalPriceIDUpdateParams {
34
34
  * by setting the value to `null`, and the entire metadata mapping can be cleared
35
35
  * by setting `metadata` to `null`.
36
36
  */
37
- metadata?: Record<string, string | null> | null;
37
+ metadata?: { [key: string]: string | null } | null;
38
38
  }
39
39
 
40
40
  export declare namespace ExternalPriceID {