orb-billing 5.15.0 → 5.17.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 (46) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/package.json +1 -1
  3. package/resources/beta/beta.d.ts +396 -2
  4. package/resources/beta/beta.d.ts.map +1 -1
  5. package/resources/beta/beta.js.map +1 -1
  6. package/resources/beta/beta.mjs.map +1 -1
  7. package/resources/beta/external-plan-id.d.ts +396 -2
  8. package/resources/beta/external-plan-id.d.ts.map +1 -1
  9. package/resources/invoice-line-items.d.ts +27 -5
  10. package/resources/invoice-line-items.d.ts.map +1 -1
  11. package/resources/invoice-line-items.js +11 -0
  12. package/resources/invoice-line-items.js.map +1 -1
  13. package/resources/invoice-line-items.mjs +11 -0
  14. package/resources/invoice-line-items.mjs.map +1 -1
  15. package/resources/items.d.ts +37 -0
  16. package/resources/items.d.ts.map +1 -1
  17. package/resources/items.js.map +1 -1
  18. package/resources/items.mjs.map +1 -1
  19. package/resources/plans/plans.d.ts +198 -1
  20. package/resources/plans/plans.d.ts.map +1 -1
  21. package/resources/plans/plans.js.map +1 -1
  22. package/resources/plans/plans.mjs.map +1 -1
  23. package/resources/prices/prices.d.ts +558 -3
  24. package/resources/prices/prices.d.ts.map +1 -1
  25. package/resources/prices/prices.js.map +1 -1
  26. package/resources/prices/prices.mjs.map +1 -1
  27. package/resources/shared.d.ts +280 -1
  28. package/resources/shared.d.ts.map +1 -1
  29. package/resources/shared.js.map +1 -1
  30. package/resources/shared.mjs.map +1 -1
  31. package/resources/subscriptions.d.ts +1104 -131
  32. package/resources/subscriptions.d.ts.map +1 -1
  33. package/resources/subscriptions.js.map +1 -1
  34. package/resources/subscriptions.mjs.map +1 -1
  35. package/src/resources/beta/beta.ts +468 -0
  36. package/src/resources/beta/external-plan-id.ts +468 -0
  37. package/src/resources/invoice-line-items.ts +29 -6
  38. package/src/resources/items.ts +38 -0
  39. package/src/resources/plans/plans.ts +234 -0
  40. package/src/resources/prices/prices.ts +688 -28
  41. package/src/resources/shared.ts +337 -1
  42. package/src/resources/subscriptions.ts +1250 -94
  43. package/src/version.ts +1 -1
  44. package/version.d.ts +1 -1
  45. package/version.js +1 -1
  46. package/version.mjs +1 -1
@@ -153,6 +153,8 @@ export namespace ExternalPlanIDCreatePlanVersionParams {
153
153
  | Shared.NewPlanScalableMatrixWithTieredPricingPrice
154
154
  | Shared.NewPlanCumulativeGroupedBulkPrice
155
155
  | Shared.NewPlanMinimumCompositePrice
156
+ | AddPrice.NewPlanPercentCompositePrice
157
+ | AddPrice.NewPlanEventOutputPrice
156
158
  | null;
157
159
  }
158
160
 
@@ -415,6 +417,238 @@ export namespace ExternalPlanIDCreatePlanVersionParams {
415
417
  per_unit_rate: string;
416
418
  }
417
419
  }
