autumn-js 1.2.32 → 1.2.34

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 (167) hide show
  1. package/dist/backend/adapters/express.d.mts +1 -1
  2. package/dist/backend/adapters/express.d.ts +1 -1
  3. package/dist/backend/adapters/express.js +13482 -7722
  4. package/dist/backend/adapters/express.mjs +5 -5
  5. package/dist/backend/adapters/fetch.d.mts +1 -1
  6. package/dist/backend/adapters/fetch.d.ts +1 -1
  7. package/dist/backend/adapters/fetch.js +13482 -7722
  8. package/dist/backend/adapters/fetch.mjs +5 -5
  9. package/dist/backend/adapters/hono.d.mts +1 -1
  10. package/dist/backend/adapters/hono.d.ts +1 -1
  11. package/dist/backend/adapters/hono.js +13482 -7722
  12. package/dist/backend/adapters/hono.mjs +5 -5
  13. package/dist/backend/adapters/index.d.mts +1 -1
  14. package/dist/backend/adapters/index.d.ts +1 -1
  15. package/dist/backend/adapters/index.js +13482 -7722
  16. package/dist/backend/adapters/index.mjs +8 -8
  17. package/dist/backend/adapters/next.d.mts +1 -1
  18. package/dist/backend/adapters/next.d.ts +1 -1
  19. package/dist/backend/adapters/next.js +13482 -7722
  20. package/dist/backend/adapters/next.mjs +5 -5
  21. package/dist/backend/{authTypes-Bx2brfr_.d.mts → authTypes-DEBvnrRj.d.mts} +20 -1
  22. package/dist/backend/{authTypes-Bx2brfr_.d.ts → authTypes-DEBvnrRj.d.ts} +20 -1
  23. package/dist/backend/{chunk-UYURZ75E.mjs → chunk-4LKEHLXR.mjs} +704 -41
  24. package/dist/backend/{chunk-W7MG3LB3.mjs → chunk-7MRAUIPE.mjs} +1 -1
  25. package/dist/backend/{chunk-7MPQ5TCH.mjs → chunk-DDRD5BKK.mjs} +2 -2
  26. package/dist/backend/{chunk-Z7WSDAEZ.mjs → chunk-EQJ5B7OA.mjs} +13165 -8068
  27. package/dist/backend/{chunk-AYS6GLVO.mjs → chunk-HMGGMVFC.mjs} +1 -1
  28. package/dist/backend/{chunk-5QIIBIZY.mjs → chunk-KXRDZE5L.mjs} +2 -2
  29. package/dist/backend/{chunk-MXD3NPQK.mjs → chunk-SA6MCT5X.mjs} +1 -1
  30. package/dist/backend/{chunk-NSAJNDTG.mjs → chunk-WCZLA72P.mjs} +1 -1
  31. package/dist/backend/core/handlers/coreHandler.d.mts +2 -2
  32. package/dist/backend/core/handlers/coreHandler.d.ts +2 -2
  33. package/dist/backend/core/handlers/coreHandler.js +13482 -7722
  34. package/dist/backend/core/handlers/coreHandler.mjs +3 -3
  35. package/dist/backend/core/handlers/executeRoute.d.mts +2 -2
  36. package/dist/backend/core/handlers/executeRoute.d.ts +2 -2
  37. package/dist/backend/core/handlers/handleRouteByName.d.mts +1 -1
  38. package/dist/backend/core/handlers/handleRouteByName.d.ts +1 -1
  39. package/dist/backend/core/handlers/handleRouteByName.js +13482 -7722
  40. package/dist/backend/core/handlers/handleRouteByName.mjs +3 -3
  41. package/dist/backend/core/handlers/index.d.mts +2 -2
  42. package/dist/backend/core/handlers/index.d.ts +2 -2
  43. package/dist/backend/core/handlers/index.js +13482 -7722
  44. package/dist/backend/core/handlers/index.mjs +4 -4
  45. package/dist/backend/core/handlers/resolveIdentity.d.mts +1 -1
  46. package/dist/backend/core/handlers/resolveIdentity.d.ts +1 -1
  47. package/dist/backend/core/index.d.mts +2 -2
  48. package/dist/backend/core/index.d.ts +2 -2
  49. package/dist/backend/core/index.js +13482 -7722
  50. package/dist/backend/core/index.mjs +4 -4
  51. package/dist/backend/core/routes/index.d.mts +2 -2
  52. package/dist/backend/core/routes/index.d.ts +2 -2
  53. package/dist/backend/core/routes/index.js +704 -41
  54. package/dist/backend/core/routes/index.mjs +1 -1
  55. package/dist/backend/core/routes/routeBuilder.d.mts +2 -2
  56. package/dist/backend/core/routes/routeBuilder.d.ts +2 -2
  57. package/dist/backend/core/routes/routeConfigs.d.mts +2 -2
  58. package/dist/backend/core/routes/routeConfigs.d.ts +2 -2
  59. package/dist/backend/core/routes/routeConfigs.js +704 -41
  60. package/dist/backend/core/routes/routeConfigs.mjs +1 -1
  61. package/dist/backend/core/types/authTypes.d.mts +1 -1
  62. package/dist/backend/core/types/authTypes.d.ts +1 -1
  63. package/dist/backend/core/types/handlerTypes.d.mts +2 -2
  64. package/dist/backend/core/types/handlerTypes.d.ts +2 -2
  65. package/dist/backend/core/types/index.d.mts +2 -2
  66. package/dist/backend/core/types/index.d.ts +2 -2
  67. package/dist/backend/core/types/routeTypes.d.mts +2 -2
  68. package/dist/backend/core/types/routeTypes.d.ts +2 -2
  69. package/dist/backend/index.d.mts +4 -4
  70. package/dist/backend/index.d.ts +4 -4
  71. package/dist/backend/index.js +13482 -7722
  72. package/dist/backend/index.mjs +4 -4
  73. package/dist/backend/{routeTypes-DmFnGvb2.d.mts → routeTypes-Bb3L3YJy.d.mts} +14646 -7926
  74. package/dist/backend/{routeTypes-ChCnBnee.d.ts → routeTypes-BhZ9UovL.d.ts} +14646 -7926
  75. package/dist/better-auth/{chunk-JBU3OM2O.mjs → chunk-4VW7A2HS.mjs} +13166 -8069
  76. package/dist/better-auth/{chunk-ZQA6B5RX.mjs → chunk-B2PHHBLY.mjs} +704 -41
  77. package/dist/better-auth/{chunk-56VTK4JS.mjs → chunk-D3DYQ36C.mjs} +1 -1
  78. package/dist/better-auth/index.js +13888 -8128
  79. package/dist/better-auth/index.mjs +3 -3
  80. package/dist/better-auth/types.d.mts +20 -1
  81. package/dist/better-auth/types.d.ts +20 -1
  82. package/dist/better-auth/utils/createAutumnEndpoint.js +704 -41
  83. package/dist/better-auth/utils/createAutumnEndpoint.mjs +2 -2
  84. package/dist/better-auth/utils/handleBetterAuthRoute.js +13482 -7722
  85. package/dist/better-auth/utils/handleBetterAuthRoute.mjs +2 -2
  86. package/dist/better-auth/utils/index.js +13888 -8128
  87. package/dist/better-auth/utils/index.mjs +3 -3
  88. package/dist/react/AutumnContext.d.mts +4 -3
  89. package/dist/react/AutumnContext.d.ts +4 -3
  90. package/dist/react/AutumnProvider.js +678 -497
  91. package/dist/react/AutumnProvider.mjs +2 -2
  92. package/dist/react/{chunk-3CXPC6AS.mjs → chunk-6KIRT7EK.mjs} +1 -1
  93. package/dist/react/{chunk-PVCGOFQF.mjs → chunk-AAPQJY55.mjs} +1 -1
  94. package/dist/react/{chunk-N2L457YE.mjs → chunk-DDMHYLY3.mjs} +1 -1
  95. package/dist/react/{chunk-X7BHGQHX.mjs → chunk-ERN74FDW.mjs} +1 -1
  96. package/dist/react/{chunk-P23GII4V.mjs → chunk-FU6VEECB.mjs} +428 -235
  97. package/dist/react/{chunk-C4DMB2FQ.mjs → chunk-JH5BXBEU.mjs} +1 -1
  98. package/dist/react/{chunk-4TB3RHNC.mjs → chunk-M3L6EE7I.mjs} +1 -1
  99. package/dist/react/{chunk-Q3SFYOOM.mjs → chunk-VJDFB54U.mjs} +2 -2
  100. package/dist/react/{chunk-ZLGDHFMS.mjs → chunk-YZ23DM7M.mjs} +1 -1
  101. package/dist/react/client/AutumnClient.d.mts +4 -3
  102. package/dist/react/client/AutumnClient.d.ts +4 -3
  103. package/dist/react/client/IAutumnClient.d.mts +4 -471
  104. package/dist/react/client/IAutumnClient.d.ts +4 -471
  105. package/dist/react/client/index.d.mts +4 -3
  106. package/dist/react/client/index.d.ts +4 -3
  107. package/dist/react/{customer-B9DcViyn.d.mts → customer-Djhe48ql.d.ts} +24 -5
  108. package/dist/react/{customer-DbS31iZc.d.ts → customer-IVcJjz9u.d.mts} +24 -5
  109. package/dist/react/hooks/index.d.mts +4 -3
  110. package/dist/react/hooks/index.d.ts +4 -3
  111. package/dist/react/hooks/index.js +292 -193
  112. package/dist/react/hooks/index.mjs +8 -8
  113. package/dist/react/hooks/internal/check/balanceToAllowed.d.mts +2 -2
  114. package/dist/react/hooks/internal/check/balanceToAllowed.d.ts +2 -2
  115. package/dist/react/hooks/internal/check/customerToFeatures.d.mts +2 -2
  116. package/dist/react/hooks/internal/check/customerToFeatures.d.ts +2 -2
  117. package/dist/react/hooks/internal/check/findCreditSystemsByFeature.d.mts +2 -2
  118. package/dist/react/hooks/internal/check/findCreditSystemsByFeature.d.ts +2 -2
  119. package/dist/react/hooks/internal/check/getCreditCost.d.mts +2 -2
  120. package/dist/react/hooks/internal/check/getCreditCost.d.ts +2 -2
  121. package/dist/react/hooks/internal/getLocalCheckResponse.d.mts +3 -3
  122. package/dist/react/hooks/internal/getLocalCheckResponse.d.ts +3 -3
  123. package/dist/react/hooks/internal/useCustomerActions.d.mts +4 -3
  124. package/dist/react/hooks/internal/useCustomerActions.d.ts +4 -3
  125. package/dist/react/hooks/internal/useCustomerActions.js +1 -1
  126. package/dist/react/hooks/internal/useCustomerActions.mjs +2 -2
  127. package/dist/react/hooks/useAggregateEvents.d.mts +17 -17
  128. package/dist/react/hooks/useAggregateEvents.d.ts +17 -17
  129. package/dist/react/hooks/useAggregateEvents.js +292 -193
  130. package/dist/react/hooks/useAggregateEvents.mjs +2 -2
  131. package/dist/react/hooks/useCustomer.d.mts +3 -3
  132. package/dist/react/hooks/useCustomer.d.ts +3 -3
  133. package/dist/react/hooks/useCustomer.js +292 -193
  134. package/dist/react/hooks/useCustomer.mjs +3 -3
  135. package/dist/react/hooks/useEntity.d.mts +2 -2
  136. package/dist/react/hooks/useEntity.d.ts +2 -2
  137. package/dist/react/hooks/useEntity.js +292 -193
  138. package/dist/react/hooks/useEntity.mjs +2 -2
  139. package/dist/react/hooks/useListEvents.d.mts +17 -17
  140. package/dist/react/hooks/useListEvents.d.ts +17 -17
  141. package/dist/react/hooks/useListEvents.js +292 -193
  142. package/dist/react/hooks/useListEvents.mjs +2 -2
  143. package/dist/react/hooks/useListPlans.d.mts +5 -4
  144. package/dist/react/hooks/useListPlans.d.ts +5 -4
  145. package/dist/react/hooks/useListPlans.js +292 -193
  146. package/dist/react/hooks/useListPlans.mjs +2 -2
  147. package/dist/react/hooks/useReferrals.d.mts +2 -2
  148. package/dist/react/hooks/useReferrals.d.ts +2 -2
  149. package/dist/react/hooks/useReferrals.js +292 -193
  150. package/dist/react/hooks/useReferrals.mjs +2 -2
  151. package/dist/react/index.d.mts +4 -3
  152. package/dist/react/index.d.ts +4 -3
  153. package/dist/react/index.js +1586 -1393
  154. package/dist/react/index.mjs +9 -9
  155. package/dist/react/list-plans-op-ByqRxdNR.d.mts +1224 -0
  156. package/dist/react/list-plans-op-D-K2LRZV.d.ts +1224 -0
  157. package/dist/react/{params-B8-s4Q1n.d.ts → params-CFhvUVCf.d.ts} +1605 -199
  158. package/dist/react/{params-BquS51Ut.d.mts → params-D3ra6In7.d.mts} +1605 -199
  159. package/dist/react/plan-DOxbvjQY.d.mts +1496 -0
  160. package/dist/react/plan-DOxbvjQY.d.ts +1496 -0
  161. package/dist/sdk/index.d.mts +19588 -11175
  162. package/dist/sdk/index.d.ts +19588 -11175
  163. package/dist/sdk/index.js +19103 -11652
  164. package/dist/sdk/index.mjs +18149 -11528
  165. package/package.json +1 -1
  166. package/dist/react/plan-BKltGb1S.d.mts +0 -743
  167. package/dist/react/plan-BKltGb1S.d.ts +0 -743
