orb-billing 4.20.1 → 4.23.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 (57) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/core.d.ts +3 -1
  3. package/core.d.ts.map +1 -1
  4. package/core.js +7 -5
  5. package/core.js.map +1 -1
  6. package/core.mjs +7 -5
  7. package/core.mjs.map +1 -1
  8. package/index.d.mts +4 -0
  9. package/index.d.ts +4 -0
  10. package/index.d.ts.map +1 -1
  11. package/index.js.map +1 -1
  12. package/index.mjs.map +1 -1
  13. package/package.json +1 -1
  14. package/resources/coupons/coupons.d.ts +2 -30
  15. package/resources/coupons/coupons.d.ts.map +1 -1
  16. package/resources/coupons/coupons.js.map +1 -1
  17. package/resources/coupons/coupons.mjs.map +1 -1
  18. package/resources/customers/costs.d.ts +0 -34
  19. package/resources/customers/costs.d.ts.map +1 -1
  20. package/resources/customers/costs.js.map +1 -1
  21. package/resources/customers/costs.mjs.map +1 -1
  22. package/resources/customers/customers.d.ts +10 -2
  23. package/resources/customers/customers.d.ts.map +1 -1
  24. package/resources/customers/customers.js.map +1 -1
  25. package/resources/customers/customers.mjs.map +1 -1
  26. package/resources/invoices.d.ts +10 -186
  27. package/resources/invoices.d.ts.map +1 -1
  28. package/resources/invoices.js.map +1 -1
  29. package/resources/invoices.mjs.map +1 -1
  30. package/resources/plans/plans.d.ts +95 -1
  31. package/resources/plans/plans.d.ts.map +1 -1
  32. package/resources/plans/plans.js.map +1 -1
  33. package/resources/plans/plans.mjs.map +1 -1
  34. package/resources/prices/prices.d.ts +169 -2
  35. package/resources/prices/prices.d.ts.map +1 -1
  36. package/resources/prices/prices.js.map +1 -1
  37. package/resources/prices/prices.mjs.map +1 -1
  38. package/resources/shared.d.ts +46 -45
  39. package/resources/shared.d.ts.map +1 -1
  40. package/resources/subscriptions.d.ts +5062 -981
  41. package/resources/subscriptions.d.ts.map +1 -1
  42. package/resources/subscriptions.js.map +1 -1
  43. package/resources/subscriptions.mjs.map +1 -1
  44. package/src/core.ts +12 -4
  45. package/src/index.ts +4 -0
  46. package/src/resources/coupons/coupons.ts +2 -38
  47. package/src/resources/customers/costs.ts +0 -34
  48. package/src/resources/customers/customers.ts +19 -4
  49. package/src/resources/invoices.ts +10 -246
  50. package/src/resources/plans/plans.ts +114 -0
  51. package/src/resources/prices/prices.ts +224 -0
  52. package/src/resources/shared.ts +57 -59
  53. package/src/resources/subscriptions.ts +6022 -1059
  54. package/src/version.ts +1 -1
  55. package/version.d.ts +1 -1
  56. package/version.js +1 -1
  57. package/version.mjs +1 -1
@@ -373,6 +373,7 @@ export type Price =
373
373
  | Price.UnitWithProrationPrice
374
374
  | Price.GroupedAllocationPrice
375
375
  | Price.GroupedWithProratedMinimumPrice
376
+ | Price.GroupedWithMeteredMinimumPrice
376
377
  | Price.BulkWithProrationPrice;
377
378
 
378
379
  export namespace Price {
@@ -2785,6 +2786,116 @@ export namespace Price {
2785
2786
  }
2786
2787
  }
2787
2788
 
