orb-billing 4.73.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +18 -30
  3. package/index.d.mts +148 -14
  4. package/index.d.ts +148 -14
  5. package/index.d.ts.map +1 -1
  6. package/index.js +0 -3
  7. package/index.js.map +1 -1
  8. package/index.mjs +3 -6
  9. package/index.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/alerts.d.ts +20 -88
  12. package/resources/alerts.d.ts.map +1 -1
  13. package/resources/alerts.js.map +1 -1
  14. package/resources/alerts.mjs.map +1 -1
  15. package/resources/beta/beta.d.ts +9 -7313
  16. package/resources/beta/beta.d.ts.map +1 -1
  17. package/resources/beta/beta.js.map +1 -1
  18. package/resources/beta/beta.mjs.map +1 -1
  19. package/resources/beta/external-plan-id.d.ts +7 -7074
  20. package/resources/beta/external-plan-id.d.ts.map +1 -1
  21. package/resources/beta/external-plan-id.js.map +1 -1
  22. package/resources/beta/external-plan-id.mjs.map +1 -1
  23. package/resources/credit-notes.d.ts +9 -163
  24. package/resources/credit-notes.d.ts.map +1 -1
  25. package/resources/credit-notes.js +3 -6
  26. package/resources/credit-notes.js.map +1 -1
  27. package/resources/credit-notes.mjs +2 -4
  28. package/resources/credit-notes.mjs.map +1 -1
  29. package/resources/customers/balance-transactions.d.ts +5 -32
  30. package/resources/customers/balance-transactions.d.ts.map +1 -1
  31. package/resources/customers/balance-transactions.js.map +1 -1
  32. package/resources/customers/balance-transactions.mjs.map +1 -1
  33. package/resources/customers/costs.d.ts +3 -81
  34. package/resources/customers/costs.d.ts.map +1 -1
  35. package/resources/customers/credits/credits.d.ts +4 -4
  36. package/resources/customers/credits/credits.d.ts.map +1 -1
  37. package/resources/customers/credits/credits.js.map +1 -1
  38. package/resources/customers/credits/credits.mjs.map +1 -1
  39. package/resources/customers/credits/index.d.ts +2 -2
  40. package/resources/customers/credits/index.d.ts.map +1 -1
  41. package/resources/customers/credits/index.js.map +1 -1
  42. package/resources/customers/credits/index.mjs.map +1 -1
  43. package/resources/customers/credits/ledger.d.ts +171 -962
  44. package/resources/customers/credits/ledger.d.ts.map +1 -1
  45. package/resources/customers/credits/ledger.js.map +1 -1
  46. package/resources/customers/credits/ledger.mjs.map +1 -1
  47. package/resources/customers/credits/top-ups.d.ts +37 -117
  48. package/resources/customers/credits/top-ups.d.ts.map +1 -1
  49. package/resources/customers/credits/top-ups.js.map +1 -1
  50. package/resources/customers/credits/top-ups.mjs.map +1 -1
  51. package/resources/customers/customers.d.ts +72 -678
  52. package/resources/customers/customers.d.ts.map +1 -1
  53. package/resources/customers/customers.js.map +1 -1
  54. package/resources/customers/customers.mjs.map +1 -1
  55. package/resources/customers/index.d.ts +1 -1
  56. package/resources/customers/index.d.ts.map +1 -1
  57. package/resources/customers/index.js.map +1 -1
  58. package/resources/customers/index.mjs.map +1 -1
  59. package/resources/events/events.d.ts +3 -3
  60. package/resources/events/events.d.ts.map +1 -1
  61. package/resources/index.d.ts +7 -7
  62. package/resources/index.d.ts.map +1 -1
  63. package/resources/index.js +1 -4
  64. package/resources/index.js.map +1 -1
  65. package/resources/index.mjs +3 -3
  66. package/resources/index.mjs.map +1 -1
  67. package/resources/invoice-line-items.d.ts +6 -395
  68. package/resources/invoice-line-items.d.ts.map +1 -1
  69. package/resources/invoice-line-items.js.map +1 -1
  70. package/resources/invoice-line-items.mjs.map +1 -1
  71. package/resources/invoices.d.ts +30 -1700
  72. package/resources/invoices.d.ts.map +1 -1
  73. package/resources/invoices.js +3 -6
  74. package/resources/invoices.js.map +1 -1
  75. package/resources/invoices.mjs +2 -4
  76. package/resources/invoices.mjs.map +1 -1
  77. package/resources/plans/plans.d.ts +7 -3801
  78. package/resources/plans/plans.d.ts.map +1 -1
  79. package/resources/plans/plans.js.map +1 -1
  80. package/resources/plans/plans.mjs.map +1 -1
  81. package/resources/prices/external-price-id.d.ts +3 -3
  82. package/resources/prices/external-price-id.d.ts.map +1 -1
  83. package/resources/prices/index.d.ts +1 -1
  84. package/resources/prices/index.d.ts.map +1 -1
  85. package/resources/prices/index.js +1 -2
  86. package/resources/prices/index.js.map +1 -1
  87. package/resources/prices/index.mjs +1 -1
  88. package/resources/prices/index.mjs.map +1 -1
  89. package/resources/prices/prices.d.ts +347 -9373
  90. package/resources/prices/prices.d.ts.map +1 -1
  91. package/resources/prices/prices.js +39 -20
  92. package/resources/prices/prices.js.map +1 -1
  93. package/resources/prices/prices.mjs +38 -18
  94. package/resources/prices/prices.mjs.map +1 -1
  95. package/resources/shared.d.ts +7269 -9
  96. package/resources/shared.d.ts.map +1 -1
  97. package/resources/shared.js +11 -0
  98. package/resources/shared.js.map +1 -1
  99. package/resources/shared.mjs +7 -1
  100. package/resources/shared.mjs.map +1 -1
  101. package/resources/subscription-changes.d.ts +138 -2158
  102. package/resources/subscription-changes.d.ts.map +1 -1
  103. package/resources/subscription-changes.js.map +1 -1
  104. package/resources/subscription-changes.mjs.map +1 -1
  105. package/resources/subscriptions.d.ts +2722 -26580
  106. package/resources/subscriptions.d.ts.map +1 -1
  107. package/resources/subscriptions.js +7 -1
  108. package/resources/subscriptions.js.map +1 -1
  109. package/resources/subscriptions.mjs +7 -1
  110. package/resources/subscriptions.mjs.map +1 -1
  111. package/src/index.ts +221 -40
  112. package/src/resources/alerts.ts +20 -94
  113. package/src/resources/beta/beta.ts +124 -8892
  114. package/src/resources/beta/external-plan-id.ts +118 -8593
  115. package/src/resources/credit-notes.ts +10 -217
  116. package/src/resources/customers/balance-transactions.ts +5 -36
  117. package/src/resources/customers/costs.ts +3 -101
  118. package/src/resources/customers/credits/credits.ts +18 -0
  119. package/src/resources/customers/credits/index.ts +9 -0
  120. package/src/resources/customers/credits/ledger.ts +212 -1435
  121. package/src/resources/customers/credits/top-ups.ts +41 -132
  122. package/src/resources/customers/customers.ts +162 -1454
  123. package/src/resources/customers/index.ts +8 -0
  124. package/src/resources/events/events.ts +3 -3
  125. package/src/resources/index.ts +43 -21
  126. package/src/resources/invoice-line-items.ts +10 -501
  127. package/src/resources/invoices.ts +60 -2394
  128. package/src/resources/plans/plans.ts +38 -4588
  129. package/src/resources/prices/external-price-id.ts +3 -3
  130. package/src/resources/prices/index.ts +2 -2
  131. package/src/resources/prices/prices.ts +501 -11811
  132. package/src/resources/shared.ts +9582 -22
  133. package/src/resources/subscription-changes.ts +171 -2670
  134. package/src/resources/subscriptions.ts +3175 -31993
  135. package/src/version.ts +1 -1
  136. package/version.d.ts +1 -1
  137. package/version.d.ts.map +1 -1
  138. package/version.js +1 -1
  139. package/version.js.map +1 -1
  140. package/version.mjs +1 -1
  141. package/version.mjs.map +1 -1
@@ -1,10 +1,8 @@
1
1
  import { APIResource } from "../resource.js";
2
2
  import * as Core from "../core.js";
3
- import * as CreditNotesAPI from "./credit-notes.js";
4
- import * as InvoicesAPI from "./invoices.js";
3
+ import * as Shared from "./shared.js";
5
4
  import * as CustomersAPI from "./customers/customers.js";
6
5
  import * as PlansAPI from "./plans/plans.js";
7
- import * as PricesAPI from "./prices/prices.js";
8
6
  export declare class SubscriptionChanges extends APIResource {
9
7
  /**
10
8
  * This endpoint returns a subscription change given an identifier.
@@ -32,6 +30,139 @@ export declare class SubscriptionChanges extends APIResource {
32
30
  */
33
31
  cancel(subscriptionChangeId: string, options?: Core.RequestOptions): Core.APIPromise<SubscriptionChangeCancelResponse>;
34
32
  }
