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