420
+
421
+ export interface NewPlanPercentCompositePrice {
422
+ /**
423
+ * The cadence to bill for this price on.
424
+ */
425
+ cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time' | 'custom';
426
+
427
+ /**
428
+ * The id of the item the price will be associated with.
429
+ */
430
+ item_id: string;
431
+
432
+ /**
433
+ * The pricing model type
434
+ */
435
+ model_type: 'percent';
436
+
437
+ /**
438
+ * The name of the price.
439
+ */
440
+ name: string;
441
+
442
+ /**
443
+ * Configuration for percent pricing
444
+ */
445
+ percent_config: NewPlanPercentCompositePrice.PercentConfig;
446
+
447
+ /**
448
+ * The id of the billable metric for the price. Only needed if the price is
449
+ * usage-based.
450
+ */
451
+ billable_metric_id?: string | null;
452
+
453
+ /**
454
+ * If the Price represents a fixed cost, the price will be billed in-advance if
455
+ * this is true, and in-arrears if this is false.
456
+ */
457
+ billed_in_advance?: boolean | null;
458
+
459
+ /**
460
+ * For custom cadence: specifies the duration of the billing period in days or
461
+ * months.
462
+ */
463
+ billing_cycle_configuration?: Shared.NewBillingCycleConfiguration | null;
464
+
465
+ /**
466
+ * The per unit conversion rate of the price currency to the invoicing currency.
467
+ */
468
+ conversion_rate?: number | null;
469
+
470
+ /**
471
+ * The configuration for the rate of the price currency to the invoicing currency.
472
+ */
473
+ conversion_rate_config?: Shared.UnitConversionRateConfig | Shared.TieredConversionRateConfig | null;
474
+
475
+ /**
476
+ * An ISO 4217 currency string, or custom pricing unit identifier, in which this
477
+ * price is billed.
478
+ */
479
+ currency?: string | null;
480
+
481
+ /**
482
+ * For dimensional price: specifies a price group and dimension values
483
+ */
484
+ dimensional_price_configuration?: Shared.NewDimensionalPriceConfiguration | null;
485
+
486
+ /**
487
+ * An alias for the price.
488
+ */
489
+ external_price_id?: string | null;
490
+
491
+ /**
492
+ * If the Price represents a fixed cost, this represents the quantity of units
493
+ * applied.
494
+ */
495
+ fixed_price_quantity?: number | null;
496
+
497
+ /**
498
+ * The property used to group this price on an invoice
499
+ */
500
+ invoice_grouping_key?: string | null;
501
+
502
+ /**
503
+ * Within each billing cycle, specifies the cadence at which invoices are produced.
504
+ * If unspecified, a single invoice is produced per billing cycle.
505
+ */
506
+ invoicing_cycle_configuration?: Shared.NewBillingCycleConfiguration | null;
507
+
508
+ /**
509
+ * User-specified key/value pairs for the resource. Individual keys can be removed
510
+ * by setting the value to `null`, and the entire metadata mapping can be cleared
511
+ * by setting `metadata` to `null`.
512
+ */
513
+ metadata?: { [key: string]: string | null } | null;
514
+
515
+ /**
516
+ * A transient ID that can be used to reference this price when adding adjustments
517
+ * in the same API call.
518
+ */
519
+ reference_id?: string | null;
520
+ }
521
+
522
+ export namespace NewPlanPercentCompositePrice {
523
+ /**
524
+ * Configuration for percent pricing
525
+ */
526
+ export interface PercentConfig {
527
+ /**
528
+ * What percent of the component subtotals to charge
529
+ */
530
+ percent: number;
531
+ }
532
+ }
533
+
534
+ export interface NewPlanEventOutputPrice {
535
+ /**
536
+ * The cadence to bill for this price on.
537
+ */
538
+ cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time' | 'custom';
539
+
540
+ /**
541
+ * Configuration for event_output pricing
542
+ */
543
+ event_output_config: NewPlanEventOutputPrice.EventOutputConfig;
544
+
545
+ /**
546
+ * The id of the item the price will be associated with.
547
+ */
548
+ item_id: string;
549
+
550
+ /**
551
+ * The pricing model type
552
+ */
553
+ model_type: 'event_output';
554
+
555
+ /**
556
+ * The name of the price.
557
+ */
558
+ name: string;
559
+
560
+ /**
561
+ * The id of the billable metric for the price. Only needed if the price is
562
+ * usage-based.
563
+ */
564
+ billable_metric_id?: string | null;
565
+
566
+ /**
567
+ * If the Price represents a fixed cost, the price will be billed in-advance if
568
+ * this is true, and in-arrears if this is false.
569
+ */
570
+ billed_in_advance?: boolean | null;
571
+
572
+ /**
573
+ * For custom cadence: specifies the duration of the billing period in days or
574
+ * months.
575
+ */
576
+ billing_cycle_configuration?: Shared.NewBillingCycleConfiguration | null;
577
+
578
+ /**
579
+ * The per unit conversion rate of the price currency to the invoicing currency.
580
+ */
581
+ conversion_rate?: number | null;
582
+
583
+ /**
584
+ * The configuration for the rate of the price currency to the invoicing currency.
585
+ */
586
+ conversion_rate_config?: Shared.UnitConversionRateConfig | Shared.TieredConversionRateConfig | null;
587
+
588
+ /**
589
+ * An ISO 4217 currency string, or custom pricing unit identifier, in which this
590
+ * price is billed.
591
+ */
592
+ currency?: string | null;
593
+
594
+ /**
595
+ * For dimensional price: specifies a price group and dimension values
596
+ */
597
+ dimensional_price_configuration?: Shared.NewDimensionalPriceConfiguration | null;
598
+
599
+ /**
600
+ * An alias for the price.
601
+ */
602
+ external_price_id?: string | null;
603
+
604
+ /**
605
+ * If the Price represents a fixed cost, this represents the quantity of units
606
+ * applied.
607
+ */
608
+ fixed_price_quantity?: number | null;
609
+
610
+ /**
611
+ * The property used to group this price on an invoice
612
+ */
613
+ invoice_grouping_key?: string | null;
614
+
615
+ /**
616
+ * Within each billing cycle, specifies the cadence at which invoices are produced.
617
+ * If unspecified, a single invoice is produced per billing cycle.
618
+ */
619
+ invoicing_cycle_configuration?: Shared.NewBillingCycleConfiguration | null;
620
+
621
+ /**
622
+ * User-specified key/value pairs for the resource. Individual keys can be removed
623
+ * by setting the value to `null`, and the entire metadata mapping can be cleared
624
+ * by setting `metadata` to `null`.
625
+ */
626
+ metadata?: { [key: string]: string | null } | null;
627
+
628
+ /**
629
+ * A transient ID that can be used to reference this price when adding adjustments
630
+ * in the same API call.
631
+ */
632
+ reference_id?: string | null;
633
+ }
634
+
635
+ export namespace NewPlanEventOutputPrice {
636
+ /**
637
+ * Configuration for event_output pricing
638
+ */
639
+ export interface EventOutputConfig {
640
+ /**
641
+ * The key in the event data to extract the unit rate from.
642
+ */
643
+ unit_rating_key: string;
644
+
645
+ /**
646
+ * An optional key in the event data to group by (e.g., event ID). All events will
647
+ * also be grouped by their unit rate.
648
+ */
649
+ grouping_key?: string | null;
650
+ }
651
+ }
418
652
  }