@@ -1,4 +1,4 @@
1
- import { C as ClosedEnum, O as OpenEnum, a as Balance, P as Plan } from './plan-BKltGb1S.mjs';
1
+ import { C as ClosedEnum, O as OpenEnum, a as Balance, P as Plan } from './plan-DOxbvjQY.mjs';
2
2
 
3
3
  /**
4
4
  * Time range to aggregate events for. Either range or custom_range must be provided
@@ -680,6 +680,192 @@ type AttachFreeTrialParams = {
680
680
  */
681
681
  onEnd?: AttachOnEnd | undefined;
682
682
  };
683
+ /**
684
+ * The time interval for the purchase limit window.
685
+ */
686
+ declare const AttachPurchaseLimitInterval: {
687
+ readonly Hour: "hour";
688
+ readonly Day: "day";
689
+ readonly Week: "week";
690
+ readonly Month: "month";
691
+ };
692
+ /**
693
+ * The time interval for the purchase limit window.
694
+ */
695
+ type AttachPurchaseLimitInterval = ClosedEnum<typeof AttachPurchaseLimitInterval>;
696
+ /**
697
+ * Optional rate limit to cap how often auto top-ups occur.
698
+ */
699
+ type AttachPurchaseLimit = {
700
+ /**
701
+ * The time interval for the purchase limit window.
702
+ */
703
+ interval: AttachPurchaseLimitInterval;
704
+ /**
705
+ * Number of intervals in the purchase limit window.
706
+ */
707
+ intervalCount?: number | undefined;
708
+ /**
709
+ * Maximum number of auto top-ups allowed within the interval.
710
+ */
711
+ limit: number;
712
+ };
713
+ type AttachAutoTopup = {
714
+ /**
715
+ * The ID of the feature (credit balance) to auto top-up.
716
+ */
717
+ featureId: string;
718
+ /**
719
+ * Whether auto top-up is enabled.
720
+ */
721
+ enabled?: boolean | undefined;
722
+ /**
723
+ * When the balance drops below this threshold, an auto top-up will be purchased.
724
+ */
725
+ threshold: number;
726
+ /**
727
+ * Amount of credits to add per auto top-up.
728
+ */
729
+ quantity: number;
730
+ /**
731
+ * Optional rate limit to cap how often auto top-ups occur.
732
+ */
733
+ purchaseLimit?: AttachPurchaseLimit | undefined;
734
+ /**
735
+ * When true, auto top-up creates a send_invoice invoice instead of auto-charging.
736
+ */
737
+ invoiceMode?: boolean | undefined;
738
+ };
739
+ /**
740
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
741
+ */
742
+ declare const AttachLimitType: {
743
+ readonly Absolute: "absolute";
744
+ readonly UsagePercentage: "usage_percentage";
745
+ };
746
+ /**
747
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
748
+ */
749
+ type AttachLimitType = ClosedEnum<typeof AttachLimitType>;
750
+ type AttachSpendLimit = {
751
+ /**
752
+ * Optional feature ID this spend limit applies to.
753
+ */
754
+ featureId?: string | undefined;
755
+ /**
756
+ * Whether the overage spend limit is enabled.
757
+ */
758
+ enabled?: boolean | undefined;
759
+ /**
760
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
761
+ */
762
+ limitType?: AttachLimitType | undefined;
763
+ /**
764
+ * Overage cap for the feature: absolute units, or a percent (e.g. 120) when limit_type is usage_percentage.
765
+ */
766
+ overageLimit?: number | undefined;
767
+ };
768
+ /**
769
+ * Interval for the cap, aligned to the customer's billing cycle.
770
+ */
771
+ declare const AttachUsageLimitInterval: {
772
+ readonly Day: "day";
773
+ readonly Week: "week";
774
+ readonly Month: "month";
775
+ readonly Year: "year";
776
+ };
777
+ /**
778
+ * Interval for the cap, aligned to the customer's billing cycle.
779
+ */
780
+ type AttachUsageLimitInterval = ClosedEnum<typeof AttachUsageLimitInterval>;
781
+ type AttachUsageLimit = {
782
+ /**
783
+ * The feature this usage limit applies to.
784
+ */
785
+ featureId: string;
786
+ /**
787
+ * Whether this usage limit is enabled.
788
+ */
789
+ enabled?: boolean | undefined;
790
+ /**
791
+ * Maximum units allowed per interval.
792
+ */
793
+ limit: number;
794
+ /**
795
+ * Interval for the cap, aligned to the customer's billing cycle.
796
+ */
797
+ interval: AttachUsageLimitInterval;
798
+ };
799
+ /**
800
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
801
+ */
802
+ declare const AttachThresholdType: {
803
+ readonly Usage: "usage";
804
+ readonly UsagePercentage: "usage_percentage";
805
+ readonly Remaining: "remaining";
806
+ readonly RemainingPercentage: "remaining_percentage";
807
+ };
808
+ /**
809
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
810
+ */
811
+ type AttachThresholdType = ClosedEnum<typeof AttachThresholdType>;
812
+ type AttachUsageAlert = {
813
+ /**
814
+ * The feature ID this alert applies to.
815
+ */
816
+ featureId?: string | undefined;
817
+ /**
818
+ * Whether this usage alert is enabled.
819
+ */
820
+ enabled?: boolean | undefined;
821
+ /**
822
+ * The threshold value that triggers the alert. For usage or remaining, this is an absolute count. For usage_percentage or remaining_percentage, this is a percentage (0-100).
823
+ */
824
+ threshold: number;
825
+ /**
826
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
827
+ */
828
+ thresholdType: AttachThresholdType;
829
+ /**
830
+ * Optional user-defined label to distinguish multiple alerts on the same feature.
831
+ */
832
+ name?: string | undefined;
833
+ };
834
+ type AttachOverageAllowed = {
835
+ /**
836
+ * The feature ID this overage allowed control applies to.
837
+ */
838
+ featureId: string;
839
+ /**
840
+ * Whether overage is allowed for this feature.
841
+ */
842
+ enabled?: boolean | undefined;
843
+ };
844
+ /**
845
+ * Override the plan's billing controls (auto top-ups, spend limits, usage limits, usage alerts, overage allowed) for this customer.
846
+ */
847
+ type AttachBillingControls = {
848
+ /**
849
+ * List of auto top-up configurations per feature.
850
+ */
851
+ autoTopups?: Array<AttachAutoTopup> | undefined;
852
+ /**
853
+ * List of overage spend limits per feature (caps overage spend).
854
+ */
855
+ spendLimits?: Array<AttachSpendLimit> | undefined;
856
+ /**
857
+ * List of hard usage caps per feature (max units per interval).
858
+ */
859
+ usageLimits?: Array<AttachUsageLimit> | undefined;
860
+ /**
861
+ * List of usage alert configurations per feature.
862
+ */
863
+ usageAlerts?: Array<AttachUsageAlert> | undefined;
864
+ /**
865
+ * List of overage allowed controls per feature. When enabled, usage can exceed balance.
866
+ */
867
+ overageAllowed?: Array<AttachOverageAllowed> | undefined;
868
+ };
683
869
  /**
684
870
  * Customize the plan to attach. Can override the price, items, free trial, or a combination.
685
871
  */
@@ -704,6 +890,10 @@ type AttachCustomize = {
704
890
  * Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely.
705
891
  */
706
892
  freeTrial?: AttachFreeTrialParams | null | undefined;
893
+ /**
894
+ * Override the plan's billing controls (auto top-ups, spend limits, usage limits, usage alerts, overage allowed) for this customer.
895
+ */
896
+ billingControls?: AttachBillingControls | undefined;
707
897
  };
708
898
  /**
709
899
  * Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.
@@ -1562,86 +1752,276 @@ type BillingUpdateFreeTrialParams = {
1562
1752
  onEnd?: BillingUpdateOnEnd | undefined;
1563
1753
  };
1564
1754
  /**
1565
- * Customize the plan to attach. Can override the price, items, free trial, or a combination.
1755
+ * The time interval for the purchase limit window.
1566
1756
  */