33
+ export interface MutatedSubscription {
34
+ id: string;
35
+ /**
36
+ * The current plan phase that is active, only if the subscription's plan has
37
+ * phases.
38
+ */
39
+ active_plan_phase_order: number | null;
40
+ /**
41
+ * The adjustment intervals for this subscription sorted by the start_date of the
42
+ * adjustment interval.
43
+ */
44
+ adjustment_intervals: Array<Shared.AdjustmentInterval>;
45
+ /**
46
+ * Determines whether issued invoices for this subscription will automatically be
47
+ * charged with the saved payment method on the due date. This property defaults to
48
+ * the plan's behavior. If null, defaults to the customer's setting.
49
+ */
50
+ auto_collection: boolean | null;
51
+ billing_cycle_anchor_configuration: Shared.BillingCycleAnchorConfiguration;
52
+ /**
53
+ * The day of the month on which the billing cycle is anchored. If the maximum
54
+ * number of days in a month is greater than this value, the last day of the month
55
+ * is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing
56
+ * period begins on the 30th.
57
+ */
58
+ billing_cycle_day: number;
59
+ created_at: string;
60
+ /**
61
+ * The end of the current billing period. This is an exclusive timestamp, such that
62
+ * the instant returned is not part of the billing period. Set to null for
63
+ * subscriptions that are not currently active.
64
+ */
65
+ current_billing_period_end_date: string | null;
66
+ /**
67
+ * The start date of the current billing period. This is an inclusive timestamp;
68
+ * the instant returned is exactly the beginning of the billing period. Set to null
69
+ * if the subscription is not currently active.
70
+ */
71
+ current_billing_period_start_date: string | null;
72
+ /**
73
+ * A customer is a buyer of your products, and the other party to the billing
74
+ * relationship.
75
+ *
76
+ * In Orb, customers are assigned system generated identifiers automatically, but
77
+ * it's often desirable to have these match existing identifiers in your system. To
78
+ * avoid having to denormalize Orb ID information, you can pass in an
79
+ * `external_customer_id` with your own identifier. See
80
+ * [Customer ID Aliases](/events-and-metrics/customer-aliases) for further
81
+ * information about how these aliases work in Orb.
82
+ *
83
+ * In addition to having an identifier in your system, a customer may exist in a
84
+ * payment provider solution like Stripe. Use the `payment_provider_id` and the
85
+ * `payment_provider` enum field to express this mapping.
86
+ *
87
+ * A customer also has a timezone (from the standard
88
+ * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to
89
+ * your account's timezone. See [Timezone localization](/essentials/timezones) for
90
+ * information on what this timezone parameter influences within Orb.
91
+ */
92
+ customer: CustomersAPI.Customer;
93
+ /**
94
+ * Determines the default memo on this subscriptions' invoices. Note that if this
95
+ * is not provided, it is determined by the plan configuration.
96
+ */
97
+ default_invoice_memo: string | null;
98
+ /**
99
+ * @deprecated The discount intervals for this subscription sorted by the
100
+ * start_date.
101
+ */
102
+ discount_intervals: Array<Shared.AmountDiscountInterval | Shared.PercentageDiscountInterval | Shared.UsageDiscountInterval>;
103
+ /**
104
+ * The date Orb stops billing for this subscription.
105
+ */
106
+ end_date: string | null;
107
+ fixed_fee_quantity_schedule: Array<Shared.FixedFeeQuantityScheduleEntry>;
108
+ invoicing_threshold: string | null;
109
+ /**
110
+ * @deprecated The maximum intervals for this subscription sorted by the
111
+ * start_date.
112
+ */
113
+ maximum_intervals: Array<Shared.MaximumInterval>;
114
+ /**
115
+ * User specified key-value pairs for the resource. If not present, this defaults
116
+ * to an empty dictionary. Individual keys can be removed by setting the value to
117
+ * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
118
+ * `null`.
119
+ */
120
+ metadata: Record<string, string>;
121
+ /**
122
+ * @deprecated The minimum intervals for this subscription sorted by the
123
+ * start_date.
124
+ */
125
+ minimum_intervals: Array<Shared.MinimumInterval>;
126
+ /**
127
+ * The name of the subscription.
128
+ */
129
+ name: string;
130
+ /**
131
+ * Determines the difference between the invoice issue date for subscription
132
+ * invoices as the date that they are due. A value of `0` here represents that the
133
+ * invoice is due on issue, whereas a value of `30` represents that the customer
134
+ * has a month to pay the invoice.
135
+ */
136
+ net_terms: number;
137
+ /**
138
+ * A pending subscription change if one exists on this subscription.
139
+ */
140
+ pending_subscription_change: Shared.SubscriptionChangeMinified | null;
141
+ /**
142
+ * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
143
+ * subscribed to by a customer. Plans define the billing behavior of the
144
+ * subscription. You can see more about how to configure prices in the
145
+ * [Price resource](/reference/price).
146
+ */
147
+ plan: PlansAPI.Plan | null;
148
+ /**
149
+ * The price intervals for this subscription.
150
+ */
151
+ price_intervals: Array<Shared.PriceInterval>;
152
+ redeemed_coupon: Shared.CouponRedemption | null;
153
+ /**
154
+ * The date Orb starts billing for this subscription.
155
+ */
156
+ start_date: string;
157
+ status: 'active' | 'ended' | 'upcoming';
158
+ trial_info: Shared.SubscriptionTrialInfo;
159
+ /**
160
+ * The resources that were changed as part of this operation. Only present when
161
+ * fetched through the subscription changes API or if the
162
+ * `include_changed_resources` parameter was passed in the request.
163
+ */
164
+ changed_resources?: Shared.ChangedSubscriptionResources | null;
165
+ }
35
166
  /**
36
167
  * A subscription change represents a desired new subscription / pending change to
37
168
  * an existing subscription. It is a way to first preview the effects on the
@@ -45,7 +176,7 @@ export interface SubscriptionChangeRetrieveResponse {
45
176
  */
46
177
  expiration_time: string;
47
178
  status: 'pending' | 'applied' | 'cancelled';
48
- subscription: SubscriptionChangeRetrieveResponse.Subscription | null;
179
+ subscription: MutatedSubscription | null;
49
180
  /**
50
181
  * When this change was applied.
51
182
  */
@@ -55,723 +186,6 @@ export interface SubscriptionChangeRetrieveResponse {
55
186
  */
56
187
  cancelled_at?: string | null;
57
188
  }