2789
+ export interface GroupedWithMeteredMinimumPrice {
2790
+ id: string;
2791
+
2792
+ billable_metric: GroupedWithMeteredMinimumPrice.BillableMetric | null;
2793
+
2794
+ billing_cycle_configuration: GroupedWithMeteredMinimumPrice.BillingCycleConfiguration;
2795
+
2796
+ cadence: 'one_time' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual' | 'custom';
2797
+
2798
+ conversion_rate: number | null;
2799
+
2800
+ created_at: string;
2801
+
2802
+ credit_allocation: GroupedWithMeteredMinimumPrice.CreditAllocation | null;
2803
+
2804
+ currency: string;
2805
+
2806
+ discount: Shared.Discount | null;
2807
+
2808
+ external_price_id: string | null;
2809
+
2810
+ fixed_price_quantity: number | null;
2811
+
2812
+ grouped_with_metered_minimum_config: Record<string, unknown>;
2813
+
2814
+ invoicing_cycle_configuration: GroupedWithMeteredMinimumPrice.InvoicingCycleConfiguration | null;
2815
+
2816
+ item: GroupedWithMeteredMinimumPrice.Item;
2817
+
2818
+ maximum: GroupedWithMeteredMinimumPrice.Maximum | null;
2819
+
2820
+ maximum_amount: string | null;
2821
+
2822
+ /**
2823
+ * User specified key-value pairs for the resource. If not present, this defaults
2824
+ * to an empty dictionary. Individual keys can be removed by setting the value to
2825
+ * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
2826
+ * `null`.
2827
+ */
2828
+ metadata: Record<string, string>;
2829
+
2830
+ minimum: GroupedWithMeteredMinimumPrice.Minimum | null;
2831
+
2832
+ minimum_amount: string | null;
2833
+
2834
+ model_type: 'grouped_with_metered_minimum';
2835
+
2836
+ name: string;
2837
+
2838
+ plan_phase_order: number | null;
2839
+
2840
+ price_type: 'usage_price' | 'fixed_price';
2841
+ }
2842
+
2843
+ export namespace GroupedWithMeteredMinimumPrice {
2844
+ export interface BillableMetric {
2845
+ id: string;
2846
+ }
2847
+
2848
+ export interface BillingCycleConfiguration {
2849
+ duration: number;
2850
+
2851
+ duration_unit: 'day' | 'month';
2852
+ }
2853
+
2854
+ export interface CreditAllocation {
2855
+ allows_rollover: boolean;
2856
+
2857
+ currency: string;
2858
+ }
2859
+
2860
+ export interface InvoicingCycleConfiguration {
2861
+ duration: number;
2862
+
2863
+ duration_unit: 'day' | 'month';
2864
+ }
2865
+
2866
+ export interface Item {
2867
+ id: string;
2868
+
2869
+ name: string;
2870
+ }
2871
+
2872
+ export interface Maximum {
2873
+ /**
2874
+ * List of price_ids that this maximum amount applies to. For plan/plan phase
2875
+ * maximums, this can be a subset of prices.
2876
+ */
2877
+ applies_to_price_ids: Array<string>;
2878
+
2879
+ /**
2880
+ * Maximum amount applied
2881
+ */
2882
+ maximum_amount: string;
2883
+ }
2884
+
2885
+ export interface Minimum {
2886
+ /**
2887
+ * List of price_ids that this minimum amount applies to. For plan/plan phase
2888
+ * minimums, this can be a subset of prices.
2889
+ */
2890
+ applies_to_price_ids: Array<string>;
2891
+
2892
+ /**
2893
+ * Minimum amount applied
2894
+ */
2895
+ minimum_amount: string;
2896
+ }
2897
+ }
2898
+
2788
2899
  export interface BulkWithProrationPrice {
2789
2900
  id: string;
2790
2901
 
@@ -2921,6 +3032,7 @@ export type PriceCreateParams =
2921
3032
  | PriceCreateParams.NewFloatingUnitWithProrationPrice
2922
3033
  | PriceCreateParams.NewFloatingGroupedAllocationPrice
2923
3034
  | PriceCreateParams.NewFloatingGroupedWithProratedMinimumPrice
3035
+ | PriceCreateParams.NewFloatingGroupedWithMeteredMinimumPrice
2924
3036
  | PriceCreateParams.NewFloatingBulkWithProrationPrice;
2925
3037
 
2926
3038
  export namespace PriceCreateParams {
@@ -5373,6 +5485,118 @@ export namespace PriceCreateParams {
5373
5485
  }
5374
5486
  }
5375
5487
 
5488
+ export interface NewFloatingGroupedWithMeteredMinimumPrice {
5489
+ /**
5490
+ * The cadence to bill for this price on.
5491
+ */
5492
+ cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time' | 'custom';
5493
+
5494
+ /**
5495
+ * An ISO 4217 currency string for which this price is billed in.
5496
+ */
5497
+ currency: string;
5498
+
5499
+ grouped_with_metered_minimum_config: Record<string, unknown>;
5500
+
5501
+ /**
5502
+ * The id of the item the plan will be associated with.
5503
+ */
5504
+ item_id: string;
5505
+
5506
+ model_type: 'grouped_with_metered_minimum';
5507
+
5508
+ /**
5509
+ * The name of the price.
5510
+ */
5511
+ name: string;
5512
+
5513
+ /**
5514
+ * The id of the billable metric for the price. Only needed if the price is
5515
+ * usage-based.
5516
+ */
5517
+ billable_metric_id?: string | null;
5518
+
5519
+ /**
5520
+ * If the Price represents a fixed cost, the price will be billed in-advance if
5521
+ * this is true, and in-arrears if this is false.
5522
+ */
5523
+ billed_in_advance?: boolean | null;
5524
+
5525
+ /**
5526
+ * For custom cadence: specifies the duration of the billing period in days or
5527
+ * months.
5528
+ */
5529
+ billing_cycle_configuration?: PriceCreateParams.NewFloatingGroupedWithMeteredMinimumPrice.BillingCycleConfiguration | null;
5530
+
5531
+ /**
5532
+ * The per unit conversion rate of the price currency to the invoicing currency.
5533
+ */
5534
+ conversion_rate?: number | null;
5535
+
5536
+ /**
5537
+ * An alias for the price.
5538
+ */
5539
+ external_price_id?: string | null;
5540
+
5541
+ /**
5542
+ * If the Price represents a fixed cost, this represents the quantity of units
5543
+ * applied.
5544
+ */
5545
+ fixed_price_quantity?: number | null;
5546
+
5547
+ /**
5548
+ * The property used to group this price on an invoice
5549
+ */
5550
+ invoice_grouping_key?: string | null;
5551
+
5552
+ /**
5553
+ * Within each billing cycle, specifies the cadence at which invoices are produced.
5554
+ * If unspecified, a single invoice is produced per billing cycle.
5555
+ */
5556
+ invoicing_cycle_configuration?: PriceCreateParams.NewFloatingGroupedWithMeteredMinimumPrice.InvoicingCycleConfiguration | null;
5557
+
5558
+ /**
5559
+ * User-specified key/value pairs for the resource. Individual keys can be removed
5560
+ * by setting the value to `null`, and the entire metadata mapping can be cleared
5561
+ * by setting `metadata` to `null`.
5562
+ */
5563
+ metadata?: Record<string, string | null> | null;
5564
+ }
5565
+
5566
+ export namespace NewFloatingGroupedWithMeteredMinimumPrice {
5567
+ /**
5568
+ * For custom cadence: specifies the duration of the billing period in days or
5569
+ * months.
5570
+ */
5571
+ export interface BillingCycleConfiguration {
5572
+ /**
5573
+ * The duration of the billing period.
5574
+ */
5575
+ duration: number;
5576
+
5577
+ /**
5578
+ * The unit of billing period duration.
5579
+ */
5580
+ duration_unit: 'day' | 'month';
5581
+ }
5582
+
5583
+ /**
5584
+ * Within each billing cycle, specifies the cadence at which invoices are produced.
5585
+ * If unspecified, a single invoice is produced per billing cycle.
5586
+ */
5587
+ export interface InvoicingCycleConfiguration {
5588
+ /**
5589
+ * The duration of the billing period.
5590
+ */
5591
+ duration: number;
5592
+
5593
+ /**
5594
+ * The unit of billing period duration.
5595
+ */
5596
+ duration_unit: 'day' | 'month';
5597
+ }
5598
+ }
5599
+
5376
5600
  export interface NewFloatingBulkWithProrationPrice {
5377
5601
  bulk_with_proration_config: Record<string, unknown>;
5378
5602
 
@@ -1,54 +1,27 @@
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
-
5
- export type Discount =
6
- | Discount.PercentageDiscount
7
- | Discount.TrialDiscount
8
- | Discount.UsageDiscount
9
- | Discount.AmountDiscount;
10
-
11
- export namespace Discount {
12
- export interface PercentageDiscount {
13
- /**
14
- * List of price_ids that this discount applies to. For plan/plan phase discounts,
15
- * this can be a subset of prices.
16
- */
17
- applies_to_price_ids: Array<string>;
3
+ export interface AmountDiscount {
4
+ /**
5
+ * Only available if discount_type is `amount`.
6
+ */
7
+ amount_discount: string;
18
8
 
19
- discount_type: 'percentage';
9
+ /**
10
+ * List of price_ids that this discount applies to. For plan/plan phase discounts,
11
+ * this can be a subset of prices.
12
+ */
13
+ applies_to_price_ids: Array<string>;
20
14
 
21
- /**
22
- * Only available if discount_type is `percentage`. This is a number between 0
23
- * and 1.
24
- */
25
- percentage_discount: number;
26
-
27
- reason?: string | null;
28
- }
15
+ discount_type: 'amount';
29
16
 
30
- export interface TrialDiscount {
31
- /**
32
- * List of price_ids that this discount applies to. For plan/plan phase discounts,
33
- * this can be a subset of prices.
34
- */
35
- applies_to_price_ids: Array<string>;
36
-
37
- discount_type: 'trial';
17
+ reason?: string | null;
18
+ }
38
19
 
39
- reason?: string | null;
20
+ export type BillingCycleRelativeDate = 'start_of_term' | 'end_of_term';
40
21
 
41
- /**
42
- * Only available if discount_type is `trial`
43
- */
44
- trial_amount_discount?: string | null;
45
-
46
- /**
47
- * Only available if discount_type is `trial`
48
- */
49
- trial_percentage_discount?: number | null;
50
- }
22
+ export type Discount = PercentageDiscount | TrialDiscount | Discount.UsageDiscount | AmountDiscount;
51
23
 
24
+ export namespace Discount {
52
25
  export interface UsageDiscount {
53
26
  /**
54
27
  * List of price_ids that this discount applies to. For plan/plan phase discounts,
@@ -66,27 +39,52 @@ export namespace Discount {
66
39
 
67
40
  reason?: string | null;
68
41
  }
42
+ }
69
43
 
70
- export interface AmountDiscount {
71
- /**
72
- * Only available if discount_type is `amount`.
73
- */
74
- amount_discount: string;
44
+ export type InvoiceLevelDiscount = PercentageDiscount | AmountDiscount | TrialDiscount;
75
45
 
76
- /**
77
- * List of price_ids that this discount applies to. For plan/plan phase discounts,
78
- * this can be a subset of prices.
79
- */
80
- applies_to_price_ids: Array<string>;
46
+ export interface PaginationMetadata {
47
+ has_more: boolean;
81
48
 
82
- discount_type: 'amount';
49
+ next_cursor: string | null;
50
+ }
83
51
 
84
- reason?: string | null;
85
- }
52
+ export interface PercentageDiscount {
53
+ /**
54
+ * List of price_ids that this discount applies to. For plan/plan phase discounts,
55
+ * this can be a subset of prices.
56
+ */
57
+ applies_to_price_ids: Array<string>;
58
+
59
+ discount_type: 'percentage';
60
+
61
+ /**
62
+ * Only available if discount_type is `percentage`. This is a number between 0
63
+ * and 1.
64
+ */
65
+ percentage_discount: number;
66
+
67
+ reason?: string | null;
86
68
  }
87
69
 
88
- export interface PaginationMetadata {
89
- has_more: boolean;
70
+ export interface TrialDiscount {
71
+ /**
72
+ * List of price_ids that this discount applies to. For plan/plan phase discounts,
73
+ * this can be a subset of prices.
74
+ */
75
+ applies_to_price_ids: Array<string>;
90
76
 
91
- next_cursor: string | null;
77
+ discount_type: 'trial';
78
+
79
+ reason?: string | null;
80
+
81
+ /**
82
+ * Only available if discount_type is `trial`
83
+ */
84
+ trial_amount_discount?: string | null;
85
+
86
+ /**
87
+ * Only available if discount_type is `trial`
88
+ */
89
+ trial_percentage_discount?: number | null;
92
90
  }