1567
- type BillingUpdateCustomize = {
1568
- /**
1569
- * Override the base price of the plan. Pass null to remove the base price.
1570
- */
1571
- price?: BillingUpdateBasePrice | null | undefined;
1757
+ declare const BillingUpdatePurchaseLimitInterval: {
1758
+ readonly Hour: "hour";
1759
+ readonly Day: "day";
1760
+ readonly Week: "week";
1761
+ readonly Month: "month";
1762
+ };
1763
+ /**
1764
+ * The time interval for the purchase limit window.
1765
+ */
1766
+ type BillingUpdatePurchaseLimitInterval = ClosedEnum<typeof BillingUpdatePurchaseLimitInterval>;
1767
+ /**
1768
+ * Optional rate limit to cap how often auto top-ups occur.
1769
+ */
1770
+ type BillingUpdatePurchaseLimit = {
1572
1771
  /**
1573
- * Override the items in the plan (PUT-style — replaces all existing items). Mutually exclusive with add_items / remove_items / deprecated update_items.
1772
+ * The time interval for the purchase limit window.
1574
1773
  */
1575
- items?: Array<BillingUpdateItemPlanItem> | undefined;
1774
+ interval: BillingUpdatePurchaseLimitInterval;
1576
1775
  /**
1577
- * Items to add to the plan.
1776
+ * Number of intervals in the purchase limit window.
1578
1777
  */
1579
- addItems?: Array<BillingUpdateAddItemPlanItem> | undefined;
1778
+ intervalCount?: number | undefined;
1580
1779
  /**
1581
- * Filters selecting items to remove from the plan.
1780
+ * Maximum number of auto top-ups allowed within the interval.
1582
1781
  */
1583
- removeItems?: Array<BillingUpdatePlanItemFilter> | undefined;
1782
+ limit: number;
1783
+ };
1784
+ type BillingUpdateAutoTopup = {
1584
1785
  /**
1585
- * Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely.
1786
+ * The ID of the feature (credit balance) to auto top-up.
1586
1787
  */
1587
- freeTrial?: BillingUpdateFreeTrialParams | null | undefined;
1588
- };
1589
- /**
1590
- * Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.
1591
- */
1592
- type BillingUpdateInvoiceMode = {
1788
+ featureId: string;
1593
1789
  /**
1594
- * When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method.
1790
+ * Whether auto top-up is enabled.
1595
1791
  */
1596
- enabled: boolean;
1792
+ enabled?: boolean | undefined;
1597
1793
  /**
1598
- * If true, enables the plan immediately even though the invoice is not paid yet.
1794
+ * When the balance drops below this threshold, an auto top-up will be purchased.
1599
1795
  */
1600
- enablePlanImmediately?: boolean | undefined;
1796
+ threshold: number;
1601
1797
  /**
1602
- * If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review.
1798
+ * Amount of credits to add per auto top-up.
1603
1799
  */
1604
- finalize?: boolean | undefined;
1800
+ quantity: number;
1605
1801
  /**
1606
- * ID of an invoice template (configured in billing settings) whose footer (e.g. bank details) is applied to the invoice.
1802
+ * Optional rate limit to cap how often auto top-ups occur.
1607
1803
  */
1608
- invoiceTemplateId?: string | undefined;
1804
+ purchaseLimit?: BillingUpdatePurchaseLimit | undefined;
1609
1805
  /**
1610
- * Number of days the customer has to pay the invoice before it is due (Stripe days_until_due).
1806
+ * When true, auto top-up creates a send_invoice invoice instead of auto-charging.
1611
1807
  */
1612
- netTermsDays?: number | undefined;
1808
+ invoiceMode?: boolean | undefined;
1613
1809
  };
1614
1810
  /**
1615
- * How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges.
1811
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
1616
1812
  */
1617
- declare const BillingUpdateProrationBehavior: {
1618
- readonly ProrateImmediately: "prorate_immediately";
1619
- readonly None: "none";
1813
+ declare const BillingUpdateLimitType: {
1814
+ readonly Absolute: "absolute";
1815
+ readonly UsagePercentage: "usage_percentage";
1620
1816
  };
1621
1817
  /**
1622
- * How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges.
1623
- */
1624
- type BillingUpdateProrationBehavior = ClosedEnum<typeof BillingUpdateProrationBehavior>;
1625
- /**
1626
- * Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects.
1818
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
1627
1819
  */
1628
- declare const BillingUpdateRedirectMode: {
1629
- readonly Always: "always";
1630
- readonly IfRequired: "if_required";
1631
- readonly Never: "never";
1820
+ type BillingUpdateLimitType = ClosedEnum<typeof BillingUpdateLimitType>;
1821
+ type BillingUpdateSpendLimit = {
1822
+ /**
1823
+ * Optional feature ID this spend limit applies to.
1824
+ */
1825
+ featureId?: string | undefined;
1826
+ /**
1827
+ * Whether the overage spend limit is enabled.
1828
+ */
1829
+ enabled?: boolean | undefined;
1830
+ /**
1831
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
1832
+ */
1833
+ limitType?: BillingUpdateLimitType | undefined;
1834
+ /**
1835
+ * Overage cap for the feature: absolute units, or a percent (e.g. 120) when limit_type is usage_percentage.
1836
+ */
1837
+ overageLimit?: number | undefined;
1632
1838
  };
1633
1839
  /**
1634
- * Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects.
1840
+ * Interval for the cap, aligned to the customer's billing cycle.
1635
1841
  */
1636
- type BillingUpdateRedirectMode = ClosedEnum<typeof BillingUpdateRedirectMode>;
1842
+ declare const BillingUpdateUsageLimitInterval: {
1843
+ readonly Day: "day";
1844
+ readonly Week: "week";
1845
+ readonly Month: "month";
1846
+ readonly Year: "year";
1847
+ };
1637
1848
  /**
1638
- * A discount to apply. Can be either a reward ID or a promotion code.
1849
+ * Interval for the cap, aligned to the customer's billing cycle.
1639
1850
  */
1640
- type BillingUpdateAttachDiscount = {
1851
+ type BillingUpdateUsageLimitInterval = ClosedEnum<typeof BillingUpdateUsageLimitInterval>;
1852
+ type BillingUpdateUsageLimit = {
1641
1853
  /**
1642
- * The ID of the reward to apply as a discount.
1854
+ * The feature this usage limit applies to.
1643
1855
  */
1644
- rewardId?: string | undefined;
1856
+ featureId: string;
1857
+ /**
1858
+ * Whether this usage limit is enabled.
1859
+ */
1860
+ enabled?: boolean | undefined;
1861
+ /**
1862
+ * Maximum units allowed per interval.
1863
+ */
1864
+ limit: number;
1865
+ /**
1866
+ * Interval for the cap, aligned to the customer's billing cycle.
1867
+ */
1868
+ interval: BillingUpdateUsageLimitInterval;
1869
+ };
1870
+ /**
1871
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
1872
+ */
1873
+ declare const BillingUpdateThresholdType: {
1874
+ readonly Usage: "usage";
1875
+ readonly UsagePercentage: "usage_percentage";
1876
+ readonly Remaining: "remaining";
1877
+ readonly RemainingPercentage: "remaining_percentage";
1878
+ };
1879
+ /**
1880
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
1881
+ */
1882
+ type BillingUpdateThresholdType = ClosedEnum<typeof BillingUpdateThresholdType>;
1883
+ type BillingUpdateUsageAlert = {
1884
+ /**
1885
+ * The feature ID this alert applies to.
1886
+ */
1887
+ featureId?: string | undefined;
1888
+ /**
1889
+ * Whether this usage alert is enabled.
1890
+ */
1891
+ enabled?: boolean | undefined;
1892
+ /**
1893
+ * The threshold value that triggers the alert. For usage or remaining, this is an absolute count. For usage_percentage or remaining_percentage, this is a percentage (0-100).
1894
+ */
1895
+ threshold: number;
1896
+ /**
1897
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
1898
+ */
1899
+ thresholdType: BillingUpdateThresholdType;
1900
+ /**
1901
+ * Optional user-defined label to distinguish multiple alerts on the same feature.
1902
+ */
1903
+ name?: string | undefined;
1904
+ };
1905
+ type BillingUpdateOverageAllowed = {
1906
+ /**
1907
+ * The feature ID this overage allowed control applies to.
1908
+ */
1909
+ featureId: string;
1910
+ /**
1911
+ * Whether overage is allowed for this feature.
1912
+ */
1913
+ enabled?: boolean | undefined;
1914
+ };
1915
+ /**
1916
+ * Override the plan's billing controls (auto top-ups, spend limits, usage limits, usage alerts, overage allowed) for this customer.
1917
+ */
1918
+ type BillingUpdateBillingControls = {
1919
+ /**
1920
+ * List of auto top-up configurations per feature.
1921
+ */
1922
+ autoTopups?: Array<BillingUpdateAutoTopup> | undefined;
1923
+ /**
1924
+ * List of overage spend limits per feature (caps overage spend).
1925
+ */
1926
+ spendLimits?: Array<BillingUpdateSpendLimit> | undefined;
1927
+ /**
1928
+ * List of hard usage caps per feature (max units per interval).
1929
+ */
1930
+ usageLimits?: Array<BillingUpdateUsageLimit> | undefined;
1931
+ /**
1932
+ * List of usage alert configurations per feature.
1933
+ */
1934
+ usageAlerts?: Array<BillingUpdateUsageAlert> | undefined;
1935
+ /**
1936
+ * List of overage allowed controls per feature. When enabled, usage can exceed balance.
1937
+ */
1938
+ overageAllowed?: Array<BillingUpdateOverageAllowed> | undefined;
1939
+ };
1940
+ /**
1941
+ * Customize the plan to attach. Can override the price, items, free trial, or a combination.
1942
+ */
1943
+ type BillingUpdateCustomize = {
1944
+ /**
1945
+ * Override the base price of the plan. Pass null to remove the base price.
1946
+ */
1947
+ price?: BillingUpdateBasePrice | null | undefined;
1948
+ /**
1949
+ * Override the items in the plan (PUT-style — replaces all existing items). Mutually exclusive with add_items / remove_items / deprecated update_items.
1950
+ */
1951
+ items?: Array<BillingUpdateItemPlanItem> | undefined;
1952
+ /**
1953
+ * Items to add to the plan.
1954
+ */
1955
+ addItems?: Array<BillingUpdateAddItemPlanItem> | undefined;
1956
+ /**
1957
+ * Filters selecting items to remove from the plan.
1958
+ */
1959
+ removeItems?: Array<BillingUpdatePlanItemFilter> | undefined;
1960
+ /**
1961
+ * Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely.
1962
+ */
1963
+ freeTrial?: BillingUpdateFreeTrialParams | null | undefined;
1964
+ /**
1965
+ * Override the plan's billing controls (auto top-ups, spend limits, usage limits, usage alerts, overage allowed) for this customer.
1966
+ */
1967
+ billingControls?: BillingUpdateBillingControls | undefined;
1968
+ };
1969
+ /**
1970
+ * Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.
1971
+ */
1972
+ type BillingUpdateInvoiceMode = {
1973
+ /**
1974
+ * When true, creates an invoice and sends it to the customer instead of charging their card immediately. Uses Stripe's send_invoice collection method.
1975
+ */
1976
+ enabled: boolean;
1977
+ /**
1978
+ * If true, enables the plan immediately even though the invoice is not paid yet.
1979
+ */
1980
+ enablePlanImmediately?: boolean | undefined;
1981
+ /**
1982
+ * If true, finalizes the invoice so it can be sent to the customer. If false, keeps it as a draft for manual review.
1983
+ */
1984
+ finalize?: boolean | undefined;
1985
+ /**
1986
+ * ID of an invoice template (configured in billing settings) whose footer (e.g. bank details) is applied to the invoice.
1987
+ */
1988
+ invoiceTemplateId?: string | undefined;
1989
+ /**
1990
+ * Number of days the customer has to pay the invoice before it is due (Stripe days_until_due).
1991
+ */
1992
+ netTermsDays?: number | undefined;
1993
+ };
1994
+ /**
1995
+ * How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges.
1996
+ */
1997
+ declare const BillingUpdateProrationBehavior: {
1998
+ readonly ProrateImmediately: "prorate_immediately";
1999
+ readonly None: "none";
2000
+ };
2001
+ /**
2002
+ * How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges.
2003
+ */
2004
+ type BillingUpdateProrationBehavior = ClosedEnum<typeof BillingUpdateProrationBehavior>;
2005
+ /**
2006
+ * Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects.
2007
+ */
2008
+ declare const BillingUpdateRedirectMode: {
2009
+ readonly Always: "always";
2010
+ readonly IfRequired: "if_required";
2011
+ readonly Never: "never";
2012
+ };
2013
+ /**
2014
+ * Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects.
2015
+ */
2016
+ type BillingUpdateRedirectMode = ClosedEnum<typeof BillingUpdateRedirectMode>;
2017
+ /**
2018
+ * A discount to apply. Can be either a reward ID or a promotion code.
2019
+ */
2020
+ type BillingUpdateAttachDiscount = {
2021
+ /**
2022
+ * The ID of the reward to apply as a discount.
2023
+ */
2024
+ rewardId?: string | undefined;
1645
2025
  /**
1646
2026
  * The promotion code to apply as a discount.
1647
2027
  */
@@ -2030,7 +2410,7 @@ declare const FeatureType2: {
2030
2410
  readonly Static: "static";
2031
2411
  };
2032
2412
  type FeatureType2 = OpenEnum<typeof FeatureType2>;
2033
- declare const CheckInterval2: {
2413
+ declare const CheckItemInterval2: {
2034
2414
  readonly Minute: "minute";
2035
2415
  readonly Hour: "hour";
2036
2416
  readonly Day: "day";
@@ -2040,7 +2420,7 @@ declare const CheckInterval2: {
2040
2420
  readonly SemiAnnual: "semi_annual";
2041
2421
  readonly Year: "year";
2042
2422
  };
2043
- type CheckInterval2 = OpenEnum<typeof CheckInterval2>;
2423
+ type CheckItemInterval2 = OpenEnum<typeof CheckItemInterval2>;
2044
2424
  declare const CheckTierBehavior2: {
2045
2425
  readonly Graduated: "graduated";
2046
2426
  readonly Volume: "volume";
@@ -2109,7 +2489,7 @@ type CheckItem2 = {
2109
2489
  /**
2110
2490
  * The reset or billing interval of the product item. If null, feature will have no reset date, and if there's a price, it will be billed one-off.
2111
2491
  */
2112
- interval?: CheckInterval2 | null | undefined;
2492
+ interval?: CheckItemInterval2 | null | undefined;
2113
2493
  /**
2114
2494
  * The interval count of the product item.
2115
2495
  */
@@ -2202,6 +2582,192 @@ type CheckFreeTrial2 = {
2202
2582
  */
2203
2583
  trialAvailable: boolean | null;
2204
2584
  };
2585
+ /**
2586
+ * The time interval for the purchase limit window.
2587
+ */
2588
+ declare const CheckPurchaseLimitInterval2: {
2589
+ readonly Hour: "hour";
2590
+ readonly Day: "day";
2591
+ readonly Week: "week";
2592
+ readonly Month: "month";
2593
+ };
2594
+ /**
2595
+ * The time interval for the purchase limit window.
2596
+ */
2597
+ type CheckPurchaseLimitInterval2 = OpenEnum<typeof CheckPurchaseLimitInterval2>;
2598
+ /**
2599
+ * Optional rate limit to cap how often auto top-ups occur.
2600
+ */
2601
+ type CheckPurchaseLimit2 = {
2602
+ /**
2603
+ * The time interval for the purchase limit window.
2604
+ */
2605
+ interval: CheckPurchaseLimitInterval2;
2606
+ /**
2607
+ * Number of intervals in the purchase limit window.
2608
+ */
2609
+ intervalCount: number;
2610
+ /**
2611
+ * Maximum number of auto top-ups allowed within the interval.
2612
+ */
2613
+ limit: number;
2614
+ };
2615
+ type CheckAutoTopup2 = {
2616
+ /**
2617
+ * The ID of the feature (credit balance) to auto top-up.
2618
+ */
2619
+ featureId: string;
2620
+ /**
2621
+ * Whether auto top-up is enabled.
2622
+ */
2623
+ enabled: boolean;
2624
+ /**
2625
+ * When the balance drops below this threshold, an auto top-up will be purchased.
2626
+ */
2627
+ threshold: number;
2628
+ /**
2629
+ * Amount of credits to add per auto top-up.
2630
+ */
2631
+ quantity: number;
2632
+ /**
2633
+ * Optional rate limit to cap how often auto top-ups occur.
2634
+ */
2635
+ purchaseLimit?: CheckPurchaseLimit2 | undefined;
2636
+ /**
2637
+ * When true, auto top-up creates a send_invoice invoice instead of auto-charging.
2638
+ */
2639
+ invoiceMode?: boolean | undefined;
2640
+ };
2641
+ /**
2642
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
2643
+ */
2644
+ declare const CheckLimitType2: {
2645
+ readonly Absolute: "absolute";
2646
+ readonly UsagePercentage: "usage_percentage";
2647
+ };
2648
+ /**
2649
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
2650
+ */
2651
+ type CheckLimitType2 = OpenEnum<typeof CheckLimitType2>;
2652
+ type CheckSpendLimit2 = {
2653
+ /**
2654
+ * Optional feature ID this spend limit applies to.
2655
+ */
2656
+ featureId?: string | undefined;
2657
+ /**
2658
+ * Whether the overage spend limit is enabled.
2659
+ */
2660
+ enabled: boolean;
2661
+ /**
2662
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
2663
+ */
2664
+ limitType?: CheckLimitType2 | undefined;
2665
+ /**
2666
+ * Overage cap for the feature: absolute units, or a percent (e.g. 120) when limit_type is usage_percentage.
2667
+ */
2668
+ overageLimit?: number | undefined;
2669
+ };
2670
+ /**
2671
+ * Interval for the cap, aligned to the customer's billing cycle.
2672
+ */
2673
+ declare const CheckUsageLimitInterval2: {
2674
+ readonly Day: "day";
2675
+ readonly Week: "week";
2676
+ readonly Month: "month";
2677
+ readonly Year: "year";
2678
+ };
2679
+ /**
2680
+ * Interval for the cap, aligned to the customer's billing cycle.
2681
+ */
2682
+ type CheckUsageLimitInterval2 = OpenEnum<typeof CheckUsageLimitInterval2>;
2683
+ type CheckUsageLimit2 = {
2684
+ /**
2685
+ * The feature this usage limit applies to.
2686
+ */
2687
+ featureId: string;
2688
+ /**
2689
+ * Whether this usage limit is enabled.
2690
+ */
2691
+ enabled: boolean;
2692
+ /**
2693
+ * Maximum units allowed per interval.
2694
+ */
2695
+ limit: number;
2696
+ /**
2697
+ * Interval for the cap, aligned to the customer's billing cycle.
2698
+ */
2699
+ interval: CheckUsageLimitInterval2;
2700
+ };
2701
+ /**
2702
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
2703
+ */
2704
+ declare const CheckThresholdType2: {
2705
+ readonly Usage: "usage";
2706
+ readonly UsagePercentage: "usage_percentage";
2707
+ readonly Remaining: "remaining";
2708
+ readonly RemainingPercentage: "remaining_percentage";
2709
+ };
2710
+ /**
2711
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
2712
+ */
2713
+ type CheckThresholdType2 = OpenEnum<typeof CheckThresholdType2>;
2714
+ type CheckUsageAlert2 = {
2715
+ /**
2716
+ * The feature ID this alert applies to.
2717
+ */
2718
+ featureId?: string | undefined;
2719
+ /**
2720
+ * Whether this usage alert is enabled.
2721
+ */
2722
+ enabled: boolean;
2723
+ /**
2724
+ * The threshold value that triggers the alert. For usage or remaining, this is an absolute count. For usage_percentage or remaining_percentage, this is a percentage (0-100).
2725
+ */
2726
+ threshold: number;
2727
+ /**
2728
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
2729
+ */
2730
+ thresholdType: CheckThresholdType2;
2731
+ /**
2732
+ * Optional user-defined label to distinguish multiple alerts on the same feature.
2733
+ */
2734
+ name?: string | undefined;
2735
+ };
2736
+ type CheckOverageAllowed2 = {
2737
+ /**
2738
+ * The feature ID this overage allowed control applies to.
2739
+ */
2740
+ featureId: string;
2741
+ /**
2742
+ * Whether overage is allowed for this feature.
2743
+ */
2744
+ enabled: boolean;
2745
+ };
2746
+ /**
2747
+ * Plan-level billing controls used as customer defaults
2748
+ */
2749
+ type CheckBillingControls2 = {
2750
+ /**
2751
+ * List of auto top-up configurations per feature.
2752
+ */
2753
+ autoTopups?: Array<CheckAutoTopup2> | undefined;
2754
+ /**
2755
+ * List of overage spend limits per feature (caps overage spend).
2756
+ */
2757
+ spendLimits?: Array<CheckSpendLimit2> | undefined;
2758
+ /**
2759
+ * List of hard usage caps per feature (max units per interval).
2760
+ */
2761
+ usageLimits?: Array<CheckUsageLimit2> | undefined;
2762
+ /**
2763
+ * List of usage alert configurations per feature.
2764
+ */
2765
+ usageAlerts?: Array<CheckUsageAlert2> | undefined;
2766
+ /**
2767
+ * List of overage allowed controls per feature. When enabled, usage can exceed balance.
2768
+ */
2769
+ overageAllowed?: Array<CheckOverageAllowed2> | undefined;
2770
+ };
2205
2771
  /**
2206
2772
  * Scenario for when this product is used in attach flows
2207
2773
  */
@@ -2292,6 +2858,10 @@ type CheckProduct2 = {
2292
2858
  * ID of the base variant this product is derived from
2293
2859
  */
2294
2860
  baseVariantId: string | null;
2861
+ /**
2862
+ * Plan-level billing controls used as customer defaults
2863
+ */
2864
+ billingControls?: CheckBillingControls2 | undefined;
2295
2865
  /**
2296
2866
  * Scenario for when this product is used in attach flows
2297
2867
  */
@@ -2520,7 +3090,7 @@ declare const FeatureType1: {
2520
3090
  readonly Static: "static";
2521
3091
  };
2522
3092
  type FeatureType1 = OpenEnum<typeof FeatureType1>;
2523
- declare const CheckInterval1: {
3093
+ declare const CheckItemInterval1: {
2524
3094
  readonly Minute: "minute";
2525
3095
  readonly Hour: "hour";
2526
3096
  readonly Day: "day";
@@ -2530,7 +3100,7 @@ declare const CheckInterval1: {
2530
3100
  readonly SemiAnnual: "semi_annual";
2531
3101
  readonly Year: "year";
2532
3102
  };
2533
- type CheckInterval1 = OpenEnum<typeof CheckInterval1>;
3103
+ type CheckItemInterval1 = OpenEnum<typeof CheckItemInterval1>;
2534
3104
  declare const CheckTierBehavior1: {
2535
3105
  readonly Graduated: "graduated";
2536
3106
  readonly Volume: "volume";
@@ -2599,7 +3169,7 @@ type CheckItem1 = {
2599
3169
  /**
2600
3170
  * The reset or billing interval of the product item. If null, feature will have no reset date, and if there's a price, it will be billed one-off.
2601
3171
  */
2602
- interval?: CheckInterval1 | null | undefined;
3172
+ interval?: CheckItemInterval1 | null | undefined;
2603
3173
  /**
2604
3174
  * The interval count of the product item.
2605
3175
  */
@@ -2631,66 +3201,252 @@ type CheckItem1 = {
2631
3201
  /**
2632
3202
  * The entity feature ID of the product item if applicable.
2633
3203
  */
2634
- entityFeatureId?: string | null | undefined;
3204
+ entityFeatureId?: string | null | undefined;
3205
+ /**
3206
+ * The display of the product item.
3207
+ */
3208
+ display?: ProductDisplay1 | null | undefined;
3209
+ /**
3210
+ * Used in customer context. Quantity of the feature the customer has prepaid for.
3211
+ */
3212
+ quantity?: number | null | undefined;
3213
+ /**
3214
+ * Used in customer context. Quantity of the feature the customer will prepay for in the next cycle.
3215
+ */
3216
+ nextCycleQuantity?: number | null | undefined;
3217
+ /**
3218
+ * Configuration for rollover and proration behavior of the feature.
3219
+ */
3220
+ config?: CheckConfig1 | null | undefined;
3221
+ };
3222
+ /**
3223
+ * The duration type of the free trial
3224
+ */
3225
+ declare const FreeTrialDuration1: {
3226
+ readonly Day: "day";
3227
+ readonly Month: "month";
3228
+ readonly Year: "year";
3229
+ };
3230
+ /**
3231
+ * The duration type of the free trial
3232
+ */
3233
+ type FreeTrialDuration1 = OpenEnum<typeof FreeTrialDuration1>;
3234
+ declare const CheckOnEnd1: {
3235
+ readonly Bill: "bill";
3236
+ readonly Revert: "revert";
3237
+ };
3238
+ type CheckOnEnd1 = OpenEnum<typeof CheckOnEnd1>;
3239
+ type CheckFreeTrial1 = {
3240
+ /**
3241
+ * The duration type of the free trial
3242
+ */
3243
+ duration: FreeTrialDuration1;
3244
+ /**
3245
+ * The length of the duration type specified
3246
+ */
3247
+ length: number;
3248
+ /**
3249
+ * Whether the free trial is limited to one per customer fingerprint
3250
+ */
3251
+ uniqueFingerprint: boolean;
3252
+ /**
3253
+ * Whether the free trial requires a card. If false, the customer can attach the product without going through a checkout flow or having a card on file.
3254
+ */
3255
+ cardRequired: boolean;
3256
+ /**
3257
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
3258
+ */
3259
+ onEnd?: CheckOnEnd1 | null | undefined;
3260
+ /**
3261
+ * Used in customer context. Whether the free trial is available for the customer if they were to attach the product.
3262
+ */
3263
+ trialAvailable: boolean | null;
3264
+ };
3265
+ /**
3266
+ * The time interval for the purchase limit window.
3267
+ */
3268
+ declare const CheckPurchaseLimitInterval1: {
3269
+ readonly Hour: "hour";
3270
+ readonly Day: "day";
3271
+ readonly Week: "week";
3272
+ readonly Month: "month";
3273
+ };
3274
+ /**
3275
+ * The time interval for the purchase limit window.
3276
+ */
3277
+ type CheckPurchaseLimitInterval1 = OpenEnum<typeof CheckPurchaseLimitInterval1>;
3278
+ /**
3279
+ * Optional rate limit to cap how often auto top-ups occur.
3280
+ */
3281
+ type CheckPurchaseLimit1 = {
3282
+ /**
3283
+ * The time interval for the purchase limit window.
3284
+ */
3285
+ interval: CheckPurchaseLimitInterval1;
3286
+ /**
3287
+ * Number of intervals in the purchase limit window.
3288
+ */
3289
+ intervalCount: number;
3290
+ /**
3291
+ * Maximum number of auto top-ups allowed within the interval.
3292
+ */
3293
+ limit: number;
3294
+ };
3295
+ type CheckAutoTopup1 = {
3296
+ /**
3297
+ * The ID of the feature (credit balance) to auto top-up.
3298
+ */
3299
+ featureId: string;
3300
+ /**
3301
+ * Whether auto top-up is enabled.
3302
+ */
3303
+ enabled: boolean;
3304
+ /**
3305
+ * When the balance drops below this threshold, an auto top-up will be purchased.
3306
+ */
3307
+ threshold: number;
3308
+ /**
3309
+ * Amount of credits to add per auto top-up.
3310
+ */
3311
+ quantity: number;
3312
+ /**
3313
+ * Optional rate limit to cap how often auto top-ups occur.
3314
+ */
3315
+ purchaseLimit?: CheckPurchaseLimit1 | undefined;
3316
+ /**
3317
+ * When true, auto top-up creates a send_invoice invoice instead of auto-charging.
3318
+ */
3319
+ invoiceMode?: boolean | undefined;
3320
+ };
3321
+ /**
3322
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
3323
+ */
3324
+ declare const CheckLimitType1: {
3325
+ readonly Absolute: "absolute";
3326
+ readonly UsagePercentage: "usage_percentage";
3327
+ };
3328
+ /**
3329
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
3330
+ */
3331
+ type CheckLimitType1 = OpenEnum<typeof CheckLimitType1>;
3332
+ type CheckSpendLimit1 = {
3333
+ /**
3334
+ * Optional feature ID this spend limit applies to.
3335
+ */
3336
+ featureId?: string | undefined;
3337
+ /**
3338
+ * Whether the overage spend limit is enabled.
3339
+ */
3340
+ enabled: boolean;
3341
+ /**
3342
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
3343
+ */
3344
+ limitType?: CheckLimitType1 | undefined;
3345
+ /**
3346
+ * Overage cap for the feature: absolute units, or a percent (e.g. 120) when limit_type is usage_percentage.
3347
+ */
3348
+ overageLimit?: number | undefined;
3349
+ };
3350
+ /**
3351
+ * Interval for the cap, aligned to the customer's billing cycle.
3352
+ */
3353
+ declare const CheckUsageLimitInterval1: {
3354
+ readonly Day: "day";
3355
+ readonly Week: "week";
3356
+ readonly Month: "month";
3357
+ readonly Year: "year";
3358
+ };
3359
+ /**
3360
+ * Interval for the cap, aligned to the customer's billing cycle.
3361
+ */
3362
+ type CheckUsageLimitInterval1 = OpenEnum<typeof CheckUsageLimitInterval1>;
3363
+ type CheckUsageLimit1 = {
3364
+ /**
3365
+ * The feature this usage limit applies to.
3366
+ */
3367
+ featureId: string;
3368
+ /**
3369
+ * Whether this usage limit is enabled.
3370
+ */
3371
+ enabled: boolean;
3372
+ /**
3373
+ * Maximum units allowed per interval.
3374
+ */
3375
+ limit: number;
3376
+ /**
3377
+ * Interval for the cap, aligned to the customer's billing cycle.
3378
+ */
3379
+ interval: CheckUsageLimitInterval1;
3380
+ };
3381
+ /**
3382
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
3383
+ */
3384
+ declare const CheckThresholdType1: {
3385
+ readonly Usage: "usage";
3386
+ readonly UsagePercentage: "usage_percentage";
3387
+ readonly Remaining: "remaining";
3388
+ readonly RemainingPercentage: "remaining_percentage";
3389
+ };
3390
+ /**
3391
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
3392
+ */
3393
+ type CheckThresholdType1 = OpenEnum<typeof CheckThresholdType1>;
3394
+ type CheckUsageAlert1 = {
3395
+ /**
3396
+ * The feature ID this alert applies to.
3397
+ */
3398
+ featureId?: string | undefined;
3399
+ /**
3400
+ * Whether this usage alert is enabled.
3401
+ */
3402
+ enabled: boolean;
3403
+ /**
3404
+ * The threshold value that triggers the alert. For usage or remaining, this is an absolute count. For usage_percentage or remaining_percentage, this is a percentage (0-100).
3405
+ */
3406
+ threshold: number;
2635
3407
  /**
2636
- * The display of the product item.
3408
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
2637
3409
  */
2638
- display?: ProductDisplay1 | null | undefined;
3410
+ thresholdType: CheckThresholdType1;
2639
3411
  /**
2640
- * Used in customer context. Quantity of the feature the customer has prepaid for.
3412
+ * Optional user-defined label to distinguish multiple alerts on the same feature.
2641
3413
  */
2642
- quantity?: number | null | undefined;
3414
+ name?: string | undefined;
3415
+ };
3416
+ type CheckOverageAllowed1 = {
2643
3417
  /**
2644
- * Used in customer context. Quantity of the feature the customer will prepay for in the next cycle.
3418
+ * The feature ID this overage allowed control applies to.
2645
3419
  */
2646
- nextCycleQuantity?: number | null | undefined;
3420
+ featureId: string;
2647
3421
  /**
2648
- * Configuration for rollover and proration behavior of the feature.
3422
+ * Whether overage is allowed for this feature.
2649
3423
  */
2650
- config?: CheckConfig1 | null | undefined;
2651
- };
2652
- /**
2653
- * The duration type of the free trial
2654
- */
2655
- declare const FreeTrialDuration1: {
2656
- readonly Day: "day";
2657
- readonly Month: "month";
2658
- readonly Year: "year";
3424
+ enabled: boolean;
2659
3425
  };
2660
3426
  /**
2661
- * The duration type of the free trial
3427
+ * Plan-level billing controls used as customer defaults
2662
3428
  */
2663
- type FreeTrialDuration1 = OpenEnum<typeof FreeTrialDuration1>;
2664
- declare const CheckOnEnd1: {
2665
- readonly Bill: "bill";
2666
- readonly Revert: "revert";
2667
- };
2668
- type CheckOnEnd1 = OpenEnum<typeof CheckOnEnd1>;
2669
- type CheckFreeTrial1 = {
2670
- /**
2671
- * The duration type of the free trial
2672
- */
2673
- duration: FreeTrialDuration1;
3429
+ type CheckBillingControls1 = {
2674
3430
  /**
2675
- * The length of the duration type specified
3431
+ * List of auto top-up configurations per feature.
2676
3432
  */
2677
- length: number;
3433
+ autoTopups?: Array<CheckAutoTopup1> | undefined;
2678
3434
  /**
2679
- * Whether the free trial is limited to one per customer fingerprint
3435
+ * List of overage spend limits per feature (caps overage spend).
2680
3436
  */
2681
- uniqueFingerprint: boolean;
3437
+ spendLimits?: Array<CheckSpendLimit1> | undefined;
2682
3438
  /**
2683
- * Whether the free trial requires a card. If false, the customer can attach the product without going through a checkout flow or having a card on file.
3439
+ * List of hard usage caps per feature (max units per interval).
2684
3440
  */
2685
- cardRequired: boolean;
3441
+ usageLimits?: Array<CheckUsageLimit1> | undefined;
2686
3442
  /**
2687
- * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
3443
+ * List of usage alert configurations per feature.
2688
3444
  */
2689
- onEnd?: CheckOnEnd1 | null | undefined;
3445
+ usageAlerts?: Array<CheckUsageAlert1> | undefined;
2690
3446
  /**
2691
- * Used in customer context. Whether the free trial is available for the customer if they were to attach the product.
3447
+ * List of overage allowed controls per feature. When enabled, usage can exceed balance.
2692
3448
  */
2693
- trialAvailable: boolean | null;
3449
+ overageAllowed?: Array<CheckOverageAllowed1> | undefined;
2694
3450
  };
2695
3451
  /**
2696
3452
  * Scenario for when this product is used in attach flows
@@ -2782,6 +3538,10 @@ type CheckProduct1 = {
2782
3538
  * ID of the base variant this product is derived from
2783
3539
  */
2784
3540
  baseVariantId: string | null;
3541
+ /**
3542
+ * Plan-level billing controls used as customer defaults
3543
+ */
3544
+ billingControls?: CheckBillingControls1 | undefined;
2785
3545
  /**
2786
3546
  * Scenario for when this product is used in attach flows
2787
3547
  */
@@ -2914,6 +3674,17 @@ type CustomerDataAutoTopup = {
2914
3674
  */
2915
3675
  invoiceMode?: boolean | undefined;
2916
3676
  };
3677
+ /**
3678
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
3679
+ */
3680
+ declare const CustomerDataLimitType: {
3681
+ readonly Absolute: "absolute";
3682
+ readonly UsagePercentage: "usage_percentage";
3683
+ };
3684
+ /**
3685
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
3686
+ */
3687
+ type CustomerDataLimitType = ClosedEnum<typeof CustomerDataLimitType>;
2917
3688
  type CustomerDataSpendLimit = {
2918
3689
  /**
2919
3690
  * Optional feature ID this spend limit applies to.
@@ -2924,7 +3695,11 @@ type CustomerDataSpendLimit = {
2924
3695
  */
2925
3696
  enabled?: boolean | undefined;
2926
3697
  /**
2927
- * Maximum allowed overage spend for the target feature.
3698
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
3699
+ */
3700
+ limitType?: CustomerDataLimitType | undefined;
3701
+ /**
3702
+ * Overage cap for the feature: absolute units, or a percent (e.g. 120) when limit_type is usage_percentage.
2928
3703
  */
2929
3704
  overageLimit?: number | undefined;
2930
3705
  };
@@ -2946,6 +3721,10 @@ type CustomerDataUsageLimit = {
2946
3721
  * The feature this usage limit applies to.
2947
3722
  */
2948
3723
  featureId: string;
3724
+ /**
3725
+ * Whether this usage limit is enabled.
3726
+ */
3727
+ enabled?: boolean | undefined;
2949
3728
  /**
2950
3729
  * Maximum units allowed per interval.
2951
3730
  */
@@ -3365,6 +4144,17 @@ type GetEntityFlags = {
3365
4144
  */
3366
4145
  feature?: GetEntityFeature | undefined;
3367
4146
  };
4147
+ /**
4148
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
4149
+ */
4150
+ declare const GetEntityLimitType: {
4151
+ readonly Absolute: "absolute";
4152
+ readonly UsagePercentage: "usage_percentage";
4153
+ };
4154
+ /**
4155
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
4156
+ */
4157
+ type GetEntityLimitType = OpenEnum<typeof GetEntityLimitType>;
3368
4158
  type GetEntitySpendLimit = {
3369
4159
  /**
3370
4160
  * Optional feature ID this spend limit applies to.
@@ -3375,7 +4165,11 @@ type GetEntitySpendLimit = {
3375
4165
  */
3376
4166
  enabled: boolean;
3377
4167
  /**
3378
- * Maximum allowed overage spend for the target feature.
4168
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
4169
+ */
4170
+ limitType?: GetEntityLimitType | undefined;
4171
+ /**
4172
+ * Overage cap for the feature: absolute units, or a percent (e.g. 120) when limit_type is usage_percentage.
3379
4173
  */
3380
4174
  overageLimit?: number | undefined;
3381
4175
  };
@@ -3397,6 +4191,10 @@ type GetEntityUsageLimit = {
3397
4191
  * The feature this usage limit applies to.
3398
4192
  */
3399
4193
  featureId: string;
4194
+ /**
4195
+ * Whether this usage limit is enabled.
4196
+ */
4197
+ enabled: boolean;
3400
4198
  /**
3401
4199
  * Maximum units allowed per interval.
3402
4200
  */
@@ -4084,6 +4882,17 @@ declare const MultiAttachRedirectMode: {
4084
4882
  * Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects.
4085
4883
  */
4086
4884
  type MultiAttachRedirectMode = ClosedEnum<typeof MultiAttachRedirectMode>;
4885
+ /**
4886
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
4887
+ */
4888
+ declare const MultiAttachLimitType: {
4889
+ readonly Absolute: "absolute";
4890
+ readonly UsagePercentage: "usage_percentage";
4891
+ };
4892
+ /**
4893
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
4894
+ */
4895
+ type MultiAttachLimitType = ClosedEnum<typeof MultiAttachLimitType>;
4087
4896
  type MultiAttachSpendLimit = {
4088
4897
  /**
4089
4898
  * Optional feature ID this spend limit applies to.
@@ -4094,7 +4903,11 @@ type MultiAttachSpendLimit = {
4094
4903
  */
4095
4904
  enabled?: boolean | undefined;
4096
4905
  /**
4097
- * Maximum allowed overage spend for the target feature.
4906
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
4907
+ */
4908
+ limitType?: MultiAttachLimitType | undefined;
4909
+ /**
4910
+ * Overage cap for the feature: absolute units, or a percent (e.g. 120) when limit_type is usage_percentage.
4098
4911
  */
4099
4912
  overageLimit?: number | undefined;
4100
4913
  };
@@ -4116,6 +4929,10 @@ type MultiAttachUsageLimit = {
4116
4929
  * The feature this usage limit applies to.
4117
4930
  */
4118
4931
  featureId: string;
4932
+ /**
4933
+ * Whether this usage limit is enabled.
4934
+ */
4935
+ enabled?: boolean | undefined;
4119
4936
  /**
4120
4937
  * Maximum units allowed per interval.
4121
4938
  */
@@ -4807,118 +5624,304 @@ type PreviewAttachAddItemPlanItem = {
4807
5624
  */
4808
5625
  unlimited?: boolean | undefined;
4809
5626
  /**
4810
- * Reset configuration for consumable features. Omit for non-consumable features like seats.
5627
+ * Reset configuration for consumable features. Omit for non-consumable features like seats.
5628
+ */
5629
+ reset?: PreviewAttachAddItemReset | undefined;
5630
+ /**
5631
+ * Pricing for usage beyond included units. Omit for free features.
5632
+ */
5633
+ price?: PreviewAttachAddItemPrice | undefined;
5634
+ /**
5635
+ * Proration settings for prepaid features. Controls mid-cycle quantity change billing.
5636
+ */
5637
+ proration?: PreviewAttachAddItemProration | undefined;
5638
+ /**
5639
+ * Rollover config for unused units. If set, unused included units carry over.
5640
+ */
5641
+ rollover?: PreviewAttachAddItemRollover | undefined;
5642
+ };
5643
+ /**
5644
+ * Match items with this billing method (prepaid or usage_based).
5645
+ */
5646
+ declare const PreviewAttachRemoveItemBillingMethod: {
5647
+ readonly Prepaid: "prepaid";
5648
+ readonly UsageBased: "usage_based";
5649
+ };
5650
+ /**
5651
+ * Match items with this billing method (prepaid or usage_based).
5652
+ */
5653
+ type PreviewAttachRemoveItemBillingMethod = ClosedEnum<typeof PreviewAttachRemoveItemBillingMethod>;
5654
+ declare const PreviewAttachIntervalRemoveItemEnum2: {
5655
+ readonly OneOff: "one_off";
5656
+ readonly Minute: "minute";
5657
+ readonly Hour: "hour";
5658
+ readonly Day: "day";
5659
+ readonly Week: "week";
5660
+ readonly Month: "month";
5661
+ readonly Quarter: "quarter";
5662
+ readonly SemiAnnual: "semi_annual";
5663
+ readonly Year: "year";
5664
+ };
5665
+ type PreviewAttachIntervalRemoveItemEnum2 = ClosedEnum<typeof PreviewAttachIntervalRemoveItemEnum2>;
5666
+ declare const PreviewAttachIntervalRemoveItemEnum1: {
5667
+ readonly OneOff: "one_off";
5668
+ readonly Week: "week";
5669
+ readonly Month: "month";
5670
+ readonly Quarter: "quarter";
5671
+ readonly SemiAnnual: "semi_annual";
5672
+ readonly Year: "year";
5673
+ };
5674
+ type PreviewAttachIntervalRemoveItemEnum1 = ClosedEnum<typeof PreviewAttachIntervalRemoveItemEnum1>;
5675
+ /**
5676
+ * Filter for matching plan items. All provided fields must match (AND).
5677
+ */
5678
+ type PreviewAttachPlanItemFilter = {
5679
+ /**
5680
+ * Match items linked to this feature.
5681
+ */
5682
+ featureId?: string | undefined;
5683
+ /**
5684
+ * Match items with this billing method (prepaid or usage_based).
5685
+ */
5686
+ billingMethod?: PreviewAttachRemoveItemBillingMethod | undefined;
5687
+ /**
5688
+ * Match items with this interval. Accepts either a BillingInterval (price-side) or a ResetInterval (reset-side, includes day/hour/minute) so price-less items keyed by reset.interval can be disambiguated.
5689
+ */
5690
+ interval?: PreviewAttachIntervalRemoveItemEnum1 | PreviewAttachIntervalRemoveItemEnum2 | undefined;
5691
+ /**
5692
+ * Match items with this interval_count. Disambiguates between items that share an interval but differ in count.
5693
+ */
5694
+ intervalCount?: number | undefined;
5695
+ };
5696
+ /**
5697
+ * Unit of time for the trial ('day', 'month', 'year').
5698
+ */
5699
+ declare const PreviewAttachDurationType: {
5700
+ readonly Day: "day";
5701
+ readonly Month: "month";
5702
+ readonly Year: "year";
5703
+ };
5704
+ /**
5705
+ * Unit of time for the trial ('day', 'month', 'year').
5706
+ */
5707
+ type PreviewAttachDurationType = ClosedEnum<typeof PreviewAttachDurationType>;
5708
+ /**
5709
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
5710
+ */
5711
+ declare const PreviewAttachOnEnd: {
5712
+ readonly Bill: "bill";
5713
+ readonly Revert: "revert";
5714
+ };
5715
+ /**
5716
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
5717
+ */
5718
+ type PreviewAttachOnEnd = ClosedEnum<typeof PreviewAttachOnEnd>;
5719
+ /**
5720
+ * Free trial configuration for a plan.
5721
+ */
5722
+ type PreviewAttachFreeTrialParams = {
5723
+ /**
5724
+ * Number of duration_type periods the trial lasts.
5725
+ */
5726
+ durationLength: number;
5727
+ /**
5728
+ * Unit of time for the trial ('day', 'month', 'year').
5729
+ */
5730
+ durationType?: PreviewAttachDurationType | undefined;
5731
+ /**
5732
+ * If true, payment method required to start trial. Customer is charged after trial ends.
5733
+ */
5734
+ cardRequired?: boolean | undefined;
5735
+ /**
5736
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
5737
+ */
5738
+ onEnd?: PreviewAttachOnEnd | undefined;
5739
+ };
5740
+ /**
5741
+ * The time interval for the purchase limit window.
5742
+ */
5743
+ declare const PreviewAttachPurchaseLimitInterval: {
5744
+ readonly Hour: "hour";
5745
+ readonly Day: "day";
5746
+ readonly Week: "week";
5747
+ readonly Month: "month";
5748
+ };
5749
+ /**
5750
+ * The time interval for the purchase limit window.
5751
+ */
5752
+ type PreviewAttachPurchaseLimitInterval = ClosedEnum<typeof PreviewAttachPurchaseLimitInterval>;
5753
+ /**
5754
+ * Optional rate limit to cap how often auto top-ups occur.
5755
+ */
5756
+ type PreviewAttachPurchaseLimit = {
5757
+ /**
5758
+ * The time interval for the purchase limit window.
5759
+ */
5760
+ interval: PreviewAttachPurchaseLimitInterval;
5761
+ /**
5762
+ * Number of intervals in the purchase limit window.
5763
+ */
5764
+ intervalCount?: number | undefined;
5765
+ /**
5766
+ * Maximum number of auto top-ups allowed within the interval.
5767
+ */
5768
+ limit: number;
5769
+ };
5770
+ type PreviewAttachAutoTopup = {
5771
+ /**
5772
+ * The ID of the feature (credit balance) to auto top-up.
5773
+ */
5774
+ featureId: string;
5775
+ /**
5776
+ * Whether auto top-up is enabled.
5777
+ */
5778
+ enabled?: boolean | undefined;
5779
+ /**
5780
+ * When the balance drops below this threshold, an auto top-up will be purchased.
5781
+ */
5782
+ threshold: number;
5783
+ /**
5784
+ * Amount of credits to add per auto top-up.
5785
+ */
5786
+ quantity: number;
5787
+ /**
5788
+ * Optional rate limit to cap how often auto top-ups occur.
5789
+ */
5790
+ purchaseLimit?: PreviewAttachPurchaseLimit | undefined;
5791
+ /**
5792
+ * When true, auto top-up creates a send_invoice invoice instead of auto-charging.
5793
+ */
5794
+ invoiceMode?: boolean | undefined;
5795
+ };
5796
+ /**
5797
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
5798
+ */
5799
+ declare const PreviewAttachLimitType: {
5800
+ readonly Absolute: "absolute";
5801
+ readonly UsagePercentage: "usage_percentage";
5802
+ };
5803
+ /**
5804
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
5805
+ */
5806
+ type PreviewAttachLimitType = ClosedEnum<typeof PreviewAttachLimitType>;
5807
+ type PreviewAttachSpendLimit = {
5808
+ /**
5809
+ * Optional feature ID this spend limit applies to.
4811
5810
  */
4812
- reset?: PreviewAttachAddItemReset | undefined;
5811
+ featureId?: string | undefined;
4813
5812
  /**
4814
- * Pricing for usage beyond included units. Omit for free features.
5813
+ * Whether the overage spend limit is enabled.
4815
5814
  */
4816
- price?: PreviewAttachAddItemPrice | undefined;
5815
+ enabled?: boolean | undefined;
4817
5816
  /**
4818
- * Proration settings for prepaid features. Controls mid-cycle quantity change billing.
5817
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
4819
5818
  */
4820
- proration?: PreviewAttachAddItemProration | undefined;
5819
+ limitType?: PreviewAttachLimitType | undefined;
4821
5820
  /**
4822
- * Rollover config for unused units. If set, unused included units carry over.
5821
+ * Overage cap for the feature: absolute units, or a percent (e.g. 120) when limit_type is usage_percentage.
4823
5822
  */
4824
- rollover?: PreviewAttachAddItemRollover | undefined;
4825
- };
4826
- /**
4827
- * Match items with this billing method (prepaid or usage_based).
4828
- */
4829
- declare const PreviewAttachRemoveItemBillingMethod: {
4830
- readonly Prepaid: "prepaid";
4831
- readonly UsageBased: "usage_based";
5823
+ overageLimit?: number | undefined;
4832
5824
  };
4833
5825
  /**
4834
- * Match items with this billing method (prepaid or usage_based).
5826
+ * Interval for the cap, aligned to the customer's billing cycle.
4835
5827
  */
4836
- type PreviewAttachRemoveItemBillingMethod = ClosedEnum<typeof PreviewAttachRemoveItemBillingMethod>;
4837
- declare const PreviewAttachIntervalRemoveItemEnum2: {
4838
- readonly OneOff: "one_off";
4839
- readonly Minute: "minute";
4840
- readonly Hour: "hour";
5828
+ declare const PreviewAttachUsageLimitInterval: {
4841
5829
  readonly Day: "day";
4842
5830
  readonly Week: "week";
4843
5831
  readonly Month: "month";
4844
- readonly Quarter: "quarter";
4845
- readonly SemiAnnual: "semi_annual";
4846
- readonly Year: "year";
4847
- };
4848
- type PreviewAttachIntervalRemoveItemEnum2 = ClosedEnum<typeof PreviewAttachIntervalRemoveItemEnum2>;
4849
- declare const PreviewAttachIntervalRemoveItemEnum1: {
4850
- readonly OneOff: "one_off";
4851
- readonly Week: "week";
4852
- readonly Month: "month";
4853
- readonly Quarter: "quarter";
4854
- readonly SemiAnnual: "semi_annual";
4855
5832
  readonly Year: "year";
4856
5833
  };
4857
- type PreviewAttachIntervalRemoveItemEnum1 = ClosedEnum<typeof PreviewAttachIntervalRemoveItemEnum1>;
4858
5834
  /**
4859
- * Filter for matching plan items. All provided fields must match (AND).
5835
+ * Interval for the cap, aligned to the customer's billing cycle.
4860
5836
  */
4861
- type PreviewAttachPlanItemFilter = {
5837
+ type PreviewAttachUsageLimitInterval = ClosedEnum<typeof PreviewAttachUsageLimitInterval>;
5838
+ type PreviewAttachUsageLimit = {
4862
5839
  /**
4863
- * Match items linked to this feature.
5840
+ * The feature this usage limit applies to.
4864
5841
  */
4865
- featureId?: string | undefined;
5842
+ featureId: string;
4866
5843
  /**
4867
- * Match items with this billing method (prepaid or usage_based).
5844
+ * Whether this usage limit is enabled.
4868
5845
  */
4869
- billingMethod?: PreviewAttachRemoveItemBillingMethod | undefined;
5846
+ enabled?: boolean | undefined;
4870
5847
  /**
4871
- * Match items with this interval. Accepts either a BillingInterval (price-side) or a ResetInterval (reset-side, includes day/hour/minute) so price-less items keyed by reset.interval can be disambiguated.
5848
+ * Maximum units allowed per interval.
4872
5849
  */
4873
- interval?: PreviewAttachIntervalRemoveItemEnum1 | PreviewAttachIntervalRemoveItemEnum2 | undefined;
5850
+ limit: number;
4874
5851
  /**
4875
- * Match items with this interval_count. Disambiguates between items that share an interval but differ in count.
5852
+ * Interval for the cap, aligned to the customer's billing cycle.
4876
5853
  */
4877
- intervalCount?: number | undefined;
5854
+ interval: PreviewAttachUsageLimitInterval;
4878
5855
  };
4879
5856
  /**
4880
- * Unit of time for the trial ('day', 'month', 'year').
5857
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
4881
5858
  */
4882
- declare const PreviewAttachDurationType: {
4883
- readonly Day: "day";
4884
- readonly Month: "month";
4885
- readonly Year: "year";
5859
+ declare const PreviewAttachThresholdType: {
5860
+ readonly Usage: "usage";
5861
+ readonly UsagePercentage: "usage_percentage";
5862
+ readonly Remaining: "remaining";
5863
+ readonly RemainingPercentage: "remaining_percentage";
4886
5864
  };
4887
5865
  /**
4888
- * Unit of time for the trial ('day', 'month', 'year').
4889
- */
4890
- type PreviewAttachDurationType = ClosedEnum<typeof PreviewAttachDurationType>;
4891
- /**
4892
- * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
5866
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
4893
5867
  */
4894
- declare const PreviewAttachOnEnd: {
4895
- readonly Bill: "bill";
4896
- readonly Revert: "revert";
5868
+ type PreviewAttachThresholdType = ClosedEnum<typeof PreviewAttachThresholdType>;
5869
+ type PreviewAttachUsageAlert = {
5870
+ /**
5871
+ * The feature ID this alert applies to.
5872
+ */
5873
+ featureId?: string | undefined;
5874
+ /**
5875
+ * Whether this usage alert is enabled.
5876
+ */
5877
+ enabled?: boolean | undefined;
5878
+ /**
5879
+ * The threshold value that triggers the alert. For usage or remaining, this is an absolute count. For usage_percentage or remaining_percentage, this is a percentage (0-100).
5880
+ */
5881
+ threshold: number;
5882
+ /**
5883
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
5884
+ */
5885
+ thresholdType: PreviewAttachThresholdType;
5886
+ /**
5887
+ * Optional user-defined label to distinguish multiple alerts on the same feature.
5888
+ */
5889
+ name?: string | undefined;
5890
+ };
5891
+ type PreviewAttachOverageAllowed = {
5892
+ /**
5893
+ * The feature ID this overage allowed control applies to.
5894
+ */
5895
+ featureId: string;
5896
+ /**
5897
+ * Whether overage is allowed for this feature.
5898
+ */
5899
+ enabled?: boolean | undefined;
4897
5900
  };
4898
5901
  /**
4899
- * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
4900
- */
4901
- type PreviewAttachOnEnd = ClosedEnum<typeof PreviewAttachOnEnd>;
4902
- /**
4903
- * Free trial configuration for a plan.
5902
+ * Override the plan's billing controls (auto top-ups, spend limits, usage limits, usage alerts, overage allowed) for this customer.
4904
5903
  */
4905
- type PreviewAttachFreeTrialParams = {
5904
+ type PreviewAttachBillingControls = {
4906
5905
  /**
4907
- * Number of duration_type periods the trial lasts.
5906
+ * List of auto top-up configurations per feature.
4908
5907
  */
4909
- durationLength: number;
5908
+ autoTopups?: Array<PreviewAttachAutoTopup> | undefined;
4910
5909
  /**
4911
- * Unit of time for the trial ('day', 'month', 'year').
5910
+ * List of overage spend limits per feature (caps overage spend).
4912
5911
  */
4913
- durationType?: PreviewAttachDurationType | undefined;
5912
+ spendLimits?: Array<PreviewAttachSpendLimit> | undefined;
4914
5913
  /**
4915
- * If true, payment method required to start trial. Customer is charged after trial ends.
5914
+ * List of hard usage caps per feature (max units per interval).
4916
5915
  */
4917
- cardRequired?: boolean | undefined;
5916
+ usageLimits?: Array<PreviewAttachUsageLimit> | undefined;
4918
5917
  /**
4919
- * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
5918
+ * List of usage alert configurations per feature.
4920
5919
  */
4921
- onEnd?: PreviewAttachOnEnd | undefined;
5920
+ usageAlerts?: Array<PreviewAttachUsageAlert> | undefined;
5921
+ /**
5922
+ * List of overage allowed controls per feature. When enabled, usage can exceed balance.
5923
+ */
5924
+ overageAllowed?: Array<PreviewAttachOverageAllowed> | undefined;
4922
5925
  };
4923
5926
  /**
4924
5927
  * Customize the plan to attach. Can override the price, items, free trial, or a combination.
@@ -4944,6 +5947,10 @@ type PreviewAttachCustomize = {
4944
5947
  * Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely.
4945
5948
  */
4946
5949
  freeTrial?: PreviewAttachFreeTrialParams | null | undefined;
5950
+ /**
5951
+ * Override the plan's billing controls (auto top-ups, spend limits, usage limits, usage alerts, overage allowed) for this customer.
5952
+ */
5953
+ billingControls?: PreviewAttachBillingControls | undefined;
4947
5954
  };
4948
5955
  /**
4949
5956
  * Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.
@@ -5896,6 +6903,17 @@ declare const PreviewMultiAttachRedirectMode: {
5896
6903
  * Controls when to return a checkout URL. 'always' returns a URL even if payment succeeds, 'if_required' only when payment action is needed, 'never' disables redirects.
5897
6904
  */
5898
6905
  type PreviewMultiAttachRedirectMode = ClosedEnum<typeof PreviewMultiAttachRedirectMode>;
6906
+ /**
6907
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
6908
+ */
6909
+ declare const PreviewMultiAttachLimitType: {
6910
+ readonly Absolute: "absolute";
6911
+ readonly UsagePercentage: "usage_percentage";
6912
+ };
6913
+ /**
6914
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
6915
+ */
6916
+ type PreviewMultiAttachLimitType = ClosedEnum<typeof PreviewMultiAttachLimitType>;
5899
6917
  type PreviewMultiAttachSpendLimit = {
5900
6918
  /**
5901
6919
  * Optional feature ID this spend limit applies to.
@@ -5906,7 +6924,11 @@ type PreviewMultiAttachSpendLimit = {
5906
6924
  */
5907
6925
  enabled?: boolean | undefined;
5908
6926
  /**
5909
- * Maximum allowed overage spend for the target feature.
6927
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
6928
+ */
6929
+ limitType?: PreviewMultiAttachLimitType | undefined;
6930
+ /**
6931
+ * Overage cap for the feature: absolute units, or a percent (e.g. 120) when limit_type is usage_percentage.
5910
6932
  */
5911
6933
  overageLimit?: number | undefined;
5912
6934
  };
@@ -5928,6 +6950,10 @@ type PreviewMultiAttachUsageLimit = {
5928
6950
  * The feature this usage limit applies to.
5929
6951
  */
5930
6952
  featureId: string;
6953
+ /**
6954
+ * Whether this usage limit is enabled.
6955
+ */
6956
+ enabled?: boolean | undefined;
5931
6957
  /**
5932
6958
  * Maximum units allowed per interval.
5933
6959
  */
@@ -6907,71 +7933,257 @@ declare const PreviewUpdateIntervalRemoveItemEnum1: {
6907
7933
  readonly SemiAnnual: "semi_annual";
6908
7934
  readonly Year: "year";
6909
7935
  };
6910
- type PreviewUpdateIntervalRemoveItemEnum1 = ClosedEnum<typeof PreviewUpdateIntervalRemoveItemEnum1>;
7936
+ type PreviewUpdateIntervalRemoveItemEnum1 = ClosedEnum<typeof PreviewUpdateIntervalRemoveItemEnum1>;
7937
+ /**
7938
+ * Filter for matching plan items. All provided fields must match (AND).
7939
+ */
7940
+ type PreviewUpdatePlanItemFilter = {
7941
+ /**
7942
+ * Match items linked to this feature.
7943
+ */
7944
+ featureId?: string | undefined;
7945
+ /**
7946
+ * Match items with this billing method (prepaid or usage_based).
7947
+ */
7948
+ billingMethod?: PreviewUpdateRemoveItemBillingMethod | undefined;
7949
+ /**
7950
+ * Match items with this interval. Accepts either a BillingInterval (price-side) or a ResetInterval (reset-side, includes day/hour/minute) so price-less items keyed by reset.interval can be disambiguated.
7951
+ */
7952
+ interval?: PreviewUpdateIntervalRemoveItemEnum1 | PreviewUpdateIntervalRemoveItemEnum2 | undefined;
7953
+ /**
7954
+ * Match items with this interval_count. Disambiguates between items that share an interval but differ in count.
7955
+ */
7956
+ intervalCount?: number | undefined;
7957
+ };
7958
+ /**
7959
+ * Unit of time for the trial ('day', 'month', 'year').
7960
+ */
7961
+ declare const PreviewUpdateDurationType: {
7962
+ readonly Day: "day";
7963
+ readonly Month: "month";
7964
+ readonly Year: "year";
7965
+ };
7966
+ /**
7967
+ * Unit of time for the trial ('day', 'month', 'year').
7968
+ */
7969
+ type PreviewUpdateDurationType = ClosedEnum<typeof PreviewUpdateDurationType>;
7970
+ /**
7971
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
7972
+ */
7973
+ declare const PreviewUpdateOnEnd: {
7974
+ readonly Bill: "bill";
7975
+ readonly Revert: "revert";
7976
+ };
7977
+ /**
7978
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
7979
+ */
7980
+ type PreviewUpdateOnEnd = ClosedEnum<typeof PreviewUpdateOnEnd>;
7981
+ /**
7982
+ * Free trial configuration for a plan.
7983
+ */
7984
+ type PreviewUpdateFreeTrialParams = {
7985
+ /**
7986
+ * Number of duration_type periods the trial lasts.
7987
+ */
7988
+ durationLength: number;
7989
+ /**
7990
+ * Unit of time for the trial ('day', 'month', 'year').
7991
+ */
7992
+ durationType?: PreviewUpdateDurationType | undefined;
7993
+ /**
7994
+ * If true, payment method required to start trial. Customer is charged after trial ends.
7995
+ */
7996
+ cardRequired?: boolean | undefined;
7997
+ /**
7998
+ * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
7999
+ */
8000
+ onEnd?: PreviewUpdateOnEnd | undefined;
8001
+ };
8002
+ /**
8003
+ * The time interval for the purchase limit window.
8004
+ */
8005
+ declare const PreviewUpdatePurchaseLimitInterval: {
8006
+ readonly Hour: "hour";
8007
+ readonly Day: "day";
8008
+ readonly Week: "week";
8009
+ readonly Month: "month";
8010
+ };
8011
+ /**
8012
+ * The time interval for the purchase limit window.
8013
+ */
8014
+ type PreviewUpdatePurchaseLimitInterval = ClosedEnum<typeof PreviewUpdatePurchaseLimitInterval>;
8015
+ /**
8016
+ * Optional rate limit to cap how often auto top-ups occur.
8017
+ */
8018
+ type PreviewUpdatePurchaseLimit = {
8019
+ /**
8020
+ * The time interval for the purchase limit window.
8021
+ */
8022
+ interval: PreviewUpdatePurchaseLimitInterval;
8023
+ /**
8024
+ * Number of intervals in the purchase limit window.
8025
+ */
8026
+ intervalCount?: number | undefined;
8027
+ /**
8028
+ * Maximum number of auto top-ups allowed within the interval.
8029
+ */
8030
+ limit: number;
8031
+ };
8032
+ type PreviewUpdateAutoTopup = {
8033
+ /**
8034
+ * The ID of the feature (credit balance) to auto top-up.
8035
+ */
8036
+ featureId: string;
8037
+ /**
8038
+ * Whether auto top-up is enabled.
8039
+ */
8040
+ enabled?: boolean | undefined;
8041
+ /**
8042
+ * When the balance drops below this threshold, an auto top-up will be purchased.
8043
+ */
8044
+ threshold: number;
8045
+ /**
8046
+ * Amount of credits to add per auto top-up.
8047
+ */
8048
+ quantity: number;
8049
+ /**
8050
+ * Optional rate limit to cap how often auto top-ups occur.
8051
+ */
8052
+ purchaseLimit?: PreviewUpdatePurchaseLimit | undefined;
8053
+ /**
8054
+ * When true, auto top-up creates a send_invoice invoice instead of auto-charging.
8055
+ */
8056
+ invoiceMode?: boolean | undefined;
8057
+ };
6911
8058
  /**
6912
- * Filter for matching plan items. All provided fields must match (AND).
8059
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
6913
8060
  */
6914
- type PreviewUpdatePlanItemFilter = {
8061
+ declare const PreviewUpdateLimitType: {
8062
+ readonly Absolute: "absolute";
8063
+ readonly UsagePercentage: "usage_percentage";
8064
+ };
8065
+ /**
8066
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
8067
+ */
8068
+ type PreviewUpdateLimitType = ClosedEnum<typeof PreviewUpdateLimitType>;
8069
+ type PreviewUpdateSpendLimit = {
6915
8070
  /**
6916
- * Match items linked to this feature.
8071
+ * Optional feature ID this spend limit applies to.
6917
8072
  */
6918
8073
  featureId?: string | undefined;
6919
8074
  /**
6920
- * Match items with this billing method (prepaid or usage_based).
8075
+ * Whether the overage spend limit is enabled.
6921
8076
  */
6922
- billingMethod?: PreviewUpdateRemoveItemBillingMethod | undefined;
8077
+ enabled?: boolean | undefined;
6923
8078
  /**
6924
- * Match items with this interval. Accepts either a BillingInterval (price-side) or a ResetInterval (reset-side, includes day/hour/minute) so price-less items keyed by reset.interval can be disambiguated.
8079
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
6925
8080
  */
6926
- interval?: PreviewUpdateIntervalRemoveItemEnum1 | PreviewUpdateIntervalRemoveItemEnum2 | undefined;
8081
+ limitType?: PreviewUpdateLimitType | undefined;
6927
8082
  /**
6928
- * Match items with this interval_count. Disambiguates between items that share an interval but differ in count.
8083
+ * Overage cap for the feature: absolute units, or a percent (e.g. 120) when limit_type is usage_percentage.
6929
8084
  */
6930
- intervalCount?: number | undefined;
8085
+ overageLimit?: number | undefined;
6931
8086
  };
6932
8087
  /**
6933
- * Unit of time for the trial ('day', 'month', 'year').
8088
+ * Interval for the cap, aligned to the customer's billing cycle.
6934
8089
  */
6935
- declare const PreviewUpdateDurationType: {
8090
+ declare const PreviewUpdateUsageLimitInterval: {
6936
8091
  readonly Day: "day";
8092
+ readonly Week: "week";
6937
8093
  readonly Month: "month";
6938
8094
  readonly Year: "year";
6939
8095
  };
6940
8096
  /**
6941
- * Unit of time for the trial ('day', 'month', 'year').
8097
+ * Interval for the cap, aligned to the customer's billing cycle.
6942
8098
  */
6943
- type PreviewUpdateDurationType = ClosedEnum<typeof PreviewUpdateDurationType>;
8099
+ type PreviewUpdateUsageLimitInterval = ClosedEnum<typeof PreviewUpdateUsageLimitInterval>;
8100
+ type PreviewUpdateUsageLimit = {
8101
+ /**
8102
+ * The feature this usage limit applies to.
8103
+ */
8104
+ featureId: string;
8105
+ /**
8106
+ * Whether this usage limit is enabled.
8107
+ */
8108
+ enabled?: boolean | undefined;
8109
+ /**
8110
+ * Maximum units allowed per interval.
8111
+ */
8112
+ limit: number;
8113
+ /**
8114
+ * Interval for the cap, aligned to the customer's billing cycle.
8115
+ */
8116
+ interval: PreviewUpdateUsageLimitInterval;
8117
+ };
6944
8118
  /**
6945
- * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
8119
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
6946
8120
  */
6947
- declare const PreviewUpdateOnEnd: {
6948
- readonly Bill: "bill";
6949
- readonly Revert: "revert";
8121
+ declare const PreviewUpdateThresholdType: {
8122
+ readonly Usage: "usage";
8123
+ readonly UsagePercentage: "usage_percentage";
8124
+ readonly Remaining: "remaining";
8125
+ readonly RemainingPercentage: "remaining_percentage";
6950
8126
  };
6951
8127
  /**
6952
- * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
8128
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
6953
8129
  */
6954
- type PreviewUpdateOnEnd = ClosedEnum<typeof PreviewUpdateOnEnd>;
8130
+ type PreviewUpdateThresholdType = ClosedEnum<typeof PreviewUpdateThresholdType>;
8131
+ type PreviewUpdateUsageAlert = {
8132
+ /**
8133
+ * The feature ID this alert applies to.
8134
+ */
8135
+ featureId?: string | undefined;
8136
+ /**
8137
+ * Whether this usage alert is enabled.
8138
+ */
8139
+ enabled?: boolean | undefined;
8140
+ /**
8141
+ * The threshold value that triggers the alert. For usage or remaining, this is an absolute count. For usage_percentage or remaining_percentage, this is a percentage (0-100).
8142
+ */
8143
+ threshold: number;
8144
+ /**
8145
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
8146
+ */
8147
+ thresholdType: PreviewUpdateThresholdType;
8148
+ /**
8149
+ * Optional user-defined label to distinguish multiple alerts on the same feature.
8150
+ */
8151
+ name?: string | undefined;
8152
+ };
8153
+ type PreviewUpdateOverageAllowed = {
8154
+ /**
8155
+ * The feature ID this overage allowed control applies to.
8156
+ */
8157
+ featureId: string;
8158
+ /**
8159
+ * Whether overage is allowed for this feature.
8160
+ */
8161
+ enabled?: boolean | undefined;
8162
+ };
6955
8163
  /**
6956
- * Free trial configuration for a plan.
8164
+ * Override the plan's billing controls (auto top-ups, spend limits, usage limits, usage alerts, overage allowed) for this customer.
6957
8165
  */
6958
- type PreviewUpdateFreeTrialParams = {
8166
+ type PreviewUpdateBillingControls = {
6959
8167
  /**
6960
- * Number of duration_type periods the trial lasts.
8168
+ * List of auto top-up configurations per feature.
6961
8169
  */
6962
- durationLength: number;
8170
+ autoTopups?: Array<PreviewUpdateAutoTopup> | undefined;
6963
8171
  /**
6964
- * Unit of time for the trial ('day', 'month', 'year').
8172
+ * List of overage spend limits per feature (caps overage spend).
6965
8173
  */
6966
- durationType?: PreviewUpdateDurationType | undefined;
8174
+ spendLimits?: Array<PreviewUpdateSpendLimit> | undefined;
6967
8175
  /**
6968
- * If true, payment method required to start trial. Customer is charged after trial ends.
8176
+ * List of hard usage caps per feature (max units per interval).
6969
8177
  */
6970
- cardRequired?: boolean | undefined;
8178
+ usageLimits?: Array<PreviewUpdateUsageLimit> | undefined;
6971
8179
  /**
6972
- * Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
8180
+ * List of usage alert configurations per feature.
6973
8181
  */
6974
- onEnd?: PreviewUpdateOnEnd | undefined;
8182
+ usageAlerts?: Array<PreviewUpdateUsageAlert> | undefined;
8183
+ /**
8184
+ * List of overage allowed controls per feature. When enabled, usage can exceed balance.
8185
+ */
8186
+ overageAllowed?: Array<PreviewUpdateOverageAllowed> | undefined;
6975
8187
  };
6976
8188
  /**
6977
8189
  * Customize the plan to attach. Can override the price, items, free trial, or a combination.
@@ -6997,6 +8209,10 @@ type PreviewUpdateCustomize = {
6997
8209
  * Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely.
6998
8210
  */
6999
8211
  freeTrial?: PreviewUpdateFreeTrialParams | null | undefined;
8212
+ /**
8213
+ * Override the plan's billing controls (auto top-ups, spend limits, usage limits, usage alerts, overage allowed) for this customer.
8214
+ */
8215
+ billingControls?: PreviewUpdateBillingControls | undefined;
7000
8216
  };
7001
8217
  /**
7002
8218
  * Invoice mode creates a draft or open invoice and sends it to the customer, instead of charging their card immediately. This uses Stripe's send_invoice collection method.
@@ -8090,6 +9306,192 @@ type SetupPaymentFreeTrialParams = {
8090
9306
  */
8091
9307
  onEnd?: SetupPaymentOnEnd | undefined;
8092
9308
  };
9309
+ /**
9310
+ * The time interval for the purchase limit window.
9311
+ */
9312
+ declare const SetupPaymentPurchaseLimitInterval: {
9313
+ readonly Hour: "hour";
9314
+ readonly Day: "day";
9315
+ readonly Week: "week";
9316
+ readonly Month: "month";
9317
+ };
9318
+ /**
9319
+ * The time interval for the purchase limit window.
9320
+ */
9321
+ type SetupPaymentPurchaseLimitInterval = ClosedEnum<typeof SetupPaymentPurchaseLimitInterval>;
9322
+ /**
9323
+ * Optional rate limit to cap how often auto top-ups occur.
9324
+ */
9325
+ type SetupPaymentPurchaseLimit = {
9326
+ /**
9327
+ * The time interval for the purchase limit window.
9328
+ */
9329
+ interval: SetupPaymentPurchaseLimitInterval;
9330
+ /**
9331
+ * Number of intervals in the purchase limit window.
9332
+ */
9333
+ intervalCount?: number | undefined;
9334
+ /**
9335
+ * Maximum number of auto top-ups allowed within the interval.
9336
+ */
9337
+ limit: number;
9338
+ };
9339
+ type SetupPaymentAutoTopup = {
9340
+ /**
9341
+ * The ID of the feature (credit balance) to auto top-up.
9342
+ */
9343
+ featureId: string;
9344
+ /**
9345
+ * Whether auto top-up is enabled.
9346
+ */
9347
+ enabled?: boolean | undefined;
9348
+ /**
9349
+ * When the balance drops below this threshold, an auto top-up will be purchased.
9350
+ */
9351
+ threshold: number;
9352
+ /**
9353
+ * Amount of credits to add per auto top-up.
9354
+ */
9355
+ quantity: number;
9356
+ /**
9357
+ * Optional rate limit to cap how often auto top-ups occur.
9358
+ */
9359
+ purchaseLimit?: SetupPaymentPurchaseLimit | undefined;
9360
+ /**
9361
+ * When true, auto top-up creates a send_invoice invoice instead of auto-charging.
9362
+ */
9363
+ invoiceMode?: boolean | undefined;
9364
+ };
9365
+ /**
9366
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
9367
+ */
9368
+ declare const SetupPaymentLimitType: {
9369
+ readonly Absolute: "absolute";
9370
+ readonly UsagePercentage: "usage_percentage";
9371
+ };
9372
+ /**
9373
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
9374
+ */
9375
+ type SetupPaymentLimitType = ClosedEnum<typeof SetupPaymentLimitType>;
9376
+ type SetupPaymentSpendLimit = {
9377
+ /**
9378
+ * Optional feature ID this spend limit applies to.
9379
+ */
9380
+ featureId?: string | undefined;
9381
+ /**
9382
+ * Whether the overage spend limit is enabled.
9383
+ */
9384
+ enabled?: boolean | undefined;
9385
+ /**
9386
+ * How overage_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
9387
+ */
9388
+ limitType?: SetupPaymentLimitType | undefined;
9389
+ /**
9390
+ * Overage cap for the feature: absolute units, or a percent (e.g. 120) when limit_type is usage_percentage.
9391
+ */
9392
+ overageLimit?: number | undefined;
9393
+ };
9394
+ /**
9395
+ * Interval for the cap, aligned to the customer's billing cycle.
9396
+ */
9397
+ declare const SetupPaymentUsageLimitInterval: {
9398
+ readonly Day: "day";
9399
+ readonly Week: "week";
9400
+ readonly Month: "month";
9401
+ readonly Year: "year";
9402
+ };
9403
+ /**
9404
+ * Interval for the cap, aligned to the customer's billing cycle.
9405
+ */
9406
+ type SetupPaymentUsageLimitInterval = ClosedEnum<typeof SetupPaymentUsageLimitInterval>;
9407
+ type SetupPaymentUsageLimit = {
9408
+ /**
9409
+ * The feature this usage limit applies to.
9410
+ */
9411
+ featureId: string;
9412
+ /**
9413
+ * Whether this usage limit is enabled.
9414
+ */
9415
+ enabled?: boolean | undefined;
9416
+ /**
9417
+ * Maximum units allowed per interval.
9418
+ */
9419
+ limit: number;
9420
+ /**
9421
+ * Interval for the cap, aligned to the customer's billing cycle.
9422
+ */
9423
+ interval: SetupPaymentUsageLimitInterval;
9424
+ };
9425
+ /**
9426
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
9427
+ */
9428
+ declare const SetupPaymentThresholdType: {
9429
+ readonly Usage: "usage";
9430
+ readonly UsagePercentage: "usage_percentage";
9431
+ readonly Remaining: "remaining";
9432
+ readonly RemainingPercentage: "remaining_percentage";
9433
+ };
9434
+ /**
9435
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
9436
+ */
9437
+ type SetupPaymentThresholdType = ClosedEnum<typeof SetupPaymentThresholdType>;
9438
+ type SetupPaymentUsageAlert = {
9439
+ /**
9440
+ * The feature ID this alert applies to.
9441
+ */
9442
+ featureId?: string | undefined;
9443
+ /**
9444
+ * Whether this usage alert is enabled.
9445
+ */
9446
+ enabled?: boolean | undefined;
9447
+ /**
9448
+ * The threshold value that triggers the alert. For usage or remaining, this is an absolute count. For usage_percentage or remaining_percentage, this is a percentage (0-100).
9449
+ */
9450
+ threshold: number;
9451
+ /**
9452
+ * Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
9453
+ */
9454
+ thresholdType: SetupPaymentThresholdType;
9455
+ /**
9456
+ * Optional user-defined label to distinguish multiple alerts on the same feature.
9457
+ */
9458
+ name?: string | undefined;
9459
+ };
9460
+ type SetupPaymentOverageAllowed = {
9461
+ /**
9462
+ * The feature ID this overage allowed control applies to.
9463
+ */
9464
+ featureId: string;
9465
+ /**
9466
+ * Whether overage is allowed for this feature.
9467
+ */
9468
+ enabled?: boolean | undefined;
9469
+ };
9470
+ /**
9471
+ * Override the plan's billing controls (auto top-ups, spend limits, usage limits, usage alerts, overage allowed) for this customer.
9472
+ */
9473
+ type SetupPaymentBillingControls = {
9474
+ /**
9475
+ * List of auto top-up configurations per feature.
9476
+ */
9477
+ autoTopups?: Array<SetupPaymentAutoTopup> | undefined;
9478
+ /**
9479
+ * List of overage spend limits per feature (caps overage spend).
9480
+ */
9481
+ spendLimits?: Array<SetupPaymentSpendLimit> | undefined;
9482
+ /**
9483
+ * List of hard usage caps per feature (max units per interval).
9484
+ */
9485
+ usageLimits?: Array<SetupPaymentUsageLimit> | undefined;
9486
+ /**
9487
+ * List of usage alert configurations per feature.
9488
+ */
9489
+ usageAlerts?: Array<SetupPaymentUsageAlert> | undefined;
9490
+ /**
9491
+ * List of overage allowed controls per feature. When enabled, usage can exceed balance.
9492
+ */
9493
+ overageAllowed?: Array<SetupPaymentOverageAllowed> | undefined;
9494
+ };
8093
9495
  /**
8094
9496
  * Customize the plan to attach. Can override the price, items, free trial, or a combination.
8095
9497
  */
@@ -8114,6 +9516,10 @@ type SetupPaymentCustomize = {
8114
9516
  * Override the plan's default free trial. Pass an object to set a custom trial, or null to remove the trial entirely.
8115
9517
  */
8116
9518
  freeTrial?: SetupPaymentFreeTrialParams | null | undefined;
9519
+ /**
9520
+ * Override the plan's billing controls (auto top-ups, spend limits, usage limits, usage alerts, overage allowed) for this customer.
9521
+ */
9522
+ billingControls?: SetupPaymentBillingControls | undefined;
8117
9523
  };
8118
9524
  /**
8119
9525
  * How to handle proration when updating an existing subscription. 'prorate_immediately' charges/credits prorated amounts now, 'none' skips creating any charges.
@@ -8343,4 +9749,4 @@ type ClientSetupPaymentParams = Omit<SetupPaymentParams, ProtectedFields> & {
8343
9749
  /** Get entity params without protected fields (for frontend use) */
8344
9750
  type ClientGetEntityParams = Prettify<Omit<GetEntityParams, ProtectedFields>>;
8345
9751
 
8346
- export type { AttachResponse as A, BillingUpdateResponse as B, ClientAggregateEventsParams as C, GetEntityResponse as G, ListEventsResponse as L, MultiAttachResponse as M, OpenCustomerPortalResponse as O, ProtectedFields as P, RedeemReferralCodeResponse as R, SetupPaymentResponse as S, Total as T, ClientAttachParams as a, ClientCreateReferralCodeParams as b, ClientGetEntityParams as c, ClientGetOrCreateCustomerParams as d, ClientListEventsParams as e, ClientMultiAttachParams as f, ClientOpenCustomerPortalParams as g, ClientPreviewAttachParams as h, ClientPreviewMultiAttachParams as i, ClientPreviewUpdateSubscriptionParams as j, ClientRedeemReferralCodeParams as k, ClientSetupPaymentParams as l, ClientUpdateSubscriptionParams as m, ClientCheckParams as n, CheckResponse as o, PreviewAttachResponse as p, PreviewUpdateResponse as q, PreviewMultiAttachResponse as r, AggregateEventsResponse as s, AggregateEventsList as t, ListEventsList as u, ClientListPlansParams as v, CreateReferralCodeResponse as w };
9752
+ export type { AttachResponse as A, BillingUpdateResponse as B, ClientAggregateEventsParams as C, GetEntityResponse as G, ListEventsResponse as L, MultiAttachResponse as M, OpenCustomerPortalResponse as O, ProtectedFields as P, RedeemReferralCodeResponse as R, SetupPaymentResponse as S, Total as T, ClientAttachParams as a, ClientCreateReferralCodeParams as b, ClientGetEntityParams as c, ClientGetOrCreateCustomerParams as d, ClientListEventsParams as e, ClientMultiAttachParams as f, ClientOpenCustomerPortalParams as g, ClientPreviewAttachParams as h, ClientPreviewMultiAttachParams as i, ClientPreviewUpdateSubscriptionParams as j, ClientRedeemReferralCodeParams as k, ClientSetupPaymentParams as l, ClientUpdateSubscriptionParams as m, ClientCheckParams as n, CheckResponse as o, PreviewAttachResponse as p, PreviewUpdateResponse as q, PreviewMultiAttachResponse as r, CreateReferralCodeResponse as s, ClientListPlansParams as t, AggregateEventsResponse as u, AggregateEventsList as v, ListEventsList as w };