58
- export declare namespace SubscriptionChangeRetrieveResponse {
59
- interface Subscription {
60
- id: string;
61
- /**
62
- * The current plan phase that is active, only if the subscription's plan has
63
- * phases.
64
- */
65
- active_plan_phase_order: number | null;
66
- /**
67
- * The adjustment intervals for this subscription sorted by the start_date of the
68
- * adjustment interval.
69
- */
70
- adjustment_intervals: Array<Subscription.AdjustmentInterval>;
71
- /**
72
- * Determines whether issued invoices for this subscription will automatically be
73
- * charged with the saved payment method on the due date. This property defaults to
74
- * the plan's behavior. If null, defaults to the customer's setting.
75
- */
76
- auto_collection: boolean | null;
77
- billing_cycle_anchor_configuration: Subscription.BillingCycleAnchorConfiguration;
78
- /**
79
- * The day of the month on which the billing cycle is anchored. If the maximum
80
- * number of days in a month is greater than this value, the last day of the month
81
- * is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing
82
- * period begins on the 30th.
83
- */
84
- billing_cycle_day: number;
85
- created_at: string;
86
- /**
87
- * The end of the current billing period. This is an exclusive timestamp, such that
88
- * the instant returned is not part of the billing period. Set to null for
89
- * subscriptions that are not currently active.
90
- */
91
- current_billing_period_end_date: string | null;
92
- /**
93
- * The start date of the current billing period. This is an inclusive timestamp;
94
- * the instant returned is exactly the beginning of the billing period. Set to null
95
- * if the subscription is not currently active.
96
- */
97
- current_billing_period_start_date: string | null;
98
- /**
99
- * A customer is a buyer of your products, and the other party to the billing
100
- * relationship.
101
- *
102
- * In Orb, customers are assigned system generated identifiers automatically, but
103
- * it's often desirable to have these match existing identifiers in your system. To
104
- * avoid having to denormalize Orb ID information, you can pass in an
105
- * `external_customer_id` with your own identifier. See
106
- * [Customer ID Aliases](/events-and-metrics/customer-aliases) for further
107
- * information about how these aliases work in Orb.
108
- *
109
- * In addition to having an identifier in your system, a customer may exist in a
110
- * payment provider solution like Stripe. Use the `payment_provider_id` and the
111
- * `payment_provider` enum field to express this mapping.
112
- *
113
- * A customer also has a timezone (from the standard
114
- * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to
115
- * your account's timezone. See [Timezone localization](/essentials/timezones) for
116
- * information on what this timezone parameter influences within Orb.
117
- */
118
- customer: CustomersAPI.Customer;
119
- /**
120
- * Determines the default memo on this subscriptions' invoices. Note that if this
121
- * is not provided, it is determined by the plan configuration.
122
- */
123
- default_invoice_memo: string | null;
124
- /**
125
- * @deprecated The discount intervals for this subscription sorted by the
126
- * start_date.
127
- */
128
- discount_intervals: Array<Subscription.AmountDiscountInterval | Subscription.PercentageDiscountInterval | Subscription.UsageDiscountInterval>;
129
- /**
130
- * The date Orb stops billing for this subscription.
131
- */
132
- end_date: string | null;
133
- fixed_fee_quantity_schedule: Array<Subscription.FixedFeeQuantitySchedule>;
134
- invoicing_threshold: string | null;
135
- /**
136
- * @deprecated The maximum intervals for this subscription sorted by the
137
- * start_date.
138
- */
139
- maximum_intervals: Array<Subscription.MaximumInterval>;
140
- /**
141
- * User specified key-value pairs for the resource. If not present, this defaults
142
- * to an empty dictionary. Individual keys can be removed by setting the value to
143
- * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
144
- * `null`.
145
- */
146
- metadata: Record<string, string>;
147
- /**
148
- * @deprecated The minimum intervals for this subscription sorted by the
149
- * start_date.
150
- */
151
- minimum_intervals: Array<Subscription.MinimumInterval>;
152
- /**
153
- * The name of the subscription.
154
- */
155
- name: string;
156
- /**
157
- * Determines the difference between the invoice issue date for subscription
158
- * invoices as the date that they are due. A value of `0` here represents that the
159
- * invoice is due on issue, whereas a value of `30` represents that the customer
160
- * has a month to pay the invoice.
161
- */
162
- net_terms: number;
163
- /**
164
- * A pending subscription change if one exists on this subscription.
165
- */
166
- pending_subscription_change: Subscription.PendingSubscriptionChange | null;
167
- /**
168
- * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
169
- * subscribed to by a customer. Plans define the billing behavior of the
170
- * subscription. You can see more about how to configure prices in the
171
- * [Price resource](/reference/price).
172
- */
173
- plan: PlansAPI.Plan | null;
174
- /**
175
- * The price intervals for this subscription.
176
- */
177
- price_intervals: Array<Subscription.PriceInterval>;
178
- redeemed_coupon: Subscription.RedeemedCoupon | null;
179
- /**
180
- * The date Orb starts billing for this subscription.
181
- */
182
- start_date: string;
183
- status: 'active' | 'ended' | 'upcoming';
184
- trial_info: Subscription.TrialInfo;
185
- /**
186
- * The resources that were changed as part of this operation. Only present when
187
- * fetched through the subscription changes API or if the
188
- * `include_changed_resources` parameter was passed in the request.
189
- */
190
- changed_resources?: Subscription.ChangedResources | null;
191
- }
192
- namespace Subscription {
193
- interface AdjustmentInterval {
194
- id: string;
195
- adjustment: AdjustmentInterval.PlanPhaseUsageDiscountAdjustment | AdjustmentInterval.PlanPhaseAmountDiscountAdjustment | AdjustmentInterval.PlanPhasePercentageDiscountAdjustment | AdjustmentInterval.PlanPhaseMinimumAdjustment | AdjustmentInterval.PlanPhaseMaximumAdjustment;
196
- /**
197
- * The price interval IDs that this adjustment applies to.
198
- */
199
- applies_to_price_interval_ids: Array<string>;
200
- /**
201
- * The end date of the adjustment interval.
202
- */
203
- end_date: string | null;
204
- /**
205
- * The start date of the adjustment interval.
206
- */
207
- start_date: string;
208
- }
209
- namespace AdjustmentInterval {
210
- interface PlanPhaseUsageDiscountAdjustment {
211
- id: string;
212
- adjustment_type: 'usage_discount';
213
- /**
214
- * @deprecated The price IDs that this adjustment applies to.
215
- */
216
- applies_to_price_ids: Array<string>;
217
- /**
218
- * The filters that determine which prices to apply this adjustment to.
219
- */
220
- filters: Array<PlanPhaseUsageDiscountAdjustment.Filter>;
221
- /**
222
- * True for adjustments that apply to an entire invocice, false for adjustments
223
- * that apply to only one price.
224
- */
225
- is_invoice_level: boolean;
226
- /**
227
- * The plan phase in which this adjustment is active.
228
- */
229
- plan_phase_order: number | null;
230
- /**
231
- * The reason for the adjustment.
232
- */
233
- reason: string | null;
234
- /**
235
- * The number of usage units by which to discount the price this adjustment applies
236
- * to in a given billing period.
237
- */
238
- usage_discount: number;
239
- }
240
- namespace PlanPhaseUsageDiscountAdjustment {
241
- interface Filter {
242
- /**
243
- * The property of the price to filter on.
244
- */
245
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
246
- /**
247
- * Should prices that match the filter be included or excluded.
248
- */
249
- operator: 'includes' | 'excludes';
250
- /**
251
- * The IDs or values that match this filter.
252
- */
253
- values: Array<string>;
254
- }
255
- }
256
- interface PlanPhaseAmountDiscountAdjustment {
257
- id: string;
258
- adjustment_type: 'amount_discount';
259
- /**
260
- * The amount by which to discount the prices this adjustment applies to in a given
261
- * billing period.
262
- */
263
- amount_discount: string;
264
- /**
265
- * @deprecated The price IDs that this adjustment applies to.
266
- */
267
- applies_to_price_ids: Array<string>;
268
- /**
269
- * The filters that determine which prices to apply this adjustment to.
270
- */
271
- filters: Array<PlanPhaseAmountDiscountAdjustment.Filter>;
272
- /**
273
- * True for adjustments that apply to an entire invocice, false for adjustments
274
- * that apply to only one price.
275
- */
276
- is_invoice_level: boolean;
277
- /**
278
- * The plan phase in which this adjustment is active.
279
- */
280
- plan_phase_order: number | null;
281
- /**
282
- * The reason for the adjustment.
283
- */
284
- reason: string | null;
285
- }
286
- namespace PlanPhaseAmountDiscountAdjustment {
287
- interface Filter {
288
- /**
289
- * The property of the price to filter on.
290
- */
291
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
292
- /**
293
- * Should prices that match the filter be included or excluded.
294
- */
295
- operator: 'includes' | 'excludes';
296
- /**
297
- * The IDs or values that match this filter.
298
- */
299
- values: Array<string>;
300
- }
301
- }
302
- interface PlanPhasePercentageDiscountAdjustment {
303
- id: string;
304
- adjustment_type: 'percentage_discount';
305
- /**
306
- * @deprecated The price IDs that this adjustment applies to.
307
- */
308
- applies_to_price_ids: Array<string>;
309
- /**
310
- * The filters that determine which prices to apply this adjustment to.
311
- */
312
- filters: Array<PlanPhasePercentageDiscountAdjustment.Filter>;
313
- /**
314
- * True for adjustments that apply to an entire invocice, false for adjustments
315
- * that apply to only one price.
316
- */
317
- is_invoice_level: boolean;
318
- /**
319
- * The percentage (as a value between 0 and 1) by which to discount the price
320
- * intervals this adjustment applies to in a given billing period.
321
- */
322
- percentage_discount: number;
323
- /**
324
- * The plan phase in which this adjustment is active.
325
- */
326
- plan_phase_order: number | null;
327
- /**
328
- * The reason for the adjustment.
329
- */
330
- reason: string | null;
331
- }
332
- namespace PlanPhasePercentageDiscountAdjustment {
333
- interface Filter {
334
- /**
335
- * The property of the price to filter on.
336
- */
337
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
338
- /**
339
- * Should prices that match the filter be included or excluded.
340
- */
341
- operator: 'includes' | 'excludes';
342
- /**
343
- * The IDs or values that match this filter.
344
- */
345
- values: Array<string>;
346
- }
347
- }
348
- interface PlanPhaseMinimumAdjustment {
349
- id: string;
350
- adjustment_type: 'minimum';
351
- /**
352
- * @deprecated The price IDs that this adjustment applies to.
353
- */
354
- applies_to_price_ids: Array<string>;
355
- /**
356
- * The filters that determine which prices to apply this adjustment to.
357
- */
358
- filters: Array<PlanPhaseMinimumAdjustment.Filter>;
359
- /**
360
- * True for adjustments that apply to an entire invocice, false for adjustments
361
- * that apply to only one price.
362
- */
363
- is_invoice_level: boolean;
364
- /**
365
- * The item ID that revenue from this minimum will be attributed to.
366
- */
367
- item_id: string;
368
- /**
369
- * The minimum amount to charge in a given billing period for the prices this
370
- * adjustment applies to.
371
- */
372
- minimum_amount: string;
373
- /**
374
- * The plan phase in which this adjustment is active.
375
- */
376
- plan_phase_order: number | null;
377
- /**
378
- * The reason for the adjustment.
379
- */
380
- reason: string | null;
381
- }
382
- namespace PlanPhaseMinimumAdjustment {
383
- interface Filter {
384
- /**
385
- * The property of the price to filter on.
386
- */
387
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
388
- /**
389
- * Should prices that match the filter be included or excluded.
390
- */
391
- operator: 'includes' | 'excludes';
392
- /**
393
- * The IDs or values that match this filter.
394
- */
395
- values: Array<string>;
396
- }
397
- }
398
- interface PlanPhaseMaximumAdjustment {
399
- id: string;
400
- adjustment_type: 'maximum';
401
- /**
402
- * @deprecated The price IDs that this adjustment applies to.
403
- */
404
- applies_to_price_ids: Array<string>;
405
- /**
406
- * The filters that determine which prices to apply this adjustment to.
407
- */
408
- filters: Array<PlanPhaseMaximumAdjustment.Filter>;
409
- /**
410
- * True for adjustments that apply to an entire invocice, false for adjustments
411
- * that apply to only one price.
412
- */
413
- is_invoice_level: boolean;
414
- /**
415
- * The maximum amount to charge in a given billing period for the prices this
416
- * adjustment applies to.
417
- */
418
- maximum_amount: string;
419
- /**
420
- * The plan phase in which this adjustment is active.
421
- */
422
- plan_phase_order: number | null;
423
- /**
424
- * The reason for the adjustment.
425
- */
426
- reason: string | null;
427
- }
428
- namespace PlanPhaseMaximumAdjustment {
429
- interface Filter {
430
- /**
431
- * The property of the price to filter on.
432
- */
433
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
434
- /**
435
- * Should prices that match the filter be included or excluded.
436
- */
437
- operator: 'includes' | 'excludes';
438
- /**
439
- * The IDs or values that match this filter.
440
- */
441
- values: Array<string>;
442
- }
443
- }
444
- }
445
- interface BillingCycleAnchorConfiguration {
446
- /**
447
- * The day of the month on which the billing cycle is anchored. If the maximum
448
- * number of days in a month is greater than this value, the last day of the month
449
- * is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing
450
- * period begins on the 30th.
451
- */
452
- day: number;
453
- /**
454
- * The month on which the billing cycle is anchored (e.g. a quarterly price
455
- * anchored in February would have cycles starting February, May, August, and
456
- * November).
457
- */
458
- month?: number | null;
459
- /**
460
- * The year on which the billing cycle is anchored (e.g. a 2 year billing cycle
461
- * anchored on 2021 would have cycles starting on 2021, 2023, 2025, etc.).
462
- */
463
- year?: number | null;
464
- }
465
- interface AmountDiscountInterval {
466
- /**
467
- * Only available if discount_type is `amount`.
468
- */
469
- amount_discount: string;
470
- /**
471
- * The price interval ids that this discount interval applies to.
472
- */
473
- applies_to_price_interval_ids: Array<string>;
474
- discount_type: 'amount';
475
- /**
476
- * The end date of the discount interval.
477
- */
478
- end_date: string | null;
479
- /**
480
- * The filters that determine which prices this discount interval applies to.
481
- */
482
- filters: Array<AmountDiscountInterval.Filter>;
483
- /**
484
- * The start date of the discount interval.
485
- */
486
- start_date: string;
487
- }
488
- namespace AmountDiscountInterval {
489
- interface Filter {
490
- /**
491
- * The property of the price to filter on.
492
- */
493
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
494
- /**
495
- * Should prices that match the filter be included or excluded.
496
- */
497
- operator: 'includes' | 'excludes';
498
- /**
499
- * The IDs or values that match this filter.
500
- */
501
- values: Array<string>;
502
- }
503
- }
504
- interface PercentageDiscountInterval {
505
- /**
506
- * The price interval ids that this discount interval applies to.
507
- */
508
- applies_to_price_interval_ids: Array<string>;
509
- discount_type: 'percentage';
510
- /**
511
- * The end date of the discount interval.
512
- */
513
- end_date: string | null;
514
- /**
515
- * The filters that determine which prices this discount interval applies to.
516
- */
517
- filters: Array<PercentageDiscountInterval.Filter>;
518
- /**
519
- * Only available if discount_type is `percentage`.This is a number between 0
520
- * and 1.
521
- */
522
- percentage_discount: number;
523
- /**
524
- * The start date of the discount interval.
525
- */
526
- start_date: string;
527
- }
528
- namespace PercentageDiscountInterval {
529
- interface Filter {
530
- /**
531
- * The property of the price to filter on.
532
- */
533
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
534
- /**
535
- * Should prices that match the filter be included or excluded.
536
- */
537
- operator: 'includes' | 'excludes';
538
- /**
539
- * The IDs or values that match this filter.
540
- */
541
- values: Array<string>;
542
- }
543
- }
544
- interface UsageDiscountInterval {
545
- /**
546
- * The price interval ids that this discount interval applies to.
547
- */
548
- applies_to_price_interval_ids: Array<string>;
549
- discount_type: 'usage';
550
- /**
551
- * The end date of the discount interval.
552
- */
553
- end_date: string | null;
554
- /**
555
- * The filters that determine which prices this discount interval applies to.
556
- */
557
- filters: Array<UsageDiscountInterval.Filter>;
558
- /**
559
- * The start date of the discount interval.
560
- */
561
- start_date: string;
562
- /**
563
- * Only available if discount_type is `usage`. Number of usage units that this
564
- * discount is for
565
- */
566
- usage_discount: number;
567
- }
568
- namespace UsageDiscountInterval {
569
- interface Filter {
570
- /**
571
- * The property of the price to filter on.
572
- */
573
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
574
- /**
575
- * Should prices that match the filter be included or excluded.
576
- */
577
- operator: 'includes' | 'excludes';
578
- /**
579
- * The IDs or values that match this filter.
580
- */
581
- values: Array<string>;
582
- }
583
- }
584
- interface FixedFeeQuantitySchedule {
585
- end_date: string | null;
586
- price_id: string;
587
- quantity: number;
588
- start_date: string;
589
- }
590
- interface MaximumInterval {
591
- /**
592
- * The price interval ids that this maximum interval applies to.
593
- */
594
- applies_to_price_interval_ids: Array<string>;
595
- /**
596
- * The end date of the maximum interval.
597
- */
598
- end_date: string | null;
599
- /**
600
- * The filters that determine which prices this maximum interval applies to.
601
- */
602
- filters: Array<MaximumInterval.Filter>;
603
- /**
604
- * The maximum amount to charge in a given billing period for the price intervals
605
- * this transform applies to.
606
- */
607
- maximum_amount: string;
608
- /**
609
- * The start date of the maximum interval.
610
- */
611
- start_date: string;
612
- }
613
- namespace MaximumInterval {
614
- interface Filter {
615
- /**
616
- * The property of the price to filter on.
617
- */
618
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
619
- /**
620
- * Should prices that match the filter be included or excluded.
621
- */
622
- operator: 'includes' | 'excludes';
623
- /**
624
- * The IDs or values that match this filter.
625
- */
626
- values: Array<string>;
627
- }
628
- }
629
- interface MinimumInterval {
630
- /**
631
- * The price interval ids that this minimum interval applies to.
632
- */
633
- applies_to_price_interval_ids: Array<string>;
634
- /**
635
- * The end date of the minimum interval.
636
- */
637
- end_date: string | null;
638
- /**
639
- * The filters that determine which prices this minimum interval applies to.
640
- */
641
- filters: Array<MinimumInterval.Filter>;
642
- /**
643
- * The minimum amount to charge in a given billing period for the price intervals
644
- * this minimum applies to.
645
- */
646
- minimum_amount: string;
647
- /**
648
- * The start date of the minimum interval.
649
- */
650
- start_date: string;
651
- }
652
- namespace MinimumInterval {
653
- interface Filter {
654
- /**
655
- * The property of the price to filter on.
656
- */
657
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
658
- /**
659
- * Should prices that match the filter be included or excluded.
660
- */
661
- operator: 'includes' | 'excludes';
662
- /**
663
- * The IDs or values that match this filter.
664
- */
665
- values: Array<string>;
666
- }
667
- }
668
- /**
669
- * A pending subscription change if one exists on this subscription.
670
- */
671
- interface PendingSubscriptionChange {
672
- id: string;
673
- }
674
- /**
675
- * The Price Interval resource represents a period of time for which a price will
676
- * bill on a subscription. A subscription’s price intervals define its billing
677
- * behavior.
678
- */
679
- interface PriceInterval {
680
- id: string;
681
- /**
682
- * The day of the month that Orb bills for this price
683
- */
684
- billing_cycle_day: number;
685
- /**
686
- * The end of the current billing period. This is an exclusive timestamp, such that
687
- * the instant returned is exactly the end of the billing period. Set to null if
688
- * this price interval is not currently active.
689
- */
690
- current_billing_period_end_date: string | null;
691
- /**
692
- * The start date of the current billing period. This is an inclusive timestamp;
693
- * the instant returned is exactly the beginning of the billing period. Set to null
694
- * if this price interval is not currently active.
695
- */
696
- current_billing_period_start_date: string | null;
697
- /**
698
- * The end date of the price interval. This is the date that Orb stops billing for
699
- * this price.
700
- */
701
- end_date: string | null;
702
- /**
703
- * An additional filter to apply to usage queries.
704
- */
705
- filter: string | null;
706
- /**
707
- * The fixed fee quantity transitions for this price interval. This is only
708
- * relevant for fixed fees.
709
- */
710
- fixed_fee_quantity_transitions: Array<PriceInterval.FixedFeeQuantityTransition> | null;
711
- /**
712
- * The Price resource represents a price that can be billed on a subscription,
713
- * resulting in a charge on an invoice in the form of an invoice line item. Prices
714
- * take a quantity and determine an amount to bill.
715
- *
716
- * Orb supports a few different pricing models out of the box. Each of these models
717
- * is serialized differently in a given Price object. The model_type field
718
- * determines the key for the configuration object that is present.
719
- *
720
- * For more on the types of prices, see
721
- * [the core concepts documentation](/core-concepts#plan-and-price)
722
- */
723
- price: PricesAPI.Price;
724
- /**
725
- * The start date of the price interval. This is the date that Orb starts billing
726
- * for this price.
727
- */
728
- start_date: string;
729
- /**
730
- * A list of customer IDs whose usage events will be aggregated and billed under
731
- * this price interval.
732
- */
733
- usage_customer_ids: Array<string> | null;
734
- }
735
- namespace PriceInterval {
736
- interface FixedFeeQuantityTransition {
737
- effective_date: string;
738
- price_id: string;
739
- quantity: number;
740
- }
741
- }
742
- interface RedeemedCoupon {
743
- coupon_id: string;
744
- end_date: string | null;
745
- start_date: string;
746
- }
747
- interface TrialInfo {
748
- end_date: string | null;
749
- }
750
- /**
751
- * The resources that were changed as part of this operation. Only present when
752
- * fetched through the subscription changes API or if the
753
- * `include_changed_resources` parameter was passed in the request.
754
- */
755
- interface ChangedResources {
756
- /**
757
- * The credit notes that were created as part of this operation.
758
- */
759
- created_credit_notes: Array<CreditNotesAPI.CreditNote>;
760
- /**
761
- * The invoices that were created as part of this operation.
762
- */
763
- created_invoices: Array<InvoicesAPI.Invoice>;
764
- /**
765
- * The credit notes that were voided as part of this operation.
766
- */
767
- voided_credit_notes: Array<CreditNotesAPI.CreditNote>;
768
- /**
769
- * The invoices that were voided as part of this operation.
770
- */
771
- voided_invoices: Array<InvoicesAPI.Invoice>;
772
- }
773
- }
774
- }
775
189
  /**
776
190
  * A subscription change represents a desired new subscription / pending change to
777
191
  * an existing subscription. It is a way to first preview the effects on the
@@ -785,7 +199,7 @@ export interface SubscriptionChangeApplyResponse {
785
199
  */