419
653
 
420
654
  export interface RemoveAdjustment {
@@ -510,6 +744,8 @@ export namespace ExternalPlanIDCreatePlanVersionParams {
510
744
  | Shared.NewPlanScalableMatrixWithTieredPricingPrice
511
745
  | Shared.NewPlanCumulativeGroupedBulkPrice
512
746
  | Shared.NewPlanMinimumCompositePrice
747
+ | ReplacePrice.NewPlanPercentCompositePrice
748
+ | ReplacePrice.NewPlanEventOutputPrice
513
749
  | null;
514
750
  }
515
751
 
@@ -772,6 +1008,238 @@ export namespace ExternalPlanIDCreatePlanVersionParams {
772
1008
  per_unit_rate: string;
773
1009
  }
774
1010
  }
1011
+
1012
+ export interface NewPlanPercentCompositePrice {
1013
+ /**
1014
+ * The cadence to bill for this price on.
1015
+ */
1016
+ cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time' | 'custom';
1017
+
1018
+ /**
1019
+ * The id of the item the price will be associated with.
1020
+ */
1021
+ item_id: string;
1022
+
1023
+ /**
1024
+ * The pricing model type
1025
+ */
1026
+ model_type: 'percent';
1027
+
1028
+ /**
1029
+ * The name of the price.
1030
+ */
1031
+ name: string;
1032
+
1033
+ /**
1034
+ * Configuration for percent pricing
1035
+ */
1036
+ percent_config: NewPlanPercentCompositePrice.PercentConfig;
1037
+
1038
+ /**
1039
+ * The id of the billable metric for the price. Only needed if the price is
1040
+ * usage-based.
1041
+ */
1042
+ billable_metric_id?: string | null;
1043
+
1044
+ /**
1045
+ * If the Price represents a fixed cost, the price will be billed in-advance if
1046
+ * this is true, and in-arrears if this is false.
1047
+ */
1048
+ billed_in_advance?: boolean | null;
1049
+
1050
+ /**
1051
+ * For custom cadence: specifies the duration of the billing period in days or
1052
+ * months.
1053
+ */
1054
+ billing_cycle_configuration?: Shared.NewBillingCycleConfiguration | null;
1055
+
1056
+ /**
1057
+ * The per unit conversion rate of the price currency to the invoicing currency.
1058
+ */
1059
+ conversion_rate?: number | null;
1060
+
1061
+ /**
1062
+ * The configuration for the rate of the price currency to the invoicing currency.
1063
+ */
1064
+ conversion_rate_config?: Shared.UnitConversionRateConfig | Shared.TieredConversionRateConfig | null;
1065
+
1066
+ /**
1067
+ * An ISO 4217 currency string, or custom pricing unit identifier, in which this
1068
+ * price is billed.
1069
+ */
1070
+ currency?: string | null;
1071
+
1072
+ /**
1073
+ * For dimensional price: specifies a price group and dimension values
1074
+ */
1075
+ dimensional_price_configuration?: Shared.NewDimensionalPriceConfiguration | null;
1076
+
1077
+ /**
1078
+ * An alias for the price.
1079
+ */
1080
+ external_price_id?: string | null;
1081
+
1082
+ /**
1083
+ * If the Price represents a fixed cost, this represents the quantity of units
1084
+ * applied.
1085
+ */
1086
+ fixed_price_quantity?: number | null;
1087
+
1088
+ /**
1089
+ * The property used to group this price on an invoice
1090
+ */
1091
+ invoice_grouping_key?: string | null;
1092
+
1093
+ /**
1094
+ * Within each billing cycle, specifies the cadence at which invoices are produced.
1095
+ * If unspecified, a single invoice is produced per billing cycle.
1096
+ */
1097
+ invoicing_cycle_configuration?: Shared.NewBillingCycleConfiguration | null;
1098
+
1099
+ /**
1100
+ * User-specified key/value pairs for the resource. Individual keys can be removed
1101
+ * by setting the value to `null`, and the entire metadata mapping can be cleared
1102
+ * by setting `metadata` to `null`.
1103
+ */
1104
+ metadata?: { [key: string]: string | null } | null;
1105
+
1106
+ /**
1107
+ * A transient ID that can be used to reference this price when adding adjustments
1108
+ * in the same API call.
1109
+ */
1110
+ reference_id?: string | null;
1111
+ }
1112
+
1113
+ export namespace NewPlanPercentCompositePrice {
1114
+ /**
1115
+ * Configuration for percent pricing
1116
+ */
1117
+ export interface PercentConfig {
1118
+ /**
1119
+ * What percent of the component subtotals to charge
1120
+ */
1121
+ percent: number;
1122
+ }
1123
+ }
1124
+
1125
+ export interface NewPlanEventOutputPrice {
1126
+ /**
1127
+ * The cadence to bill for this price on.
1128
+ */
1129
+ cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time' | 'custom';
1130
+
1131
+ /**
1132
+ * Configuration for event_output pricing
1133
+ */
1134
+ event_output_config: NewPlanEventOutputPrice.EventOutputConfig;
1135
+
1136
+ /**
1137
+ * The id of the item the price will be associated with.
1138
+ */
1139
+ item_id: string;
1140
+
1141
+ /**
1142
+ * The pricing model type
1143
+ */
1144
+ model_type: 'event_output';
1145
+
1146
+ /**
1147
+ * The name of the price.
1148
+ */
1149
+ name: string;
1150
+
1151
+ /**
1152
+ * The id of the billable metric for the price. Only needed if the price is
1153
+ * usage-based.
1154
+ */
1155
+ billable_metric_id?: string | null;
1156
+
1157
+ /**
1158
+ * If the Price represents a fixed cost, the price will be billed in-advance if
1159
+ * this is true, and in-arrears if this is false.
1160
+ */
1161
+ billed_in_advance?: boolean | null;
1162
+
1163
+ /**
1164
+ * For custom cadence: specifies the duration of the billing period in days or
1165
+ * months.
1166
+ */
1167
+ billing_cycle_configuration?: Shared.NewBillingCycleConfiguration | null;
1168
+
1169
+ /**
1170
+ * The per unit conversion rate of the price currency to the invoicing currency.
1171
+ */
1172
+ conversion_rate?: number | null;
1173
+
1174
+ /**
1175
+ * The configuration for the rate of the price currency to the invoicing currency.
1176
+ */
1177
+ conversion_rate_config?: Shared.UnitConversionRateConfig | Shared.TieredConversionRateConfig | null;
1178
+
1179
+ /**
1180
+ * An ISO 4217 currency string, or custom pricing unit identifier, in which this
1181
+ * price is billed.
1182
+ */
1183
+ currency?: string | null;
1184
+
1185
+ /**
1186
+ * For dimensional price: specifies a price group and dimension values
1187
+ */
1188
+ dimensional_price_configuration?: Shared.NewDimensionalPriceConfiguration | null;
1189
+
1190
+ /**
1191
+ * An alias for the price.
1192
+ */
1193
+ external_price_id?: string | null;
1194
+
1195
+ /**
1196
+ * If the Price represents a fixed cost, this represents the quantity of units
1197
+ * applied.
1198
+ */
1199
+ fixed_price_quantity?: number | null;
1200
+
1201
+ /**
1202
+ * The property used to group this price on an invoice
1203
+ */
1204
+ invoice_grouping_key?: string | null;
1205
+
1206
+ /**
1207
+ * Within each billing cycle, specifies the cadence at which invoices are produced.
1208
+ * If unspecified, a single invoice is produced per billing cycle.
1209
+ */
1210
+ invoicing_cycle_configuration?: Shared.NewBillingCycleConfiguration | null;
1211
+
1212
+ /**
1213
+ * User-specified key/value pairs for the resource. Individual keys can be removed
1214
+ * by setting the value to `null`, and the entire metadata mapping can be cleared
1215
+ * by setting `metadata` to `null`.
1216
+ */
1217
+ metadata?: { [key: string]: string | null } | null;
1218
+
1219
+ /**
1220
+ * A transient ID that can be used to reference this price when adding adjustments
1221
+ * in the same API call.
1222
+ */
1223
+ reference_id?: string | null;
1224
+ }
1225
+
1226
+ export namespace NewPlanEventOutputPrice {
1227
+ /**
1228
+ * Configuration for event_output pricing
1229
+ */
1230
+ export interface EventOutputConfig {
1231
+ /**
1232
+ * The key in the event data to extract the unit rate from.
1233
+ */
1234
+ unit_rating_key: string;
1235
+
1236
+ /**
1237
+ * An optional key in the event data to group by (e.g., event ID). All events will
1238
+ * also be grouped by their unit rate.
1239
+ */
1240
+ grouping_key?: string | null;
1241
+ }
1242
+ }
775
1243
  }
