orb-billing 2.1.2 → 2.3.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.
- package/CHANGELOG.md +55 -0
- package/README.md +29 -0
- package/index.d.mts +16 -5
- package/index.d.ts +16 -5
- package/index.d.ts.map +1 -1
- package/index.js +7 -6
- package/index.js.map +1 -1
- package/index.mjs +7 -6
- package/index.mjs.map +1 -1
- package/package.json +2 -3
- package/resources/coupons/coupons.d.ts +3 -22
- package/resources/coupons/coupons.d.ts.map +1 -1
- package/resources/coupons/coupons.js.map +1 -1
- package/resources/coupons/coupons.mjs.map +1 -1
- package/resources/customers/costs.d.ts +4 -4
- package/resources/customers/costs.d.ts.map +1 -1
- package/resources/customers/costs.js.map +1 -1
- package/resources/customers/costs.mjs.map +1 -1
- package/resources/customers/credits/credits.d.ts +6 -4
- package/resources/customers/credits/credits.d.ts.map +1 -1
- package/resources/customers/credits/credits.js.map +1 -1
- package/resources/customers/credits/credits.mjs.map +1 -1
- package/resources/customers/credits/ledger.d.ts +20 -10
- package/resources/customers/credits/ledger.d.ts.map +1 -1
- package/resources/customers/credits/ledger.js.map +1 -1
- package/resources/customers/credits/ledger.mjs.map +1 -1
- package/resources/customers/credits/top-ups.d.ts +38 -8
- package/resources/customers/credits/top-ups.d.ts.map +1 -1
- package/resources/customers/credits/top-ups.js.map +1 -1
- package/resources/customers/credits/top-ups.mjs.map +1 -1
- package/resources/customers/usage.d.ts +2 -2
- package/resources/customers/usage.d.ts.map +1 -1
- package/resources/customers/usage.js.map +1 -1
- package/resources/customers/usage.mjs.map +1 -1
- package/resources/index.d.ts +3 -3
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +6 -6
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -2
- package/resources/index.mjs.map +1 -1
- package/resources/invoices.d.ts +2 -0
- package/resources/invoices.d.ts.map +1 -1
- package/resources/invoices.js.map +1 -1
- package/resources/invoices.mjs.map +1 -1
- package/resources/plans/plans.d.ts +65 -0
- package/resources/plans/plans.d.ts.map +1 -1
- package/resources/plans/plans.js.map +1 -1
- package/resources/plans/plans.mjs.map +1 -1
- package/resources/prices/index.d.ts +1 -1
- package/resources/prices/index.d.ts.map +1 -1
- package/resources/prices/index.js +3 -3
- package/resources/prices/index.js.map +1 -1
- package/resources/prices/index.mjs +1 -1
- package/resources/prices/index.mjs.map +1 -1
- package/resources/prices/prices.d.ts +301 -2
- package/resources/prices/prices.d.ts.map +1 -1
- package/resources/prices/prices.js +26 -0
- package/resources/prices/prices.js.map +1 -1
- package/resources/prices/prices.mjs +26 -0
- package/resources/prices/prices.mjs.map +1 -1
- package/resources/shared.d.ts +5 -0
- package/resources/shared.d.ts.map +1 -1
- package/resources/subscriptions.d.ts +91 -17
- package/resources/subscriptions.d.ts.map +1 -1
- package/resources/subscriptions.js +6 -0
- package/resources/subscriptions.js.map +1 -1
- package/resources/subscriptions.mjs +6 -0
- package/resources/subscriptions.mjs.map +1 -1
- package/resources/webhooks.d.ts +24 -0
- package/resources/webhooks.d.ts.map +1 -0
- package/resources/webhooks.js +110 -0
- package/resources/webhooks.js.map +1 -0
- package/resources/webhooks.mjs +106 -0
- package/resources/webhooks.mjs.map +1 -0
- package/src/index.ts +20 -7
- package/src/resources/coupons/coupons.ts +3 -26
- package/src/resources/customers/costs.ts +6 -6
- package/src/resources/customers/credits/credits.ts +10 -6
- package/src/resources/customers/credits/ledger.ts +24 -12
- package/src/resources/customers/credits/top-ups.ts +46 -10
- package/src/resources/customers/usage.ts +2 -2
- package/src/resources/index.ts +12 -2
- package/src/resources/invoices.ts +4 -0
- package/src/resources/plans/plans.ts +78 -0
- package/src/resources/prices/index.ts +10 -1
- package/src/resources/prices/prices.ts +428 -0
- package/src/resources/shared.ts +8 -0
- package/src/resources/subscriptions.ts +122 -20
- package/src/resources/webhooks.ts +142 -0
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -43,6 +43,37 @@ export class Prices extends APIResource {
|
|
|
43
43
|
return this._client.getAPIList('/prices', PricesPage, { query, ...options });
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* This endpoint is used to evaluate the output of a price for a given customer and
|
|
48
|
+
* time range. It enables filtering and grouping the output using
|
|
49
|
+
* [computed properties](../guides/extensibility/advanced-metrics#computed-properties),
|
|
50
|
+
* supporting the following workflows:
|
|
51
|
+
*
|
|
52
|
+
* 1. Showing detailed usage and costs to the end customer.
|
|
53
|
+
* 2. Auditing subtotals on invoice line items.
|
|
54
|
+
*
|
|
55
|
+
* For these workflows, the expressiveness of computed properties in both the
|
|
56
|
+
* filters and grouping is critical. For example, if you'd like to show your
|
|
57
|
+
* customer their usage grouped by hour and another property, you can do so with
|
|
58
|
+
* the following `grouping_keys`:
|
|
59
|
+
* `["hour_floor_timestamp_millis(timestamp_millis)", "my_property"]`. If you'd
|
|
60
|
+
* like to examine a customer's usage for a specific property value, you can do so
|
|
61
|
+
* with the following `filter`:
|
|
62
|
+
* `my_property = 'foo' AND my_other_property = 'bar'`.
|
|
63
|
+
*
|
|
64
|
+
* By default, the start of the time range must be no more than 100 days ago and
|
|
65
|
+
* the length of the results must be no greater than 1000. Note that this is a POST
|
|
66
|
+
* endpoint rather than a GET endpoint because it employs a JSON body rather than
|
|
67
|
+
* query parameters.
|
|
68
|
+
*/
|
|
69
|
+
evaluate(
|
|
70
|
+
priceId: string,
|
|
71
|
+
body: PriceEvaluateParams,
|
|
72
|
+
options?: Core.RequestOptions,
|
|
73
|
+
): Core.APIPromise<PriceEvaluateResponse> {
|
|
74
|
+
return this._client.post(`/prices/${priceId}/evaluate`, { body, ...options });
|
|
75
|
+
}
|
|
76
|
+
|
|
46
77
|
/**
|
|
47
78
|
* This endpoint returns a price given an identifier.
|
|
48
79
|
*/
|
|
@@ -53,6 +84,23 @@ export class Prices extends APIResource {
|
|
|
53
84
|
|
|
54
85
|
export class PricesPage extends Page<Price> {}
|
|
55
86
|
|
|
87
|
+
export interface EvaluatePriceGroup {
|
|
88
|
+
/**
|
|
89
|
+
* The price's output for the group
|
|
90
|
+
*/
|
|
91
|
+
amount: string;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The values for the group in the order specified by `grouping_keys`
|
|
95
|
+
*/
|
|
96
|
+
grouping_values: Array<string | number | boolean>;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The price's usage quantity for the group
|
|
100
|
+
*/
|
|
101
|
+
quantity: number;
|
|
102
|
+
}
|
|
103
|
+
|
|
56
104
|
/**
|
|
57
105
|
* The Price resource represents a price that can be billed on a subscription,
|
|
58
106
|
* resulting in a charge on an invoice in the form of an invoice line item. Prices
|
|
@@ -297,7 +345,9 @@ export type Price =
|
|
|
297
345
|
| Price.BulkPrice
|
|
298
346
|
| Price.ThresholdTotalAmountPrice
|
|
299
347
|
| Price.TieredPackagePrice
|
|
348
|
+
| Price.GroupedTieredPrice
|
|
300
349
|
| Price.TieredWithMinimumPrice
|
|
350
|
+
| Price.TieredPackageWithMinimumPrice
|
|
301
351
|
| Price.PackageWithAllocationPrice
|
|
302
352
|
| Price.UnitWithPercentPrice
|
|
303
353
|
| Price.MatrixWithAllocationPrice;
|
|
@@ -312,6 +362,8 @@ export namespace Price {
|
|
|
312
362
|
|
|
313
363
|
created_at: string;
|
|
314
364
|
|
|
365
|
+
credit_allocation: UnitPrice.CreditAllocation | null;
|
|
366
|
+
|
|
315
367
|
currency: string;
|
|
316
368
|
|
|
317
369
|
discount: Shared.Discount | null;
|
|
@@ -346,6 +398,12 @@ export namespace Price {
|
|
|
346
398
|
id: string;
|
|
347
399
|
}
|
|
348
400
|
|
|
401
|
+
export interface CreditAllocation {
|
|
402
|
+
allows_rollover: boolean;
|
|
403
|
+
|
|
404
|
+
currency: string;
|
|
405
|
+
}
|
|
406
|
+
|
|
349
407
|
export interface Item {
|
|
350
408
|
id: string;
|
|
351
409
|
|
|
@@ -395,6 +453,8 @@ export namespace Price {
|
|
|
395
453
|
|
|
396
454
|
created_at: string;
|
|
397
455
|
|
|
456
|
+
credit_allocation: PackagePrice.CreditAllocation | null;
|
|
457
|
+
|
|
398
458
|
currency: string;
|
|
399
459
|
|
|
400
460
|
discount: Shared.Discount | null;
|
|
@@ -429,6 +489,12 @@ export namespace Price {
|
|
|
429
489
|
id: string;
|
|
430
490
|
}
|
|
431
491
|
|
|
492
|
+
export interface CreditAllocation {
|
|
493
|
+
allows_rollover: boolean;
|
|
494
|
+
|
|
495
|
+
currency: string;
|
|
496
|
+
}
|
|
497
|
+
|
|
432
498
|
export interface Item {
|
|
433
499
|
id: string;
|
|
434
500
|
|
|
@@ -484,6 +550,8 @@ export namespace Price {
|
|
|
484
550
|
|
|
485
551
|
created_at: string;
|
|
486
552
|
|
|
553
|
+
credit_allocation: MatrixPrice.CreditAllocation | null;
|
|
554
|
+
|
|
487
555
|
currency: string;
|
|
488
556
|
|
|
489
557
|
discount: Shared.Discount | null;
|
|
@@ -518,6 +586,12 @@ export namespace Price {
|
|
|
518
586
|
id: string;
|
|
519
587
|
}
|
|
520
588
|
|
|
589
|
+
export interface CreditAllocation {
|
|
590
|
+
allows_rollover: boolean;
|
|
591
|
+
|
|
592
|
+
currency: string;
|
|
593
|
+
}
|
|
594
|
+
|
|
521
595
|
export interface Item {
|
|
522
596
|
id: string;
|
|
523
597
|
|
|
@@ -593,6 +667,8 @@ export namespace Price {
|
|
|
593
667
|
|
|
594
668
|
created_at: string;
|
|
595
669
|
|
|
670
|
+
credit_allocation: TieredPrice.CreditAllocation | null;
|
|
671
|
+
|
|
596
672
|
currency: string;
|
|
597
673
|
|
|
598
674
|
discount: Shared.Discount | null;
|
|
@@ -627,6 +703,12 @@ export namespace Price {
|
|
|
627
703
|
id: string;
|
|
628
704
|
}
|
|
629
705
|
|
|
706
|
+
export interface CreditAllocation {
|
|
707
|
+
allows_rollover: boolean;
|
|
708
|
+
|
|
709
|
+
currency: string;
|
|
710
|
+
}
|
|
711
|
+
|
|
630
712
|
export interface Item {
|
|
631
713
|
id: string;
|
|
632
714
|
|
|
@@ -695,6 +777,8 @@ export namespace Price {
|
|
|
695
777
|
|
|
696
778
|
created_at: string;
|
|
697
779
|
|
|
780
|
+
credit_allocation: TieredBpsPrice.CreditAllocation | null;
|
|
781
|
+
|
|
698
782
|
currency: string;
|
|
699
783
|
|
|
700
784
|
discount: Shared.Discount | null;
|
|
@@ -729,6 +813,12 @@ export namespace Price {
|
|
|
729
813
|
id: string;
|
|
730
814
|
}
|
|
731
815
|
|
|
816
|
+
export interface CreditAllocation {
|
|
817
|
+
allows_rollover: boolean;
|
|
818
|
+
|
|
819
|
+
currency: string;
|
|
820
|
+
}
|
|
821
|
+
|
|
732
822
|
export interface Item {
|
|
733
823
|
id: string;
|
|
734
824
|
|
|
@@ -805,6 +895,8 @@ export namespace Price {
|
|
|
805
895
|
|
|
806
896
|
created_at: string;
|
|
807
897
|
|
|
898
|
+
credit_allocation: BpsPrice.CreditAllocation | null;
|
|
899
|
+
|
|
808
900
|
currency: string;
|
|
809
901
|
|
|
810
902
|
discount: Shared.Discount | null;
|
|
@@ -849,6 +941,12 @@ export namespace Price {
|
|
|
849
941
|
per_unit_maximum?: string | null;
|
|
850
942
|
}
|
|
851
943
|
|
|
944
|
+
export interface CreditAllocation {
|
|
945
|
+
allows_rollover: boolean;
|
|
946
|
+
|
|
947
|
+
currency: string;
|
|
948
|
+
}
|
|
949
|
+
|
|
852
950
|
export interface Item {
|
|
853
951
|
id: string;
|
|
854
952
|
|
|
@@ -893,6 +991,8 @@ export namespace Price {
|
|
|
893
991
|
|
|
894
992
|
created_at: string;
|
|
895
993
|
|
|
994
|
+
credit_allocation: BulkBpsPrice.CreditAllocation | null;
|
|
995
|
+
|
|
896
996
|
currency: string;
|
|
897
997
|
|
|
898
998
|
discount: Shared.Discount | null;
|
|
@@ -952,6 +1052,12 @@ export namespace Price {
|
|
|
952
1052
|
}
|
|
953
1053
|
}
|
|
954
1054
|
|
|
1055
|
+
export interface CreditAllocation {
|
|
1056
|
+
allows_rollover: boolean;
|
|
1057
|
+
|
|
1058
|
+
currency: string;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
955
1061
|
export interface Item {
|
|
956
1062
|
id: string;
|
|
957
1063
|
|
|
@@ -996,6 +1102,8 @@ export namespace Price {
|
|
|
996
1102
|
|
|
997
1103
|
created_at: string;
|
|
998
1104
|
|
|
1105
|
+
credit_allocation: BulkPrice.CreditAllocation | null;
|
|
1106
|
+
|
|
999
1107
|
currency: string;
|
|
1000
1108
|
|
|
1001
1109
|
discount: Shared.Discount | null;
|
|
@@ -1049,6 +1157,12 @@ export namespace Price {
|
|
|
1049
1157
|
}
|
|
1050
1158
|
}
|
|
1051
1159
|
|
|
1160
|
+
export interface CreditAllocation {
|
|
1161
|
+
allows_rollover: boolean;
|
|
1162
|
+
|
|
1163
|
+
currency: string;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1052
1166
|
export interface Item {
|
|
1053
1167
|
id: string;
|
|
1054
1168
|
|
|
@@ -1091,6 +1205,8 @@ export namespace Price {
|
|
|
1091
1205
|
|
|
1092
1206
|
created_at: string;
|
|
1093
1207
|
|
|
1208
|
+
credit_allocation: ThresholdTotalAmountPrice.CreditAllocation | null;
|
|
1209
|
+
|
|
1094
1210
|
currency: string;
|
|
1095
1211
|
|
|
1096
1212
|
discount: Shared.Discount | null;
|
|
@@ -1125,6 +1241,12 @@ export namespace Price {
|
|
|
1125
1241
|
id: string;
|
|
1126
1242
|
}
|
|
1127
1243
|
|
|
1244
|
+
export interface CreditAllocation {
|
|
1245
|
+
allows_rollover: boolean;
|
|
1246
|
+
|
|
1247
|
+
currency: string;
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1128
1250
|
export interface Item {
|
|
1129
1251
|
id: string;
|
|
1130
1252
|
|
|
@@ -1167,6 +1289,8 @@ export namespace Price {
|
|
|
1167
1289
|
|
|
1168
1290
|
created_at: string;
|
|
1169
1291
|
|
|
1292
|
+
credit_allocation: TieredPackagePrice.CreditAllocation | null;
|
|
1293
|
+
|
|
1170
1294
|
currency: string;
|
|
1171
1295
|
|
|
1172
1296
|
discount: Shared.Discount | null;
|
|
@@ -1201,6 +1325,96 @@ export namespace Price {
|
|
|
1201
1325
|
id: string;
|
|
1202
1326
|
}
|
|
1203
1327
|
|
|
1328
|
+
export interface CreditAllocation {
|
|
1329
|
+
allows_rollover: boolean;
|
|
1330
|
+
|
|
1331
|
+
currency: string;
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
export interface Item {
|
|
1335
|
+
id: string;
|
|
1336
|
+
|
|
1337
|
+
name: string;
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
export interface Maximum {
|
|
1341
|
+
/**
|
|
1342
|
+
* List of price_ids that this maximum amount applies to. For plan/plan phase
|
|
1343
|
+
* maximums, this can be a subset of prices.
|
|
1344
|
+
*/
|
|
1345
|
+
applies_to_price_ids: Array<string>;
|
|
1346
|
+
|
|
1347
|
+
/**
|
|
1348
|
+
* Maximum amount applied
|
|
1349
|
+
*/
|
|
1350
|
+
maximum_amount: string;
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
export interface Minimum {
|
|
1354
|
+
/**
|
|
1355
|
+
* List of price_ids that this minimum amount applies to. For plan/plan phase
|
|
1356
|
+
* minimums, this can be a subset of prices.
|
|
1357
|
+
*/
|
|
1358
|
+
applies_to_price_ids: Array<string>;
|
|
1359
|
+
|
|
1360
|
+
/**
|
|
1361
|
+
* Minimum amount applied
|
|
1362
|
+
*/
|
|
1363
|
+
minimum_amount: string;
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
export interface GroupedTieredPrice {
|
|
1368
|
+
id: string;
|
|
1369
|
+
|
|
1370
|
+
billable_metric: GroupedTieredPrice.BillableMetric | null;
|
|
1371
|
+
|
|
1372
|
+
cadence: 'one_time' | 'monthly' | 'quarterly' | 'annual';
|
|
1373
|
+
|
|
1374
|
+
created_at: string;
|
|
1375
|
+
|
|
1376
|
+
credit_allocation: GroupedTieredPrice.CreditAllocation | null;
|
|
1377
|
+
|
|
1378
|
+
currency: string;
|
|
1379
|
+
|
|
1380
|
+
discount: Shared.Discount | null;
|
|
1381
|
+
|
|
1382
|
+
external_price_id: string | null;
|
|
1383
|
+
|
|
1384
|
+
fixed_price_quantity: number | null;
|
|
1385
|
+
|
|
1386
|
+
grouped_tiered_config: Record<string, unknown>;
|
|
1387
|
+
|
|
1388
|
+
item: GroupedTieredPrice.Item;
|
|
1389
|
+
|
|
1390
|
+
maximum: GroupedTieredPrice.Maximum | null;
|
|
1391
|
+
|
|
1392
|
+
maximum_amount: string | null;
|
|
1393
|
+
|
|
1394
|
+
minimum: GroupedTieredPrice.Minimum | null;
|
|
1395
|
+
|
|
1396
|
+
minimum_amount: string | null;
|
|
1397
|
+
|
|
1398
|
+
model_type: 'grouped_tiered';
|
|
1399
|
+
|
|
1400
|
+
name: string;
|
|
1401
|
+
|
|
1402
|
+
plan_phase_order: number | null;
|
|
1403
|
+
|
|
1404
|
+
price_type: 'usage_price' | 'fixed_price';
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
export namespace GroupedTieredPrice {
|
|
1408
|
+
export interface BillableMetric {
|
|
1409
|
+
id: string;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
export interface CreditAllocation {
|
|
1413
|
+
allows_rollover: boolean;
|
|
1414
|
+
|
|
1415
|
+
currency: string;
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1204
1418
|
export interface Item {
|
|
1205
1419
|
id: string;
|
|
1206
1420
|
|
|
@@ -1243,6 +1457,8 @@ export namespace Price {
|
|
|
1243
1457
|
|
|
1244
1458
|
created_at: string;
|
|
1245
1459
|
|
|
1460
|
+
credit_allocation: TieredWithMinimumPrice.CreditAllocation | null;
|
|
1461
|
+
|
|
1246
1462
|
currency: string;
|
|
1247
1463
|
|
|
1248
1464
|
discount: Shared.Discount | null;
|
|
@@ -1277,6 +1493,96 @@ export namespace Price {
|
|
|
1277
1493
|
id: string;
|
|
1278
1494
|
}
|
|
1279
1495
|
|
|
1496
|
+
export interface CreditAllocation {
|
|
1497
|
+
allows_rollover: boolean;
|
|
1498
|
+
|
|
1499
|
+
currency: string;
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
export interface Item {
|
|
1503
|
+
id: string;
|
|
1504
|
+
|
|
1505
|
+
name: string;
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
export interface Maximum {
|
|
1509
|
+
/**
|
|
1510
|
+
* List of price_ids that this maximum amount applies to. For plan/plan phase
|
|
1511
|
+
* maximums, this can be a subset of prices.
|
|
1512
|
+
*/
|
|
1513
|
+
applies_to_price_ids: Array<string>;
|
|
1514
|
+
|
|
1515
|
+
/**
|
|
1516
|
+
* Maximum amount applied
|
|
1517
|
+
*/
|
|
1518
|
+
maximum_amount: string;
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
export interface Minimum {
|
|
1522
|
+
/**
|
|
1523
|
+
* List of price_ids that this minimum amount applies to. For plan/plan phase
|
|
1524
|
+
* minimums, this can be a subset of prices.
|
|
1525
|
+
*/
|
|
1526
|
+
applies_to_price_ids: Array<string>;
|
|
1527
|
+
|
|
1528
|
+
/**
|
|
1529
|
+
* Minimum amount applied
|
|
1530
|
+
*/
|
|
1531
|
+
minimum_amount: string;
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
export interface TieredPackageWithMinimumPrice {
|
|
1536
|
+
id: string;
|
|
1537
|
+
|
|
1538
|
+
billable_metric: TieredPackageWithMinimumPrice.BillableMetric | null;
|
|
1539
|
+
|
|
1540
|
+
cadence: 'one_time' | 'monthly' | 'quarterly' | 'annual';
|
|
1541
|
+
|
|
1542
|
+
created_at: string;
|
|
1543
|
+
|
|
1544
|
+
credit_allocation: TieredPackageWithMinimumPrice.CreditAllocation | null;
|
|
1545
|
+
|
|
1546
|
+
currency: string;
|
|
1547
|
+
|
|
1548
|
+
discount: Shared.Discount | null;
|
|
1549
|
+
|
|
1550
|
+
external_price_id: string | null;
|
|
1551
|
+
|
|
1552
|
+
fixed_price_quantity: number | null;
|
|
1553
|
+
|
|
1554
|
+
item: TieredPackageWithMinimumPrice.Item;
|
|
1555
|
+
|
|
1556
|
+
maximum: TieredPackageWithMinimumPrice.Maximum | null;
|
|
1557
|
+
|
|
1558
|
+
maximum_amount: string | null;
|
|
1559
|
+
|
|
1560
|
+
minimum: TieredPackageWithMinimumPrice.Minimum | null;
|
|
1561
|
+
|
|
1562
|
+
minimum_amount: string | null;
|
|
1563
|
+
|
|
1564
|
+
model_type: 'tiered_package_with_minimum';
|
|
1565
|
+
|
|
1566
|
+
name: string;
|
|
1567
|
+
|
|
1568
|
+
plan_phase_order: number | null;
|
|
1569
|
+
|
|
1570
|
+
price_type: 'usage_price' | 'fixed_price';
|
|
1571
|
+
|
|
1572
|
+
tiered_package_with_minimum_config: Record<string, unknown>;
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
export namespace TieredPackageWithMinimumPrice {
|
|
1576
|
+
export interface BillableMetric {
|
|
1577
|
+
id: string;
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
export interface CreditAllocation {
|
|
1581
|
+
allows_rollover: boolean;
|
|
1582
|
+
|
|
1583
|
+
currency: string;
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1280
1586
|
export interface Item {
|
|
1281
1587
|
id: string;
|
|
1282
1588
|
|
|
@@ -1319,6 +1625,8 @@ export namespace Price {
|
|
|
1319
1625
|
|
|
1320
1626
|
created_at: string;
|
|
1321
1627
|
|
|
1628
|
+
credit_allocation: PackageWithAllocationPrice.CreditAllocation | null;
|
|
1629
|
+
|
|
1322
1630
|
currency: string;
|
|
1323
1631
|
|
|
1324
1632
|
discount: Shared.Discount | null;
|
|
@@ -1353,6 +1661,12 @@ export namespace Price {
|
|
|
1353
1661
|
id: string;
|
|
1354
1662
|
}
|
|
1355
1663
|
|
|
1664
|
+
export interface CreditAllocation {
|
|
1665
|
+
allows_rollover: boolean;
|
|
1666
|
+
|
|
1667
|
+
currency: string;
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1356
1670
|
export interface Item {
|
|
1357
1671
|
id: string;
|
|
1358
1672
|
|
|
@@ -1395,6 +1709,8 @@ export namespace Price {
|
|
|
1395
1709
|
|
|
1396
1710
|
created_at: string;
|
|
1397
1711
|
|
|
1712
|
+
credit_allocation: UnitWithPercentPrice.CreditAllocation | null;
|
|
1713
|
+
|
|
1398
1714
|
currency: string;
|
|
1399
1715
|
|
|
1400
1716
|
discount: Shared.Discount | null;
|
|
@@ -1429,6 +1745,12 @@ export namespace Price {
|
|
|
1429
1745
|
id: string;
|
|
1430
1746
|
}
|
|
1431
1747
|
|
|
1748
|
+
export interface CreditAllocation {
|
|
1749
|
+
allows_rollover: boolean;
|
|
1750
|
+
|
|
1751
|
+
currency: string;
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1432
1754
|
export interface Item {
|
|
1433
1755
|
id: string;
|
|
1434
1756
|
|
|
@@ -1471,6 +1793,8 @@ export namespace Price {
|
|
|
1471
1793
|
|
|
1472
1794
|
created_at: string;
|
|
1473
1795
|
|
|
1796
|
+
credit_allocation: MatrixWithAllocationPrice.CreditAllocation | null;
|
|
1797
|
+
|
|
1474
1798
|
currency: string;
|
|
1475
1799
|
|
|
1476
1800
|
discount: Shared.Discount | null;
|
|
@@ -1505,6 +1829,12 @@ export namespace Price {
|
|
|
1505
1829
|
id: string;
|
|
1506
1830
|
}
|
|
1507
1831
|
|
|
1832
|
+
export interface CreditAllocation {
|
|
1833
|
+
allows_rollover: boolean;
|
|
1834
|
+
|
|
1835
|
+
currency: string;
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1508
1838
|
export interface Item {
|
|
1509
1839
|
id: string;
|
|
1510
1840
|
|
|
@@ -1577,6 +1907,10 @@ export namespace Price {
|
|
|
1577
1907
|
}
|
|
1578
1908
|
}
|
|
1579
1909
|
|
|
1910
|
+
export interface PriceEvaluateResponse {
|
|
1911
|
+
data: Array<EvaluatePriceGroup>;
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1580
1914
|
export type PriceCreateParams =
|
|
1581
1915
|
| PriceCreateParams.NewFloatingUnitPrice
|
|
1582
1916
|
| PriceCreateParams.NewFloatingPackagePrice
|
|
@@ -1589,6 +1923,7 @@ export type PriceCreateParams =
|
|
|
1589
1923
|
| PriceCreateParams.NewFloatingBulkPrice
|
|
1590
1924
|
| PriceCreateParams.NewFloatingThresholdTotalAmountPrice
|
|
1591
1925
|
| PriceCreateParams.NewFloatingTieredPackagePrice
|
|
1926
|
+
| PriceCreateParams.NewFloatingGroupedTieredPrice
|
|
1592
1927
|
| PriceCreateParams.NewFloatingTieredWithMinimumPrice
|
|
1593
1928
|
| PriceCreateParams.NewFloatingPackageWithAllocationPrice
|
|
1594
1929
|
| PriceCreateParams.NewFloatingTieredPackageWithMinimumPrice
|
|
@@ -2416,6 +2751,60 @@ export namespace PriceCreateParams {
|
|
|
2416
2751
|
invoice_grouping_key?: string | null;
|
|
2417
2752
|
}
|
|
2418
2753
|
|
|
2754
|
+
export interface NewFloatingGroupedTieredPrice {
|
|
2755
|
+
/**
|
|
2756
|
+
* The cadence to bill for this price on.
|
|
2757
|
+
*/
|
|
2758
|
+
cadence: 'annual' | 'monthly' | 'quarterly' | 'one_time';
|
|
2759
|
+
|
|
2760
|
+
/**
|
|
2761
|
+
* An ISO 4217 currency string for which this price is billed in.
|
|
2762
|
+
*/
|
|
2763
|
+
currency: string;
|
|
2764
|
+
|
|
2765
|
+
grouped_tiered_config: Record<string, unknown>;
|
|
2766
|
+
|
|
2767
|
+
/**
|
|
2768
|
+
* The id of the item the plan will be associated with.
|
|
2769
|
+
*/
|
|
2770
|
+
item_id: string;
|
|
2771
|
+
|
|
2772
|
+
model_type: 'grouped_tiered';
|
|
2773
|
+
|
|
2774
|
+
/**
|
|
2775
|
+
* The name of the price.
|
|
2776
|
+
*/
|
|
2777
|
+
name: string;
|
|
2778
|
+
|
|
2779
|
+
/**
|
|
2780
|
+
* The id of the billable metric for the price. Only needed if the price is
|
|
2781
|
+
* usage-based.
|
|
2782
|
+
*/
|
|
2783
|
+
billable_metric_id?: string | null;
|
|
2784
|
+
|
|
2785
|
+
/**
|
|
2786
|
+
* If the Price represents a fixed cost, the price will be billed in-advance if
|
|
2787
|
+
* this is true, and in-arrears if this is false.
|
|
2788
|
+
*/
|
|
2789
|
+
billed_in_advance?: boolean | null;
|
|
2790
|
+
|
|
2791
|
+
/**
|
|
2792
|
+
* An alias for the price.
|
|
2793
|
+
*/
|
|
2794
|
+
external_price_id?: string | null;
|
|
2795
|
+
|
|
2796
|
+
/**
|
|
2797
|
+
* If the Price represents a fixed cost, this represents the quantity of units
|
|
2798
|
+
* applied.
|
|
2799
|
+
*/
|
|
2800
|
+
fixed_price_quantity?: number | null;
|
|
2801
|
+
|
|
2802
|
+
/**
|
|
2803
|
+
* The property used to group this price on an invoice
|
|
2804
|
+
*/
|
|
2805
|
+
invoice_grouping_key?: string | null;
|
|
2806
|
+
}
|
|
2807
|
+
|
|
2419
2808
|
export interface NewFloatingTieredWithMinimumPrice {
|
|
2420
2809
|
/**
|
|
2421
2810
|
* The cadence to bill for this price on.
|
|
@@ -2635,10 +3024,49 @@ export namespace PriceCreateParams {
|
|
|
2635
3024
|
|
|
2636
3025
|
export interface PriceListParams extends PageParams {}
|
|
2637
3026
|
|
|
3027
|
+
export interface PriceEvaluateParams {
|
|
3028
|
+
/**
|
|
3029
|
+
* The exclusive upper bound for event timestamps
|
|
3030
|
+
*/
|
|
3031
|
+
timeframe_end: string;
|
|
3032
|
+
|
|
3033
|
+
/**
|
|
3034
|
+
* The inclusive lower bound for event timestamps
|
|
3035
|
+
*/
|
|
3036
|
+
timeframe_start: string;
|
|
3037
|
+
|
|
3038
|
+
/**
|
|
3039
|
+
* The ID of the customer to which this evaluation is scoped.
|
|
3040
|
+
*/
|
|
3041
|
+
customer_id?: string | null;
|
|
3042
|
+
|
|
3043
|
+
/**
|
|
3044
|
+
* The external customer ID of the customer to which this evaluation is scoped.
|
|
3045
|
+
*/
|
|
3046
|
+
external_customer_id?: string | null;
|
|
3047
|
+
|
|
3048
|
+
/**
|
|
3049
|
+
* A boolean
|
|
3050
|
+
* [computed property](../guides/extensibility/advanced-metrics#computed-properties)
|
|
3051
|
+
* used to filter the underlying billable metric
|
|
3052
|
+
*/
|
|
3053
|
+
filter?: string | null;
|
|
3054
|
+
|
|
3055
|
+
/**
|
|
3056
|
+
* Properties (or
|
|
3057
|
+
* [computed properties](../guides/extensibility/advanced-metrics#computed-properties))
|
|
3058
|
+
* used to group the underlying billable metric
|
|
3059
|
+
*/
|
|
3060
|
+
grouping_keys?: Array<string>;
|
|
3061
|
+
}
|
|
3062
|
+
|
|
2638
3063
|
export namespace Prices {
|
|
3064
|
+
export import EvaluatePriceGroup = PricesAPI.EvaluatePriceGroup;
|
|
2639
3065
|
export import Price = PricesAPI.Price;
|
|
3066
|
+
export import PriceEvaluateResponse = PricesAPI.PriceEvaluateResponse;
|
|
2640
3067
|
export import PricesPage = PricesAPI.PricesPage;
|
|
2641
3068
|
export import PriceCreateParams = PricesAPI.PriceCreateParams;
|
|
2642
3069
|
export import PriceListParams = PricesAPI.PriceListParams;
|
|
3070
|
+
export import PriceEvaluateParams = PricesAPI.PriceEvaluateParams;
|
|
2643
3071
|
export import ExternalPriceID = ExternalPriceIDAPI.ExternalPriceID;
|
|
2644
3072
|
}
|
package/src/resources/shared.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
+
export type BillingCycleRelativeDate = 'start_of_term' | 'end_of_term';
|
|
4
|
+
|
|
3
5
|
export type Discount =
|
|
4
6
|
| Discount.PercentageDiscount
|
|
5
7
|
| Discount.TrialDiscount
|
|
@@ -82,3 +84,9 @@ export namespace Discount {
|
|
|
82
84
|
reason?: string | null;
|
|
83
85
|
}
|
|
84
86
|
}
|
|
87
|
+
|
|
88
|
+
export interface PaginationMetadata {
|
|
89
|
+
has_more: boolean;
|
|
90
|
+
|
|
91
|
+
next_cursor: string | null;
|
|
92
|
+
}
|