786
200
  expiration_time: string;
787
201
  status: 'pending' | 'applied' | 'cancelled';
788
- subscription: SubscriptionChangeApplyResponse.Subscription | null;
202
+ subscription: MutatedSubscription | null;
789
203
  /**
790
204
  * When this change was applied.
791
205
  */
@@ -795,723 +209,6 @@ export interface SubscriptionChangeApplyResponse {
795
209
  */
796
210
  cancelled_at?: string | null;
797
211
  }
798
- export declare namespace SubscriptionChangeApplyResponse {
799
- interface Subscription {
800
- id: string;
801
- /**
802
- * The current plan phase that is active, only if the subscription's plan has
803
- * phases.
804
- */
805
- active_plan_phase_order: number | null;
806
- /**
807
- * The adjustment intervals for this subscription sorted by the start_date of the
808
- * adjustment interval.
809
- */
810
- adjustment_intervals: Array<Subscription.AdjustmentInterval>;
811
- /**
812
- * Determines whether issued invoices for this subscription will automatically be
813
- * charged with the saved payment method on the due date. This property defaults to
814
- * the plan's behavior. If null, defaults to the customer's setting.
815
- */
816
- auto_collection: boolean | null;
817
- billing_cycle_anchor_configuration: Subscription.BillingCycleAnchorConfiguration;
818
- /**
819
- * The day of the month on which the billing cycle is anchored. If the maximum
820
- * number of days in a month is greater than this value, the last day of the month
821
- * is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing
822
- * period begins on the 30th.
823
- */
824
- billing_cycle_day: number;
825
- created_at: string;
826
- /**
827
- * The end of the current billing period. This is an exclusive timestamp, such that
828
- * the instant returned is not part of the billing period. Set to null for
829
- * subscriptions that are not currently active.
830
- */
831
- current_billing_period_end_date: string | null;
832
- /**
833
- * The start date of the current billing period. This is an inclusive timestamp;
834
- * the instant returned is exactly the beginning of the billing period. Set to null
835
- * if the subscription is not currently active.
836
- */
837
- current_billing_period_start_date: string | null;
838
- /**
839
- * A customer is a buyer of your products, and the other party to the billing
840
- * relationship.
841
- *
842
- * In Orb, customers are assigned system generated identifiers automatically, but
843
- * it's often desirable to have these match existing identifiers in your system. To
844
- * avoid having to denormalize Orb ID information, you can pass in an
845
- * `external_customer_id` with your own identifier. See
846
- * [Customer ID Aliases](/events-and-metrics/customer-aliases) for further
847
- * information about how these aliases work in Orb.
848
- *
849
- * In addition to having an identifier in your system, a customer may exist in a
850
- * payment provider solution like Stripe. Use the `payment_provider_id` and the
851
- * `payment_provider` enum field to express this mapping.
852
- *
853
- * A customer also has a timezone (from the standard
854
- * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to
855
- * your account's timezone. See [Timezone localization](/essentials/timezones) for
856
- * information on what this timezone parameter influences within Orb.
857
- */
858
- customer: CustomersAPI.Customer;
859
- /**
860
- * Determines the default memo on this subscriptions' invoices. Note that if this
861
- * is not provided, it is determined by the plan configuration.
862
- */
863
- default_invoice_memo: string | null;
864
- /**
865
- * @deprecated The discount intervals for this subscription sorted by the
866
- * start_date.
867
- */
868
- discount_intervals: Array<Subscription.AmountDiscountInterval | Subscription.PercentageDiscountInterval | Subscription.UsageDiscountInterval>;
869
- /**
870
- * The date Orb stops billing for this subscription.
871
- */
872
- end_date: string | null;
873
- fixed_fee_quantity_schedule: Array<Subscription.FixedFeeQuantitySchedule>;
874
- invoicing_threshold: string | null;
875
- /**
876
- * @deprecated The maximum intervals for this subscription sorted by the
877
- * start_date.
878
- */
879
- maximum_intervals: Array<Subscription.MaximumInterval>;
880
- /**
881
- * User specified key-value pairs for the resource. If not present, this defaults
882
- * to an empty dictionary. Individual keys can be removed by setting the value to
883
- * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
884
- * `null`.
885
- */
886
- metadata: Record<string, string>;
887
- /**
888
- * @deprecated The minimum intervals for this subscription sorted by the
889
- * start_date.
890
- */
891
- minimum_intervals: Array<Subscription.MinimumInterval>;
892
- /**
893
- * The name of the subscription.
894
- */
895
- name: string;
896
- /**
897
- * Determines the difference between the invoice issue date for subscription
898
- * invoices as the date that they are due. A value of `0` here represents that the
899
- * invoice is due on issue, whereas a value of `30` represents that the customer
900
- * has a month to pay the invoice.
901
- */
902
- net_terms: number;
903
- /**
904
- * A pending subscription change if one exists on this subscription.
905
- */
906
- pending_subscription_change: Subscription.PendingSubscriptionChange | null;
907
- /**
908
- * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
909
- * subscribed to by a customer. Plans define the billing behavior of the
910
- * subscription. You can see more about how to configure prices in the
911
- * [Price resource](/reference/price).
912
- */
913
- plan: PlansAPI.Plan | null;
914
- /**
915
- * The price intervals for this subscription.
916
- */
917
- price_intervals: Array<Subscription.PriceInterval>;
918
- redeemed_coupon: Subscription.RedeemedCoupon | null;
919
- /**
920
- * The date Orb starts billing for this subscription.
921
- */
922
- start_date: string;
923
- status: 'active' | 'ended' | 'upcoming';
924
- trial_info: Subscription.TrialInfo;
925
- /**
926
- * The resources that were changed as part of this operation. Only present when
927
- * fetched through the subscription changes API or if the
928
- * `include_changed_resources` parameter was passed in the request.
929
- */
930
- changed_resources?: Subscription.ChangedResources | null;
931
- }
932
- namespace Subscription {
933
- interface AdjustmentInterval {
934
- id: string;
935
- adjustment: AdjustmentInterval.PlanPhaseUsageDiscountAdjustment | AdjustmentInterval.PlanPhaseAmountDiscountAdjustment | AdjustmentInterval.PlanPhasePercentageDiscountAdjustment | AdjustmentInterval.PlanPhaseMinimumAdjustment | AdjustmentInterval.PlanPhaseMaximumAdjustment;
936
- /**
937
- * The price interval IDs that this adjustment applies to.
938
- */
939
- applies_to_price_interval_ids: Array<string>;
940
- /**
941
- * The end date of the adjustment interval.
942
- */
943
- end_date: string | null;
944
- /**
945
- * The start date of the adjustment interval.
946
- */
947
- start_date: string;
948
- }
949
- namespace AdjustmentInterval {
950
- interface PlanPhaseUsageDiscountAdjustment {
951
- id: string;
952
- adjustment_type: 'usage_discount';
953
- /**
954
- * @deprecated The price IDs that this adjustment applies to.
955
- */
956
- applies_to_price_ids: Array<string>;
957
- /**
958
- * The filters that determine which prices to apply this adjustment to.
959
- */
960
- filters: Array<PlanPhaseUsageDiscountAdjustment.Filter>;
961
- /**
962
- * True for adjustments that apply to an entire invocice, false for adjustments
963
- * that apply to only one price.
964
- */
965
- is_invoice_level: boolean;
966
- /**
967
- * The plan phase in which this adjustment is active.
968
- */
969
- plan_phase_order: number | null;
970
- /**
971
- * The reason for the adjustment.
972
- */
973
- reason: string | null;
974
- /**
975
- * The number of usage units by which to discount the price this adjustment applies
976
- * to in a given billing period.
977
- */
978
- usage_discount: number;
979
- }
980
- namespace PlanPhaseUsageDiscountAdjustment {
981
- interface Filter {
982
- /**
983
- * The property of the price to filter on.
984
- */
985
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
986
- /**
987
- * Should prices that match the filter be included or excluded.
988
- */
989
- operator: 'includes' | 'excludes';
990
- /**
991
- * The IDs or values that match this filter.
992
- */
993
- values: Array<string>;
994
- }
995
- }
996
- interface PlanPhaseAmountDiscountAdjustment {
997
- id: string;
998
- adjustment_type: 'amount_discount';
999
- /**
1000
- * The amount by which to discount the prices this adjustment applies to in a given
1001
- * billing period.
1002
- */
1003
- amount_discount: string;
1004
- /**
1005
- * @deprecated The price IDs that this adjustment applies to.
1006
- */
1007
- applies_to_price_ids: Array<string>;
1008
- /**
1009
- * The filters that determine which prices to apply this adjustment to.
1010
- */
1011
- filters: Array<PlanPhaseAmountDiscountAdjustment.Filter>;
1012
- /**
1013
- * True for adjustments that apply to an entire invocice, false for adjustments
1014
- * that apply to only one price.
1015
- */
1016
- is_invoice_level: boolean;
1017
- /**
1018
- * The plan phase in which this adjustment is active.
1019
- */
1020
- plan_phase_order: number | null;
1021
- /**
1022
- * The reason for the adjustment.
1023
- */
1024
- reason: string | null;
1025
- }
1026
- namespace PlanPhaseAmountDiscountAdjustment {
1027
- interface Filter {
1028
- /**
1029
- * The property of the price to filter on.
1030
- */
1031
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
1032
- /**
1033
- * Should prices that match the filter be included or excluded.
1034
- */
1035
- operator: 'includes' | 'excludes';
1036
- /**
1037
- * The IDs or values that match this filter.
1038
- */
1039
- values: Array<string>;
1040
- }
1041
- }
1042
- interface PlanPhasePercentageDiscountAdjustment {
1043
- id: string;
1044
- adjustment_type: 'percentage_discount';
1045
- /**
1046
- * @deprecated The price IDs that this adjustment applies to.
1047
- */
1048
- applies_to_price_ids: Array<string>;
1049
- /**
1050
- * The filters that determine which prices to apply this adjustment to.
1051
- */
1052
- filters: Array<PlanPhasePercentageDiscountAdjustment.Filter>;
1053
- /**
1054
- * True for adjustments that apply to an entire invocice, false for adjustments
1055
- * that apply to only one price.
1056
- */
1057
- is_invoice_level: boolean;
1058
- /**
1059
- * The percentage (as a value between 0 and 1) by which to discount the price
1060
- * intervals this adjustment applies to in a given billing period.
1061
- */
1062
- percentage_discount: number;
1063
- /**
1064
- * The plan phase in which this adjustment is active.
1065
- */
1066
- plan_phase_order: number | null;
1067
- /**
1068
- * The reason for the adjustment.
1069
- */
1070
- reason: string | null;
1071
- }
1072
- namespace PlanPhasePercentageDiscountAdjustment {
1073
- interface Filter {
1074
- /**
1075
- * The property of the price to filter on.
1076
- */
1077
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
1078
- /**
1079
- * Should prices that match the filter be included or excluded.
1080
- */
1081
- operator: 'includes' | 'excludes';
1082
- /**
1083
- * The IDs or values that match this filter.
1084
- */
1085
- values: Array<string>;
1086
- }
1087
- }
1088
- interface PlanPhaseMinimumAdjustment {
1089
- id: string;
1090
- adjustment_type: 'minimum';
1091
- /**
1092
- * @deprecated The price IDs that this adjustment applies to.
1093
- */
1094
- applies_to_price_ids: Array<string>;
1095
- /**
1096
- * The filters that determine which prices to apply this adjustment to.
1097
- */
1098
- filters: Array<PlanPhaseMinimumAdjustment.Filter>;
1099
- /**
1100
- * True for adjustments that apply to an entire invocice, false for adjustments
1101
- * that apply to only one price.
1102
- */
1103
- is_invoice_level: boolean;
1104
- /**
1105
- * The item ID that revenue from this minimum will be attributed to.
1106
- */
1107
- item_id: string;
1108
- /**
1109
- * The minimum amount to charge in a given billing period for the prices this
1110
- * adjustment applies to.
1111
- */
1112
- minimum_amount: string;
1113
- /**
1114
- * The plan phase in which this adjustment is active.
1115
- */
1116
- plan_phase_order: number | null;
1117
- /**
1118
- * The reason for the adjustment.
1119
- */
1120
- reason: string | null;
1121
- }
1122
- namespace PlanPhaseMinimumAdjustment {
1123
- interface Filter {
1124
- /**
1125
- * The property of the price to filter on.
1126
- */
1127
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
1128
- /**
1129
- * Should prices that match the filter be included or excluded.
1130
- */
1131
- operator: 'includes' | 'excludes';
1132
- /**
1133
- * The IDs or values that match this filter.
1134
- */
1135
- values: Array<string>;
1136
- }
1137
- }
1138
- interface PlanPhaseMaximumAdjustment {
1139
- id: string;
1140
- adjustment_type: 'maximum';
1141
- /**
1142
- * @deprecated The price IDs that this adjustment applies to.
1143
- */
1144
- applies_to_price_ids: Array<string>;
1145
- /**
1146
- * The filters that determine which prices to apply this adjustment to.
1147
- */
1148
- filters: Array<PlanPhaseMaximumAdjustment.Filter>;
1149
- /**
1150
- * True for adjustments that apply to an entire invocice, false for adjustments
1151
- * that apply to only one price.
1152
- */
1153
- is_invoice_level: boolean;
1154
- /**
1155
- * The maximum amount to charge in a given billing period for the prices this
1156
- * adjustment applies to.
1157
- */
1158
- maximum_amount: string;
1159
- /**
1160
- * The plan phase in which this adjustment is active.
1161
- */
1162
- plan_phase_order: number | null;
1163
- /**
1164
- * The reason for the adjustment.
1165
- */
1166
- reason: string | null;
1167
- }
1168
- namespace PlanPhaseMaximumAdjustment {
1169
- interface Filter {
1170
- /**
1171
- * The property of the price to filter on.
1172
- */
1173
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
1174
- /**
1175
- * Should prices that match the filter be included or excluded.
1176
- */
1177
- operator: 'includes' | 'excludes';
1178
- /**
1179
- * The IDs or values that match this filter.
1180
- */
1181
- values: Array<string>;
1182
- }
1183
- }
1184
- }
1185
- interface BillingCycleAnchorConfiguration {
1186
- /**
1187
- * The day of the month on which the billing cycle is anchored. If the maximum
1188
- * number of days in a month is greater than this value, the last day of the month
1189
- * is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing
1190
- * period begins on the 30th.
1191
- */
1192
- day: number;
1193
- /**
1194
- * The month on which the billing cycle is anchored (e.g. a quarterly price
1195
- * anchored in February would have cycles starting February, May, August, and
1196
- * November).
1197
- */
1198
- month?: number | null;
1199
- /**
1200
- * The year on which the billing cycle is anchored (e.g. a 2 year billing cycle
1201
- * anchored on 2021 would have cycles starting on 2021, 2023, 2025, etc.).
1202
- */
1203
- year?: number | null;
1204
- }
1205
- interface AmountDiscountInterval {
1206
- /**
1207
- * Only available if discount_type is `amount`.
1208
- */
1209
- amount_discount: string;
1210
- /**
1211
- * The price interval ids that this discount interval applies to.
1212
- */
1213
- applies_to_price_interval_ids: Array<string>;
1214
- discount_type: 'amount';
1215
- /**
1216
- * The end date of the discount interval.
1217
- */
1218
- end_date: string | null;
1219
- /**
1220
- * The filters that determine which prices this discount interval applies to.
1221
- */
1222
- filters: Array<AmountDiscountInterval.Filter>;
1223
- /**
1224
- * The start date of the discount interval.
1225
- */
1226
- start_date: string;
1227
- }
1228
- namespace AmountDiscountInterval {
1229
- interface Filter {
1230
- /**
1231
- * The property of the price to filter on.
1232
- */
1233
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
1234
- /**
1235
- * Should prices that match the filter be included or excluded.
1236
- */
1237
- operator: 'includes' | 'excludes';
1238
- /**
1239
- * The IDs or values that match this filter.
1240
- */
1241
- values: Array<string>;
1242
- }
1243
- }
1244
- interface PercentageDiscountInterval {
1245
- /**
1246
- * The price interval ids that this discount interval applies to.
1247
- */
1248
- applies_to_price_interval_ids: Array<string>;
1249
- discount_type: 'percentage';
1250
- /**
1251
- * The end date of the discount interval.
1252
- */
1253
- end_date: string | null;
1254
- /**
1255
- * The filters that determine which prices this discount interval applies to.
1256
- */
1257
- filters: Array<PercentageDiscountInterval.Filter>;
1258
- /**
1259
- * Only available if discount_type is `percentage`.This is a number between 0
1260
- * and 1.
1261
- */
1262
- percentage_discount: number;
1263
- /**
1264
- * The start date of the discount interval.
1265
- */
1266
- start_date: string;
1267
- }
1268
- namespace PercentageDiscountInterval {
1269
- interface Filter {
1270
- /**
1271
- * The property of the price to filter on.
1272
- */
1273
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
1274
- /**
1275
- * Should prices that match the filter be included or excluded.
1276
- */
1277
- operator: 'includes' | 'excludes';
1278
- /**
1279
- * The IDs or values that match this filter.
1280
- */
1281
- values: Array<string>;
1282
- }
1283
- }
1284
- interface UsageDiscountInterval {
1285
- /**
1286
- * The price interval ids that this discount interval applies to.
1287
- */
1288
- applies_to_price_interval_ids: Array<string>;
1289
- discount_type: 'usage';
1290
- /**
1291
- * The end date of the discount interval.
1292
- */
1293
- end_date: string | null;
1294
- /**
1295
- * The filters that determine which prices this discount interval applies to.
1296
- */
1297
- filters: Array<UsageDiscountInterval.Filter>;
1298
- /**
1299
- * The start date of the discount interval.
1300
- */
1301
- start_date: string;
1302
- /**
1303
- * Only available if discount_type is `usage`. Number of usage units that this
1304
- * discount is for
1305
- */
1306
- usage_discount: number;
1307
- }
1308
- namespace UsageDiscountInterval {
1309
- interface Filter {
1310
- /**
1311
- * The property of the price to filter on.
1312
- */
1313
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
1314
- /**
1315
- * Should prices that match the filter be included or excluded.
1316
- */
1317
- operator: 'includes' | 'excludes';
1318
- /**
1319
- * The IDs or values that match this filter.
1320
- */
1321
- values: Array<string>;
1322
- }
1323
- }
1324
- interface FixedFeeQuantitySchedule {
1325
- end_date: string | null;
1326
- price_id: string;
1327
- quantity: number;
1328
- start_date: string;
1329
- }
1330
- interface MaximumInterval {
1331
- /**
1332
- * The price interval ids that this maximum interval applies to.
1333
- */
1334
- applies_to_price_interval_ids: Array<string>;
1335
- /**
1336
- * The end date of the maximum interval.
1337
- */
1338
- end_date: string | null;
1339
- /**
1340
- * The filters that determine which prices this maximum interval applies to.
1341
- */
1342
- filters: Array<MaximumInterval.Filter>;
1343
- /**
1344
- * The maximum amount to charge in a given billing period for the price intervals
1345
- * this transform applies to.
1346
- */
1347
- maximum_amount: string;
1348
- /**
1349
- * The start date of the maximum interval.
1350
- */
1351
- start_date: string;
1352
- }
1353
- namespace MaximumInterval {
1354
- interface Filter {
1355
- /**
1356
- * The property of the price to filter on.
1357
- */
1358
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
1359
- /**
1360
- * Should prices that match the filter be included or excluded.
1361
- */
1362
- operator: 'includes' | 'excludes';
1363
- /**
1364
- * The IDs or values that match this filter.
1365
- */
1366
- values: Array<string>;
1367
- }
1368
- }
1369
- interface MinimumInterval {
1370
- /**
1371
- * The price interval ids that this minimum interval applies to.
1372
- */
1373
- applies_to_price_interval_ids: Array<string>;
1374
- /**
1375
- * The end date of the minimum interval.
1376
- */
1377
- end_date: string | null;
1378
- /**
1379
- * The filters that determine which prices this minimum interval applies to.
1380
- */
1381
- filters: Array<MinimumInterval.Filter>;
1382
- /**
1383
- * The minimum amount to charge in a given billing period for the price intervals
1384
- * this minimum applies to.
1385
- */
1386
- minimum_amount: string;
1387
- /**
1388
- * The start date of the minimum interval.
1389
- */
1390
- start_date: string;
1391
- }
1392
- namespace MinimumInterval {
1393
- interface Filter {
1394
- /**
1395
- * The property of the price to filter on.
1396
- */
1397
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
1398
- /**
1399
- * Should prices that match the filter be included or excluded.
1400
- */
1401
- operator: 'includes' | 'excludes';
1402
- /**
1403
- * The IDs or values that match this filter.
1404
- */
1405
- values: Array<string>;
1406
- }
1407
- }
1408
- /**
1409
- * A pending subscription change if one exists on this subscription.
1410
- */
1411
- interface PendingSubscriptionChange {
1412
- id: string;
1413
- }
1414
- /**
1415
- * The Price Interval resource represents a period of time for which a price will
1416
- * bill on a subscription. A subscription’s price intervals define its billing
1417
- * behavior.
1418
- */
1419
- interface PriceInterval {
1420
- id: string;
1421
- /**
1422
- * The day of the month that Orb bills for this price
1423
- */
1424
- billing_cycle_day: number;
1425
- /**
1426
- * The end of the current billing period. This is an exclusive timestamp, such that
1427
- * the instant returned is exactly the end of the billing period. Set to null if
1428
- * this price interval is not currently active.
1429
- */
1430
- current_billing_period_end_date: string | null;
1431
- /**
1432
- * The start date of the current billing period. This is an inclusive timestamp;
1433
- * the instant returned is exactly the beginning of the billing period. Set to null
1434
- * if this price interval is not currently active.
1435
- */
1436
- current_billing_period_start_date: string | null;
1437
- /**
1438
- * The end date of the price interval. This is the date that Orb stops billing for
1439
- * this price.
1440
- */
1441
- end_date: string | null;
1442
- /**
1443
- * An additional filter to apply to usage queries.
1444
- */
1445
- filter: string | null;
1446
- /**
1447
- * The fixed fee quantity transitions for this price interval. This is only
1448
- * relevant for fixed fees.
1449
- */
1450
- fixed_fee_quantity_transitions: Array<PriceInterval.FixedFeeQuantityTransition> | null;
1451
- /**
1452
- * The Price resource represents a price that can be billed on a subscription,
1453
- * resulting in a charge on an invoice in the form of an invoice line item. Prices
1454
- * take a quantity and determine an amount to bill.
1455
- *
1456
- * Orb supports a few different pricing models out of the box. Each of these models
1457
- * is serialized differently in a given Price object. The model_type field
1458
- * determines the key for the configuration object that is present.
1459
- *
1460
- * For more on the types of prices, see
1461
- * [the core concepts documentation](/core-concepts#plan-and-price)
1462
- */
1463
- price: PricesAPI.Price;
1464
- /**
1465
- * The start date of the price interval. This is the date that Orb starts billing
1466
- * for this price.
1467
- */
1468
- start_date: string;
1469
- /**
1470
- * A list of customer IDs whose usage events will be aggregated and billed under
1471
- * this price interval.
1472
- */
1473
- usage_customer_ids: Array<string> | null;
1474
- }
1475
- namespace PriceInterval {
1476
- interface FixedFeeQuantityTransition {
1477
- effective_date: string;
1478
- price_id: string;
1479
- quantity: number;
1480
- }
1481
- }
1482
- interface RedeemedCoupon {
1483
- coupon_id: string;
1484
- end_date: string | null;
1485
- start_date: string;
1486
- }
1487
- interface TrialInfo {
1488
- end_date: string | null;
1489
- }
1490
- /**
1491
- * The resources that were changed as part of this operation. Only present when
1492
- * fetched through the subscription changes API or if the
1493
- * `include_changed_resources` parameter was passed in the request.
1494
- */
1495
- interface ChangedResources {
1496
- /**
1497
- * The credit notes that were created as part of this operation.
1498
- */
1499
- created_credit_notes: Array<CreditNotesAPI.CreditNote>;
1500
- /**
1501
- * The invoices that were created as part of this operation.
1502
- */
1503
- created_invoices: Array<InvoicesAPI.Invoice>;
1504
- /**
1505
- * The credit notes that were voided as part of this operation.
1506
- */
1507
- voided_credit_notes: Array<CreditNotesAPI.CreditNote>;
1508
- /**
1509
- * The invoices that were voided as part of this operation.
1510
- */
1511
- voided_invoices: Array<InvoicesAPI.Invoice>;
1512
- }
1513
- }
1514
- }
1515
212
  /**
1516
213
  * A subscription change represents a desired new subscription / pending change to
1517
214
  * an existing subscription. It is a way to first preview the effects on the
@@ -1525,7 +222,7 @@ export interface SubscriptionChangeCancelResponse {
1525
222
  */