776
1244
  }
777
1245
 
@@ -8,6 +8,17 @@ export class InvoiceLineItems extends APIResource {
8
8
  /**
9
9
  * This creates a one-off fixed fee invoice line item on an Invoice. This can only
10
10
  * be done for invoices that are in a `draft` status.
11
+ *
12
+ * The behavior depends on which parameters are provided:
13
+ *
14
+ * - If `item_id` is provided without `name`: The item is looked up by ID, and the
15
+ * item's name is used for the line item.
16
+ * - If `name` is provided without `item_id`: An item with the given name is
17
+ * searched for in the account. If found, that item is used. If not found, a new
18
+ * item is created with that name. The new item's name is used for the line item.
19
+ * - If both `item_id` and `name` are provided: The item is looked up by ID for
20
+ * association, but the provided `name` is used for the line item (not the item's
21
+ * name).
11
22
  */
12
23
  create(
13
24
  body: InvoiceLineItemCreateParams,
@@ -168,12 +179,6 @@ export interface InvoiceLineItemCreateParams {
168
179
  */
169
180
  invoice_id: string;
170
181
 
171
- /**
172
- * The item name associated with this line item. If an item with the same name
173
- * exists in Orb, that item will be associated with the line item.
174
- */
175
- name: string;
176
-
177
182
  /**
178
183
  * The number of units on the line item
179
184
  */
@@ -183,6 +188,24 @@ export interface InvoiceLineItemCreateParams {
183
188
  * A date string to specify the line item's start date in the customer's timezone.
184
189
  */
185
190
  start_date: string;
191
+
192
+ /**
193
+ * The id of the item to associate with this line item. If provided without `name`,
194
+ * the item's name will be used for the price/line item. If provided with `name`,
195
+ * the item will be associated but `name` will be used for the line item. At least
196
+ * one of `name` or `item_id` must be provided.
197
+ */
198
+ item_id?: string | null;
199
+
200
+ /**
201
+ * The name to use for the line item. If `item_id` is not provided, Orb will search
202
+ * for an item with this name. If found, that item will be associated with the line
203
+ * item. If not found, a new item will be created with this name. If `item_id` is
204
+ * provided, this name will be used for the line item, but the item association
205
+ * will be based on `item_id`. At least one of `name` or `item_id` must be
206
+ * provided.
207
+ */
208
+ name?: string | null;
186
209
  }
187
210
 
188
211
  export declare namespace InvoiceLineItems {
@@ -59,10 +59,20 @@ export class ItemsPage extends Page<Item> {}
59
59
  * external sync behavior for invoices and tax calculation purposes.
60
60
  */
61
61
  export interface Item {
62
+ /**
63
+ * The Orb-assigned unique identifier for the item.
64
+ */
62
65
  id: string;
63
66
 
67
+ /**
68
+ * The time at which the item was created.
69
+ */
64
70
  created_at: string;
65
71
 
72
+ /**
73
+ * A list of external connections for this item, used to sync with external
74
+ * invoicing and tax systems.
75
+ */
66
76
  external_connections: Array<Item.ExternalConnection>;
67
77
 
68
78
  /**
@@ -73,11 +83,26 @@ export interface Item {
73
83
  */
74
84
  metadata: { [key: string]: string };
75
85
 
86
+ /**
87
+ * The name of the item.
88
+ */
76
89
  name: string;
90
+
91
+ /**
92
+ * The time at which the item was archived. If null, the item is not archived.
93
+ */
94
+ archived_at?: string | null;
77
95
  }
78
96
 
79
97
  export namespace Item {
98
+ /**
99
+ * Represents a connection between an Item and an external system for invoicing or
100
+ * tax calculation purposes.
101
+ */
80
102
  export interface ExternalConnection {
103
+ /**
104
+ * The name of the external system this item is connected to.
105
+ */
81
106
  external_connection_name:
82
107
  | 'stripe'
83
108
  | 'quickbooks'
@@ -88,6 +113,9 @@ export namespace Item {
88
113
  | 'anrok'
89
114
  | 'numeral';
90
115
 
116
+ /**
117
+ * The identifier of this item in the external system.
118
+ */
91
119
  external_entity_id: string;
92
120
  }
93
121
  }
@@ -120,7 +148,14 @@ export interface ItemUpdateParams {
120
148
  }
121
149
 
122
150
  export namespace ItemUpdateParams {
151
+ /**
152
+ * Represents a connection between an Item and an external system for invoicing or
153
+ * tax calculation purposes.
154
+ */
123
155
  export interface ExternalConnection {
156
+ /**
157
+ * The name of the external system this item is connected to.
158
+ */
124
159
  external_connection_name:
125
160
  | 'stripe'
126
161
  | 'quickbooks'
@@ -131,6 +166,9 @@ export namespace ItemUpdateParams {
131
166
  | 'anrok'
132
167
  | 'numeral';
133
168
 
169
+ /**
170
+ * The identifier of this item in the external system.
171
+ */
134
172
  external_entity_id: string;
135
173
  }
136
174
  }