1526
223
  expiration_time: string;
1527
224
  status: 'pending' | 'applied' | 'cancelled';
1528
- subscription: SubscriptionChangeCancelResponse.Subscription | null;
225
+ subscription: MutatedSubscription | null;
1529
226
  /**
1530
227
  * When this change was applied.
1531
228
  */
@@ -1535,723 +232,6 @@ export interface SubscriptionChangeCancelResponse {
1535
232
  */
1536
233
  cancelled_at?: string | null;
1537
234
  }
1538
- export declare namespace SubscriptionChangeCancelResponse {
1539
- interface Subscription {
1540
- id: string;
1541
- /**
1542
- * The current plan phase that is active, only if the subscription's plan has
1543
- * phases.
1544
- */
1545
- active_plan_phase_order: number | null;
1546
- /**
1547
- * The adjustment intervals for this subscription sorted by the start_date of the
1548
- * adjustment interval.
1549
- */
1550
- adjustment_intervals: Array<Subscription.AdjustmentInterval>;
1551
- /**
1552
- * Determines whether issued invoices for this subscription will automatically be
1553
- * charged with the saved payment method on the due date. This property defaults to
1554
- * the plan's behavior. If null, defaults to the customer's setting.
1555
- */
1556
- auto_collection: boolean | null;
1557
- billing_cycle_anchor_configuration: Subscription.BillingCycleAnchorConfiguration;
1558
- /**
1559
- * The day of the month on which the billing cycle is anchored. If the maximum
1560
- * number of days in a month is greater than this value, the last day of the month
1561
- * is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing
1562
- * period begins on the 30th.
1563
- */
1564
- billing_cycle_day: number;
1565
- created_at: string;
1566
- /**
1567
- * The end of the current billing period. This is an exclusive timestamp, such that
1568
- * the instant returned is not part of the billing period. Set to null for
1569
- * subscriptions that are not currently active.
1570
- */
1571
- current_billing_period_end_date: string | null;
1572
- /**
1573
- * The start date of the current billing period. This is an inclusive timestamp;
1574
- * the instant returned is exactly the beginning of the billing period. Set to null
1575
- * if the subscription is not currently active.
1576
- */
1577
- current_billing_period_start_date: string | null;
1578
- /**
1579
- * A customer is a buyer of your products, and the other party to the billing
1580
- * relationship.
1581
- *
1582
- * In Orb, customers are assigned system generated identifiers automatically, but
1583
- * it's often desirable to have these match existing identifiers in your system. To
1584
- * avoid having to denormalize Orb ID information, you can pass in an
1585
- * `external_customer_id` with your own identifier. See
1586
- * [Customer ID Aliases](/events-and-metrics/customer-aliases) for further
1587
- * information about how these aliases work in Orb.
1588
- *
1589
- * In addition to having an identifier in your system, a customer may exist in a
1590
- * payment provider solution like Stripe. Use the `payment_provider_id` and the
1591
- * `payment_provider` enum field to express this mapping.
1592
- *
1593
- * A customer also has a timezone (from the standard
1594
- * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to
1595
- * your account's timezone. See [Timezone localization](/essentials/timezones) for
1596
- * information on what this timezone parameter influences within Orb.
1597
- */
1598
- customer: CustomersAPI.Customer;
1599
- /**
1600
- * Determines the default memo on this subscriptions' invoices. Note that if this
1601
- * is not provided, it is determined by the plan configuration.
1602
- */
1603
- default_invoice_memo: string | null;
1604
- /**
1605
- * @deprecated The discount intervals for this subscription sorted by the
1606
- * start_date.
1607
- */
1608
- discount_intervals: Array<Subscription.AmountDiscountInterval | Subscription.PercentageDiscountInterval | Subscription.UsageDiscountInterval>;
1609
- /**
1610
- * The date Orb stops billing for this subscription.
1611
- */
1612
- end_date: string | null;
1613
- fixed_fee_quantity_schedule: Array<Subscription.FixedFeeQuantitySchedule>;
1614
- invoicing_threshold: string | null;
1615
- /**
1616
- * @deprecated The maximum intervals for this subscription sorted by the
1617
- * start_date.
1618
- */
1619
- maximum_intervals: Array<Subscription.MaximumInterval>;
1620
- /**
1621
- * User specified key-value pairs for the resource. If not present, this defaults
1622
- * to an empty dictionary. Individual keys can be removed by setting the value to
1623
- * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
1624
- * `null`.
1625
- */
1626
- metadata: Record<string, string>;
1627
- /**
1628
- * @deprecated The minimum intervals for this subscription sorted by the
1629
- * start_date.
1630
- */
1631
- minimum_intervals: Array<Subscription.MinimumInterval>;
1632
- /**
1633
- * The name of the subscription.
1634
- */
1635
- name: string;
1636
- /**
1637
- * Determines the difference between the invoice issue date for subscription
1638
- * invoices as the date that they are due. A value of `0` here represents that the
1639
- * invoice is due on issue, whereas a value of `30` represents that the customer
1640
- * has a month to pay the invoice.
1641
- */
1642
- net_terms: number;
1643
- /**
1644
- * A pending subscription change if one exists on this subscription.
1645
- */
1646
- pending_subscription_change: Subscription.PendingSubscriptionChange | null;
1647
- /**
1648
- * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
1649
- * subscribed to by a customer. Plans define the billing behavior of the
1650
- * subscription. You can see more about how to configure prices in the
1651
- * [Price resource](/reference/price).
1652
- */
1653
- plan: PlansAPI.Plan | null;
1654
- /**
1655
- * The price intervals for this subscription.
1656
- */
1657
- price_intervals: Array<Subscription.PriceInterval>;
1658
- redeemed_coupon: Subscription.RedeemedCoupon | null;
1659
- /**
1660
- * The date Orb starts billing for this subscription.
1661
- */
1662
- start_date: string;
1663
- status: 'active' | 'ended' | 'upcoming';
1664
- trial_info: Subscription.TrialInfo;
1665
- /**
1666
- * The resources that were changed as part of this operation. Only present when
1667
- * fetched through the subscription changes API or if the
1668
- * `include_changed_resources` parameter was passed in the request.
1669
- */
1670
- changed_resources?: Subscription.ChangedResources | null;
1671
- }
1672
- namespace Subscription {
1673
- interface AdjustmentInterval {
1674
- id: string;
1675
- adjustment: AdjustmentInterval.PlanPhaseUsageDiscountAdjustment | AdjustmentInterval.PlanPhaseAmountDiscountAdjustment | AdjustmentInterval.PlanPhasePercentageDiscountAdjustment | AdjustmentInterval.PlanPhaseMinimumAdjustment | AdjustmentInterval.PlanPhaseMaximumAdjustment;
1676
- /**
1677
- * The price interval IDs that this adjustment applies to.
1678
- */
1679
- applies_to_price_interval_ids: Array<string>;
1680
- /**
1681
- * The end date of the adjustment interval.
1682
- */
1683
- end_date: string | null;
1684
- /**
1685
- * The start date of the adjustment interval.
1686
- */
1687
- start_date: string;
1688
- }
1689
- namespace AdjustmentInterval {
1690
- interface PlanPhaseUsageDiscountAdjustment {
1691
- id: string;
1692
- adjustment_type: 'usage_discount';
1693
- /**
1694
- * @deprecated The price IDs that this adjustment applies to.
1695
- */
1696
- applies_to_price_ids: Array<string>;
1697
- /**
1698
- * The filters that determine which prices to apply this adjustment to.
1699
- */
1700
- filters: Array<PlanPhaseUsageDiscountAdjustment.Filter>;
1701
- /**
1702
- * True for adjustments that apply to an entire invocice, false for adjustments
1703
- * that apply to only one price.
1704
- */
1705
- is_invoice_level: boolean;
1706
- /**
1707
- * The plan phase in which this adjustment is active.
1708
- */
1709
- plan_phase_order: number | null;
1710
- /**
1711
- * The reason for the adjustment.
1712
- */
1713
- reason: string | null;
1714
- /**
1715
- * The number of usage units by which to discount the price this adjustment applies
1716
- * to in a given billing period.
1717
- */
1718
- usage_discount: number;
1719
- }
1720
- namespace PlanPhaseUsageDiscountAdjustment {
1721
- interface Filter {
1722
- /**
1723
- * The property of the price to filter on.
1724
- */
1725
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
1726
- /**
1727
- * Should prices that match the filter be included or excluded.
1728
- */
1729
- operator: 'includes' | 'excludes';
1730
- /**
1731
- * The IDs or values that match this filter.
1732
- */
1733
- values: Array<string>;
1734
- }
1735
- }
1736
- interface PlanPhaseAmountDiscountAdjustment {
1737
- id: string;
1738
- adjustment_type: 'amount_discount';
1739
- /**
1740
- * The amount by which to discount the prices this adjustment applies to in a given
1741
- * billing period.
1742
- */
1743
- amount_discount: string;
1744
- /**
1745
- * @deprecated The price IDs that this adjustment applies to.
1746
- */
1747
- applies_to_price_ids: Array<string>;
1748
- /**
1749
- * The filters that determine which prices to apply this adjustment to.
1750
- */
1751
- filters: Array<PlanPhaseAmountDiscountAdjustment.Filter>;
1752
- /**
1753
- * True for adjustments that apply to an entire invocice, false for adjustments
1754
- * that apply to only one price.
1755
- */
1756
- is_invoice_level: boolean;
1757
- /**
1758
- * The plan phase in which this adjustment is active.
1759
- */
1760
- plan_phase_order: number | null;
1761
- /**
1762
- * The reason for the adjustment.
1763
- */
1764
- reason: string | null;
1765
- }
1766
- namespace PlanPhaseAmountDiscountAdjustment {
1767
- interface Filter {
1768
- /**
1769
- * The property of the price to filter on.
1770
- */
1771
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
1772
- /**
1773
- * Should prices that match the filter be included or excluded.
1774
- */
1775
- operator: 'includes' | 'excludes';
1776
- /**
1777
- * The IDs or values that match this filter.
1778
- */
1779
- values: Array<string>;
1780
- }
1781
- }
1782
- interface PlanPhasePercentageDiscountAdjustment {
1783
- id: string;
1784
- adjustment_type: 'percentage_discount';
1785
- /**
1786
- * @deprecated The price IDs that this adjustment applies to.
1787
- */
1788
- applies_to_price_ids: Array<string>;
1789
- /**
1790
- * The filters that determine which prices to apply this adjustment to.
1791
- */
1792
- filters: Array<PlanPhasePercentageDiscountAdjustment.Filter>;
1793
- /**
1794
- * True for adjustments that apply to an entire invocice, false for adjustments
1795
- * that apply to only one price.
1796
- */
1797
- is_invoice_level: boolean;
1798
- /**
1799
- * The percentage (as a value between 0 and 1) by which to discount the price
1800
- * intervals this adjustment applies to in a given billing period.
1801
- */
1802
- percentage_discount: number;
1803
- /**
1804
- * The plan phase in which this adjustment is active.
1805
- */
1806
- plan_phase_order: number | null;
1807
- /**
1808
- * The reason for the adjustment.
1809
- */
1810
- reason: string | null;
1811
- }
1812
- namespace PlanPhasePercentageDiscountAdjustment {
1813
- interface Filter {
1814
- /**
1815
- * The property of the price to filter on.
1816
- */
1817
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
1818
- /**
1819
- * Should prices that match the filter be included or excluded.
1820
- */
1821
- operator: 'includes' | 'excludes';
1822
- /**
1823
- * The IDs or values that match this filter.
1824
- */
1825
- values: Array<string>;
1826
- }
1827
- }
1828
- interface PlanPhaseMinimumAdjustment {
1829
- id: string;
1830
- adjustment_type: 'minimum';
1831
- /**
1832
- * @deprecated The price IDs that this adjustment applies to.
1833
- */
1834
- applies_to_price_ids: Array<string>;
1835
- /**
1836
- * The filters that determine which prices to apply this adjustment to.
1837
- */
1838
- filters: Array<PlanPhaseMinimumAdjustment.Filter>;
1839
- /**
1840
- * True for adjustments that apply to an entire invocice, false for adjustments
1841
- * that apply to only one price.
1842
- */
1843
- is_invoice_level: boolean;
1844
- /**
1845
- * The item ID that revenue from this minimum will be attributed to.
1846
- */
1847
- item_id: string;
1848
- /**
1849
- * The minimum amount to charge in a given billing period for the prices this
1850
- * adjustment applies to.
1851
- */
1852
- minimum_amount: string;
1853
- /**
1854
- * The plan phase in which this adjustment is active.
1855
- */
1856
- plan_phase_order: number | null;
1857
- /**
1858
- * The reason for the adjustment.
1859
- */
1860
- reason: string | null;
1861
- }
1862
- namespace PlanPhaseMinimumAdjustment {
1863
- interface Filter {
1864
- /**
1865
- * The property of the price to filter on.
1866
- */
1867
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
1868
- /**
1869
- * Should prices that match the filter be included or excluded.
1870
- */
1871
- operator: 'includes' | 'excludes';
1872
- /**
1873
- * The IDs or values that match this filter.
1874
- */
1875
- values: Array<string>;
1876
- }
1877
- }
1878
- interface PlanPhaseMaximumAdjustment {
1879
- id: string;
1880
- adjustment_type: 'maximum';
1881
- /**
1882
- * @deprecated The price IDs that this adjustment applies to.
1883
- */
1884
- applies_to_price_ids: Array<string>;
1885
- /**
1886
- * The filters that determine which prices to apply this adjustment to.
1887
- */
1888
- filters: Array<PlanPhaseMaximumAdjustment.Filter>;
1889
- /**
1890
- * True for adjustments that apply to an entire invocice, false for adjustments
1891
- * that apply to only one price.
1892
- */
1893
- is_invoice_level: boolean;
1894
- /**
1895
- * The maximum amount to charge in a given billing period for the prices this
1896
- * adjustment applies to.
1897
- */
1898
- maximum_amount: string;
1899
- /**
1900
- * The plan phase in which this adjustment is active.
1901
- */
1902
- plan_phase_order: number | null;
1903
- /**
1904
- * The reason for the adjustment.
1905
- */
1906
- reason: string | null;
1907
- }
1908
- namespace PlanPhaseMaximumAdjustment {
1909
- interface Filter {
1910
- /**
1911
- * The property of the price to filter on.
1912
- */
1913
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
1914
- /**
1915
- * Should prices that match the filter be included or excluded.
1916
- */
1917
- operator: 'includes' | 'excludes';
1918
- /**
1919
- * The IDs or values that match this filter.
1920
- */
1921
- values: Array<string>;
1922
- }
1923
- }
1924
- }
1925
- interface BillingCycleAnchorConfiguration {
1926
- /**
1927
- * The day of the month on which the billing cycle is anchored. If the maximum
1928
- * number of days in a month is greater than this value, the last day of the month
1929
- * is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing
1930
- * period begins on the 30th.
1931
- */
1932
- day: number;
1933
- /**
1934
- * The month on which the billing cycle is anchored (e.g. a quarterly price
1935
- * anchored in February would have cycles starting February, May, August, and
1936
- * November).
1937
- */
1938
- month?: number | null;
1939
- /**
1940
- * The year on which the billing cycle is anchored (e.g. a 2 year billing cycle
1941
- * anchored on 2021 would have cycles starting on 2021, 2023, 2025, etc.).
1942
- */
1943
- year?: number | null;
1944
- }
1945
- interface AmountDiscountInterval {
1946
- /**
1947
- * Only available if discount_type is `amount`.
1948
- */
1949
- amount_discount: string;
1950
- /**
1951
- * The price interval ids that this discount interval applies to.
1952
- */
1953
- applies_to_price_interval_ids: Array<string>;
1954
- discount_type: 'amount';
1955
- /**
1956
- * The end date of the discount interval.
1957
- */
1958
- end_date: string | null;
1959
- /**
1960
- * The filters that determine which prices this discount interval applies to.
1961
- */
1962
- filters: Array<AmountDiscountInterval.Filter>;
1963
- /**
1964
- * The start date of the discount interval.
1965
- */
1966
- start_date: string;
1967
- }
1968
- namespace AmountDiscountInterval {
1969
- interface Filter {
1970
- /**
1971
- * The property of the price to filter on.
1972
- */
1973
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
1974
- /**
1975
- * Should prices that match the filter be included or excluded.
1976
- */
1977
- operator: 'includes' | 'excludes';
1978
- /**
1979
- * The IDs or values that match this filter.
1980
- */
1981
- values: Array<string>;
1982
- }
1983
- }
1984
- interface PercentageDiscountInterval {
1985
- /**
1986
- * The price interval ids that this discount interval applies to.
1987
- */
1988
- applies_to_price_interval_ids: Array<string>;
1989
- discount_type: 'percentage';
1990
- /**
1991
- * The end date of the discount interval.
1992
- */
1993
- end_date: string | null;
1994
- /**
1995
- * The filters that determine which prices this discount interval applies to.
1996
- */
1997
- filters: Array<PercentageDiscountInterval.Filter>;
1998
- /**
1999
- * Only available if discount_type is `percentage`.This is a number between 0
2000
- * and 1.
2001
- */
2002
- percentage_discount: number;
2003
- /**
2004
- * The start date of the discount interval.
2005
- */
2006
- start_date: string;
2007
- }
2008
- namespace PercentageDiscountInterval {
2009
- interface Filter {
2010
- /**
2011
- * The property of the price to filter on.
2012
- */
2013
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
2014
- /**
2015
- * Should prices that match the filter be included or excluded.
2016
- */
2017
- operator: 'includes' | 'excludes';
2018
- /**
2019
- * The IDs or values that match this filter.
2020
- */
2021
- values: Array<string>;
2022
- }
2023
- }
2024
- interface UsageDiscountInterval {
2025
- /**
2026
- * The price interval ids that this discount interval applies to.
2027
- */
2028
- applies_to_price_interval_ids: Array<string>;
2029
- discount_type: 'usage';
2030
- /**
2031
- * The end date of the discount interval.
2032
- */
2033
- end_date: string | null;
2034
- /**
2035
- * The filters that determine which prices this discount interval applies to.
2036
- */
2037
- filters: Array<UsageDiscountInterval.Filter>;
2038
- /**
2039
- * The start date of the discount interval.
2040
- */
2041
- start_date: string;
2042
- /**
2043
- * Only available if discount_type is `usage`. Number of usage units that this
2044
- * discount is for
2045
- */
2046
- usage_discount: number;
2047
- }
2048
- namespace UsageDiscountInterval {
2049
- interface Filter {
2050
- /**
2051
- * The property of the price to filter on.
2052
- */
2053
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
2054
- /**
2055
- * Should prices that match the filter be included or excluded.
2056
- */
2057
- operator: 'includes' | 'excludes';
2058
- /**
2059
- * The IDs or values that match this filter.
2060
- */
2061
- values: Array<string>;
2062
- }
2063
- }
2064
- interface FixedFeeQuantitySchedule {
2065
- end_date: string | null;
2066
- price_id: string;
2067
- quantity: number;
2068
- start_date: string;
2069
- }
2070
- interface MaximumInterval {
2071
- /**
2072
- * The price interval ids that this maximum interval applies to.
2073
- */
2074
- applies_to_price_interval_ids: Array<string>;
2075
- /**
2076
- * The end date of the maximum interval.
2077
- */
2078
- end_date: string | null;
2079
- /**
2080
- * The filters that determine which prices this maximum interval applies to.
2081
- */
2082
- filters: Array<MaximumInterval.Filter>;
2083
- /**
2084
- * The maximum amount to charge in a given billing period for the price intervals
2085
- * this transform applies to.
2086
- */
2087
- maximum_amount: string;
2088
- /**
2089
- * The start date of the maximum interval.
2090
- */
2091
- start_date: string;
2092
- }
2093
- namespace MaximumInterval {
2094
- interface Filter {
2095
- /**
2096
- * The property of the price to filter on.
2097
- */
2098
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
2099
- /**
2100
- * Should prices that match the filter be included or excluded.
2101
- */
2102
- operator: 'includes' | 'excludes';
2103
- /**
2104
- * The IDs or values that match this filter.
2105
- */
2106
- values: Array<string>;
2107
- }
2108
- }
2109
- interface MinimumInterval {
2110
- /**
2111
- * The price interval ids that this minimum interval applies to.
2112
- */
2113
- applies_to_price_interval_ids: Array<string>;
2114
- /**
2115
- * The end date of the minimum interval.
2116
- */
2117
- end_date: string | null;
2118
- /**
2119
- * The filters that determine which prices this minimum interval applies to.
2120
- */
2121
- filters: Array<MinimumInterval.Filter>;
2122
- /**
2123
- * The minimum amount to charge in a given billing period for the price intervals
2124
- * this minimum applies to.
2125
- */
2126
- minimum_amount: string;
2127
- /**
2128
- * The start date of the minimum interval.
2129
- */
2130
- start_date: string;
2131
- }
2132
- namespace MinimumInterval {
2133
- interface Filter {
2134
- /**
2135
- * The property of the price to filter on.
2136
- */
2137
- field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
2138
- /**
2139
- * Should prices that match the filter be included or excluded.
2140
- */
2141
- operator: 'includes' | 'excludes';
2142
- /**
2143
- * The IDs or values that match this filter.
2144
- */
2145
- values: Array<string>;
2146
- }
2147
- }
2148
- /**
2149
- * A pending subscription change if one exists on this subscription.
2150
- */
2151
- interface PendingSubscriptionChange {
2152
- id: string;
2153
- }
2154
- /**
2155
- * The Price Interval resource represents a period of time for which a price will
2156
- * bill on a subscription. A subscription’s price intervals define its billing
2157
- * behavior.
2158
- */
2159
- interface PriceInterval {
2160
- id: string;
2161
- /**
2162
- * The day of the month that Orb bills for this price
2163
- */
2164
- billing_cycle_day: number;
2165
- /**
2166
- * The end of the current billing period. This is an exclusive timestamp, such that
2167
- * the instant returned is exactly the end of the billing period. Set to null if
2168
- * this price interval is not currently active.
2169
- */
2170
- current_billing_period_end_date: string | null;
2171
- /**
2172
- * The start date of the current billing period. This is an inclusive timestamp;
2173
- * the instant returned is exactly the beginning of the billing period. Set to null
2174
- * if this price interval is not currently active.
2175
- */
2176
- current_billing_period_start_date: string | null;
2177
- /**
2178
- * The end date of the price interval. This is the date that Orb stops billing for
2179
- * this price.
2180
- */
2181
- end_date: string | null;
2182
- /**
2183
- * An additional filter to apply to usage queries.
2184
- */
2185
- filter: string | null;
2186
- /**
2187
- * The fixed fee quantity transitions for this price interval. This is only
2188
- * relevant for fixed fees.
2189
- */
2190
- fixed_fee_quantity_transitions: Array<PriceInterval.FixedFeeQuantityTransition> | null;
2191
- /**
2192
- * The Price resource represents a price that can be billed on a subscription,
2193
- * resulting in a charge on an invoice in the form of an invoice line item. Prices
2194
- * take a quantity and determine an amount to bill.
2195
- *
2196
- * Orb supports a few different pricing models out of the box. Each of these models
2197
- * is serialized differently in a given Price object. The model_type field
2198
- * determines the key for the configuration object that is present.
2199
- *
2200
- * For more on the types of prices, see
2201
- * [the core concepts documentation](/core-concepts#plan-and-price)
2202
- */
2203
- price: PricesAPI.Price;
2204
- /**
2205
- * The start date of the price interval. This is the date that Orb starts billing
2206
- * for this price.
2207
- */
2208
- start_date: string;
2209
- /**
2210
- * A list of customer IDs whose usage events will be aggregated and billed under
2211
- * this price interval.
2212
- */
2213
- usage_customer_ids: Array<string> | null;
2214
- }
2215
- namespace PriceInterval {
2216
- interface FixedFeeQuantityTransition {
2217
- effective_date: string;
2218
- price_id: string;
2219
- quantity: number;
2220
- }
2221
- }
2222
- interface RedeemedCoupon {
2223
- coupon_id: string;
2224
- end_date: string | null;
2225
- start_date: string;
2226
- }
2227
- interface TrialInfo {
2228
- end_date: string | null;
2229
- }
2230
- /**
2231
- * The resources that were changed as part of this operation. Only present when
2232
- * fetched through the subscription changes API or if the
2233
- * `include_changed_resources` parameter was passed in the request.
2234
- */
2235
- interface ChangedResources {
2236
- /**
2237
- * The credit notes that were created as part of this operation.
2238
- */
2239
- created_credit_notes: Array<CreditNotesAPI.CreditNote>;
2240
- /**
2241
- * The invoices that were created as part of this operation.
2242
- */
2243
- created_invoices: Array<InvoicesAPI.Invoice>;
2244
- /**
2245
- * The credit notes that were voided as part of this operation.
2246
- */
2247
- voided_credit_notes: Array<CreditNotesAPI.CreditNote>;
2248
- /**
2249
- * The invoices that were voided as part of this operation.
2250
- */
2251
- voided_invoices: Array<InvoicesAPI.Invoice>;
2252
- }
2253
- }
2254
- }
2255
235
  export interface SubscriptionChangeApplyParams {
2256
236
  /**
2257
237
  * Description to apply to the balance transaction representing this credit.
@@ -2263,6 +243,6 @@ export interface SubscriptionChangeApplyParams {
2263
243
  previously_collected_amount?: string | null;
2264
244
  }
2265
245
  export declare namespace SubscriptionChanges {
2266
- export { type SubscriptionChangeRetrieveResponse as SubscriptionChangeRetrieveResponse, type SubscriptionChangeApplyResponse as SubscriptionChangeApplyResponse, type SubscriptionChangeCancelResponse as SubscriptionChangeCancelResponse, type SubscriptionChangeApplyParams as SubscriptionChangeApplyParams, };
246
+ export { type MutatedSubscription as MutatedSubscription, type SubscriptionChangeRetrieveResponse as SubscriptionChangeRetrieveResponse, type SubscriptionChangeApplyResponse as SubscriptionChangeApplyResponse, type SubscriptionChangeCancelResponse as SubscriptionChangeCancelResponse, type SubscriptionChangeApplyParams as SubscriptionChangeApplyParams, };
2267
247
  }
2268
248
  //# sourceMappingURL=subscription-changes.d.ts.map