orb-billing 4.71.5 → 4.72.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/index.d.mts +3 -0
  3. package/index.d.ts +3 -0
  4. package/index.d.ts.map +1 -1
  5. package/index.js +3 -0
  6. package/index.js.map +1 -1
  7. package/index.mjs +3 -0
  8. package/index.mjs.map +1 -1
  9. package/package.json +1 -1
  10. package/resources/customers/customers.d.ts +2 -2
  11. package/resources/customers/customers.d.ts.map +1 -1
  12. package/resources/customers/customers.js +7 -7
  13. package/resources/customers/customers.js.map +1 -1
  14. package/resources/customers/customers.mjs +7 -7
  15. package/resources/customers/customers.mjs.map +1 -1
  16. package/resources/index.d.ts +1 -0
  17. package/resources/index.d.ts.map +1 -1
  18. package/resources/index.js +3 -1
  19. package/resources/index.js.map +1 -1
  20. package/resources/index.mjs +1 -0
  21. package/resources/index.mjs.map +1 -1
  22. package/resources/invoices.d.ts +3 -2
  23. package/resources/invoices.d.ts.map +1 -1
  24. package/resources/invoices.js.map +1 -1
  25. package/resources/invoices.mjs.map +1 -1
  26. package/resources/plans/plans.d.ts +4 -4
  27. package/resources/prices/prices.d.ts +8 -8
  28. package/resources/subscription-changes.d.ts +1707 -0
  29. package/resources/subscription-changes.d.ts.map +1 -0
  30. package/resources/subscription-changes.js +38 -0
  31. package/resources/subscription-changes.js.map +1 -0
  32. package/resources/subscription-changes.mjs +34 -0
  33. package/resources/subscription-changes.mjs.map +1 -0
  34. package/resources/subscriptions.d.ts +422 -20
  35. package/resources/subscriptions.d.ts.map +1 -1
  36. package/resources/subscriptions.js.map +1 -1
  37. package/resources/subscriptions.mjs.map +1 -1
  38. package/src/index.ts +17 -0
  39. package/src/resources/customers/customers.ts +10 -13
  40. package/src/resources/index.ts +7 -0
  41. package/src/resources/invoices.ts +3 -2
  42. package/src/resources/plans/plans.ts +4 -4
  43. package/src/resources/prices/prices.ts +8 -8
  44. package/src/resources/subscription-changes.ts +2167 -0
  45. package/src/resources/subscriptions.ts +494 -20
  46. package/src/version.ts +1 -1
  47. package/version.d.ts +1 -1
  48. package/version.js +1 -1
  49. package/version.mjs +1 -1
@@ -0,0 +1,1707 @@
1
+ import { APIResource } from "../resource.js";
2
+ import * as Core from "../core.js";
3
+ import * as CreditNotesAPI from "./credit-notes.js";
4
+ import * as InvoicesAPI from "./invoices.js";
5
+ import * as CustomersAPI from "./customers/customers.js";
6
+ import * as PlansAPI from "./plans/plans.js";
7
+ import * as PricesAPI from "./prices/prices.js";
8
+ export declare class SubscriptionChanges extends APIResource {
9
+ /**
10
+ * This endpoint returns a subscription change given an identifier.
11
+ *
12
+ * A subscription change is created by including
13
+ * `Create-Pending-Subscription-Change: True` in the header of a subscription
14
+ * mutation API call (e.g.
15
+ * [create subscription endpoint](/api-reference/subscription/create-subscription),
16
+ * [schedule plan change endpoint](/api-reference/subscription/schedule-plan-change),
17
+ * ...). The subscription change will be referenced by the
18
+ * `pending_subscription_change` field in the response.
19
+ */
20
+ retrieve(subscriptionChangeId: string, options?: Core.RequestOptions): Core.APIPromise<SubscriptionChangeRetrieveResponse>;
21
+ /**
22
+ * Apply a subscription change to perform the intended action. If a positive amount
23
+ * is passed with a request to this endpoint, any eligible invoices that were
24
+ * created will be issued immediately if they only contain in-advance fees.
25
+ */
26
+ apply(subscriptionChangeId: string, body?: SubscriptionChangeApplyParams, options?: Core.RequestOptions): Core.APIPromise<SubscriptionChangeApplyResponse>;
27
+ apply(subscriptionChangeId: string, options?: Core.RequestOptions): Core.APIPromise<SubscriptionChangeApplyResponse>;
28
+ /**
29
+ * Cancel a subscription change. The change can no longer be applied. A
30
+ * subscription can only have one "pending" change at a time - use this endpoint to
31
+ * cancel an existing change before creating a new one.
32
+ */
33
+ cancel(subscriptionChangeId: string, options?: Core.RequestOptions): Core.APIPromise<SubscriptionChangeCancelResponse>;
34
+ }
35
+ /**
36
+ * A subscription change represents a desired new subscription / pending change to
37
+ * an existing subscription. It is a way to first preview the effects on the
38
+ * subscription as well as any changes/creation of invoices (see
39
+ * `subscription.changed_resources`).
40
+ */
41
+ export interface SubscriptionChangeRetrieveResponse {
42
+ id: string;
43
+ /**
44
+ * Subscription change will be cancelled at this time and can no longer be applied.
45
+ */
46
+ expiration_time: string;
47
+ status: 'pending' | 'applied' | 'cancelled';
48
+ subscription: SubscriptionChangeRetrieveResponse.Subscription | null;
49
+ /**
50
+ * When this change was applied.
51
+ */
52
+ applied_at?: string | null;
53
+ /**
54
+ * When this change was cancelled.
55
+ */
56
+ cancelled_at?: string | null;
57
+ }
58
+ export declare namespace SubscriptionChangeRetrieveResponse {
59
+ interface Subscription {
60
+ id: string;
61
+ /**
62
+ * The current plan phase that is active, only if the subscription's plan has
63
+ * phases.
64
+ */
65
+ active_plan_phase_order: number | null;
66
+ /**
67
+ * The adjustment intervals for this subscription sorted by the start_date of the
68
+ * adjustment interval.
69
+ */
70
+ adjustment_intervals: Array<Subscription.AdjustmentInterval>;
71
+ /**
72
+ * Determines whether issued invoices for this subscription will automatically be
73
+ * charged with the saved payment method on the due date. This property defaults to
74
+ * the plan's behavior. If null, defaults to the customer's setting.
75
+ */
76
+ auto_collection: boolean | null;
77
+ billing_cycle_anchor_configuration: Subscription.BillingCycleAnchorConfiguration;
78
+ /**
79
+ * The day of the month on which the billing cycle is anchored. If the maximum
80
+ * number of days in a month is greater than this value, the last day of the month
81
+ * is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing
82
+ * period begins on the 30th.
83
+ */
84
+ billing_cycle_day: number;
85
+ created_at: string;
86
+ /**
87
+ * The end of the current billing period. This is an exclusive timestamp, such that
88
+ * the instant returned is not part of the billing period. Set to null for
89
+ * subscriptions that are not currently active.
90
+ */
91
+ current_billing_period_end_date: string | null;
92
+ /**
93
+ * The start date of the current billing period. This is an inclusive timestamp;
94
+ * the instant returned is exactly the beginning of the billing period. Set to null
95
+ * if the subscription is not currently active.
96
+ */
97
+ current_billing_period_start_date: string | null;
98
+ /**
99
+ * A customer is a buyer of your products, and the other party to the billing
100
+ * relationship.
101
+ *
102
+ * In Orb, customers are assigned system generated identifiers automatically, but
103
+ * it's often desirable to have these match existing identifiers in your system. To
104
+ * avoid having to denormalize Orb ID information, you can pass in an
105
+ * `external_customer_id` with your own identifier. See
106
+ * [Customer ID Aliases](/events-and-metrics/customer-aliases) for further
107
+ * information about how these aliases work in Orb.
108
+ *
109
+ * In addition to having an identifier in your system, a customer may exist in a
110
+ * payment provider solution like Stripe. Use the `payment_provider_id` and the
111
+ * `payment_provider` enum field to express this mapping.
112
+ *
113
+ * A customer also has a timezone (from the standard
114
+ * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to
115
+ * your account's timezone. See [Timezone localization](/essentials/timezones) for
116
+ * information on what this timezone parameter influences within Orb.
117
+ */
118
+ customer: CustomersAPI.Customer;
119
+ /**
120
+ * Determines the default memo on this subscriptions' invoices. Note that if this
121
+ * is not provided, it is determined by the plan configuration.
122
+ */
123
+ default_invoice_memo: string | null;
124
+ /**
125
+ * The discount intervals for this subscription sorted by the start_date.
126
+ */
127
+ discount_intervals: Array<Subscription.AmountDiscountInterval | Subscription.PercentageDiscountInterval | Subscription.UsageDiscountInterval>;
128
+ /**
129
+ * The date Orb stops billing for this subscription.
130
+ */
131
+ end_date: string | null;
132
+ fixed_fee_quantity_schedule: Array<Subscription.FixedFeeQuantitySchedule>;
133
+ invoicing_threshold: string | null;
134
+ /**
135
+ * The maximum intervals for this subscription sorted by the start_date.
136
+ */
137
+ maximum_intervals: Array<Subscription.MaximumInterval>;
138
+ /**
139
+ * User specified key-value pairs for the resource. If not present, this defaults
140
+ * to an empty dictionary. Individual keys can be removed by setting the value to
141
+ * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
142
+ * `null`.
143
+ */
144
+ metadata: Record<string, string>;
145
+ /**
146
+ * The minimum intervals for this subscription sorted by the start_date.
147
+ */
148
+ minimum_intervals: Array<Subscription.MinimumInterval>;
149
+ /**
150
+ * Determines the difference between the invoice issue date for subscription
151
+ * invoices as the date that they are due. A value of `0` here represents that the
152
+ * invoice is due on issue, whereas a value of `30` represents that the customer
153
+ * has a month to pay the invoice.
154
+ */
155
+ net_terms: number;
156
+ /**
157
+ * A pending subscription change if one exists on this subscription.
158
+ */
159
+ pending_subscription_change: Subscription.PendingSubscriptionChange | null;
160
+ /**
161
+ * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
162
+ * subscribed to by a customer. Plans define the billing behavior of the
163
+ * subscription. You can see more about how to configure prices in the
164
+ * [Price resource](/reference/price).
165
+ */
166
+ plan: PlansAPI.Plan;
167
+ /**
168
+ * The price intervals for this subscription.
169
+ */
170
+ price_intervals: Array<Subscription.PriceInterval>;
171
+ redeemed_coupon: Subscription.RedeemedCoupon | null;
172
+ /**
173
+ * The date Orb starts billing for this subscription.
174
+ */
175
+ start_date: string;
176
+ status: 'active' | 'ended' | 'upcoming';
177
+ trial_info: Subscription.TrialInfo;
178
+ /**
179
+ * The resources that were changed as part of this operation. Only present when
180
+ * fetched through the subscription changes API or if the
181
+ * `include_changed_resources` parameter was passed in the request.
182
+ */
183
+ changed_resources?: Subscription.ChangedResources | null;
184
+ }
185
+ namespace Subscription {
186
+ interface AdjustmentInterval {
187
+ id: string;
188
+ adjustment: AdjustmentInterval.PlanPhaseUsageDiscountAdjustment | AdjustmentInterval.PlanPhaseAmountDiscountAdjustment | AdjustmentInterval.PlanPhasePercentageDiscountAdjustment | AdjustmentInterval.PlanPhaseMinimumAdjustment | AdjustmentInterval.PlanPhaseMaximumAdjustment;
189
+ /**
190
+ * The price interval IDs that this adjustment applies to.
191
+ */
192
+ applies_to_price_interval_ids: Array<string>;
193
+ /**
194
+ * The end date of the adjustment interval.
195
+ */
196
+ end_date: string | null;
197
+ /**
198
+ * The start date of the adjustment interval.
199
+ */
200
+ start_date: string;
201
+ }
202
+ namespace AdjustmentInterval {
203
+ interface PlanPhaseUsageDiscountAdjustment {
204
+ id: string;
205
+ adjustment_type: 'usage_discount';
206
+ /**
207
+ * The price IDs that this adjustment applies to.
208
+ */
209
+ applies_to_price_ids: Array<string>;
210
+ /**
211
+ * True for adjustments that apply to an entire invocice, false for adjustments
212
+ * that apply to only one price.
213
+ */
214
+ is_invoice_level: boolean;
215
+ /**
216
+ * The plan phase in which this adjustment is active.
217
+ */
218
+ plan_phase_order: number | null;
219
+ /**
220
+ * The reason for the adjustment.
221
+ */
222
+ reason: string | null;
223
+ /**
224
+ * The number of usage units by which to discount the price this adjustment applies
225
+ * to in a given billing period.
226
+ */
227
+ usage_discount: number;
228
+ }
229
+ interface PlanPhaseAmountDiscountAdjustment {
230
+ id: string;
231
+ adjustment_type: 'amount_discount';
232
+ /**
233
+ * The amount by which to discount the prices this adjustment applies to in a given
234
+ * billing period.
235
+ */
236
+ amount_discount: string;
237
+ /**
238
+ * The price IDs that this adjustment applies to.
239
+ */
240
+ applies_to_price_ids: Array<string>;
241
+ /**
242
+ * True for adjustments that apply to an entire invocice, false for adjustments
243
+ * that apply to only one price.
244
+ */
245
+ is_invoice_level: boolean;
246
+ /**
247
+ * The plan phase in which this adjustment is active.
248
+ */
249
+ plan_phase_order: number | null;
250
+ /**
251
+ * The reason for the adjustment.
252
+ */
253
+ reason: string | null;
254
+ }
255
+ interface PlanPhasePercentageDiscountAdjustment {
256
+ id: string;
257
+ adjustment_type: 'percentage_discount';
258
+ /**
259
+ * The price IDs that this adjustment applies to.
260
+ */
261
+ applies_to_price_ids: Array<string>;
262
+ /**
263
+ * True for adjustments that apply to an entire invocice, false for adjustments
264
+ * that apply to only one price.
265
+ */
266
+ is_invoice_level: boolean;
267
+ /**
268
+ * The percentage (as a value between 0 and 1) by which to discount the price
269
+ * intervals this adjustment applies to in a given billing period.
270
+ */
271
+ percentage_discount: number;
272
+ /**
273
+ * The plan phase in which this adjustment is active.
274
+ */
275
+ plan_phase_order: number | null;
276
+ /**
277
+ * The reason for the adjustment.
278
+ */
279
+ reason: string | null;
280
+ }
281
+ interface PlanPhaseMinimumAdjustment {
282
+ id: string;
283
+ adjustment_type: 'minimum';
284
+ /**
285
+ * The price IDs that this adjustment applies to.
286
+ */
287
+ applies_to_price_ids: Array<string>;
288
+ /**
289
+ * True for adjustments that apply to an entire invocice, false for adjustments
290
+ * that apply to only one price.
291
+ */
292
+ is_invoice_level: boolean;
293
+ /**
294
+ * The item ID that revenue from this minimum will be attributed to.
295
+ */
296
+ item_id: string;
297
+ /**
298
+ * The minimum amount to charge in a given billing period for the prices this
299
+ * adjustment applies to.
300
+ */
301
+ minimum_amount: string;
302
+ /**
303
+ * The plan phase in which this adjustment is active.
304
+ */
305
+ plan_phase_order: number | null;
306
+ /**
307
+ * The reason for the adjustment.
308
+ */
309
+ reason: string | null;
310
+ }
311
+ interface PlanPhaseMaximumAdjustment {
312
+ id: string;
313
+ adjustment_type: 'maximum';
314
+ /**
315
+ * The price IDs that this adjustment applies to.
316
+ */
317
+ applies_to_price_ids: Array<string>;
318
+ /**
319
+ * True for adjustments that apply to an entire invocice, false for adjustments
320
+ * that apply to only one price.
321
+ */
322
+ is_invoice_level: boolean;
323
+ /**
324
+ * The maximum amount to charge in a given billing period for the prices this
325
+ * adjustment applies to.
326
+ */
327
+ maximum_amount: string;
328
+ /**
329
+ * The plan phase in which this adjustment is active.
330
+ */
331
+ plan_phase_order: number | null;
332
+ /**
333
+ * The reason for the adjustment.
334
+ */
335
+ reason: string | null;
336
+ }
337
+ }
338
+ interface BillingCycleAnchorConfiguration {
339
+ /**
340
+ * The day of the month on which the billing cycle is anchored. If the maximum
341
+ * number of days in a month is greater than this value, the last day of the month
342
+ * is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing
343
+ * period begins on the 30th.
344
+ */
345
+ day: number;
346
+ /**
347
+ * The month on which the billing cycle is anchored (e.g. a quarterly price
348
+ * anchored in February would have cycles starting February, May, August, and
349
+ * November).
350
+ */
351
+ month?: number | null;
352
+ /**
353
+ * The year on which the billing cycle is anchored (e.g. a 2 year billing cycle
354
+ * anchored on 2021 would have cycles starting on 2021, 2023, 2025, etc.).
355
+ */
356
+ year?: number | null;
357
+ }
358
+ interface AmountDiscountInterval {
359
+ /**
360
+ * Only available if discount_type is `amount`.
361
+ */
362
+ amount_discount: string;
363
+ /**
364
+ * The price ids that this discount interval applies to.
365
+ */
366
+ applies_to_price_ids: Array<string>;
367
+ /**
368
+ * The price interval ids that this discount interval applies to.
369
+ */
370
+ applies_to_price_interval_ids: Array<string>;
371
+ discount_type: 'amount';
372
+ /**
373
+ * The end date of the discount interval.
374
+ */
375
+ end_date: string | null;
376
+ /**
377
+ * The start date of the discount interval.
378
+ */
379
+ start_date: string;
380
+ }
381
+ interface PercentageDiscountInterval {
382
+ /**
383
+ * The price ids that this discount interval applies to.
384
+ */
385
+ applies_to_price_ids: Array<string>;
386
+ /**
387
+ * The price interval ids that this discount interval applies to.
388
+ */
389
+ applies_to_price_interval_ids: Array<string>;
390
+ discount_type: 'percentage';
391
+ /**
392
+ * The end date of the discount interval.
393
+ */
394
+ end_date: string | null;
395
+ /**
396
+ * Only available if discount_type is `percentage`.This is a number between 0
397
+ * and 1.
398
+ */
399
+ percentage_discount: number;
400
+ /**
401
+ * The start date of the discount interval.
402
+ */
403
+ start_date: string;
404
+ }
405
+ interface UsageDiscountInterval {
406
+ /**
407
+ * The price ids that this discount interval applies to.
408
+ */
409
+ applies_to_price_ids: Array<string>;
410
+ /**
411
+ * The price interval ids that this discount interval applies to.
412
+ */
413
+ applies_to_price_interval_ids: Array<string>;
414
+ discount_type: 'usage';
415
+ /**
416
+ * The end date of the discount interval.
417
+ */
418
+ end_date: string | null;
419
+ /**
420
+ * The start date of the discount interval.
421
+ */
422
+ start_date: string;
423
+ /**
424
+ * Only available if discount_type is `usage`. Number of usage units that this
425
+ * discount is for
426
+ */
427
+ usage_discount: number;
428
+ }
429
+ interface FixedFeeQuantitySchedule {
430
+ end_date: string | null;
431
+ price_id: string;
432
+ quantity: number;
433
+ start_date: string;
434
+ }
435
+ interface MaximumInterval {
436
+ /**
437
+ * The price ids that this maximum interval applies to.
438
+ */
439
+ applies_to_price_ids: Array<string>;
440
+ /**
441
+ * The price interval ids that this maximum interval applies to.
442
+ */
443
+ applies_to_price_interval_ids: Array<string>;
444
+ /**
445
+ * The end date of the maximum interval.
446
+ */
447
+ end_date: string | null;
448
+ /**
449
+ * The maximum amount to charge in a given billing period for the price intervals
450
+ * this transform applies to.
451
+ */
452
+ maximum_amount: string;
453
+ /**
454
+ * The start date of the maximum interval.
455
+ */
456
+ start_date: string;
457
+ }
458
+ interface MinimumInterval {
459
+ /**
460
+ * The price ids that this minimum interval applies to.
461
+ */
462
+ applies_to_price_ids: Array<string>;
463
+ /**
464
+ * The price interval ids that this minimum interval applies to.
465
+ */
466
+ applies_to_price_interval_ids: Array<string>;
467
+ /**
468
+ * The end date of the minimum interval.
469
+ */
470
+ end_date: string | null;
471
+ /**
472
+ * The minimum amount to charge in a given billing period for the price intervals
473
+ * this minimum applies to.
474
+ */
475
+ minimum_amount: string;
476
+ /**
477
+ * The start date of the minimum interval.
478
+ */
479
+ start_date: string;
480
+ }
481
+ /**
482
+ * A pending subscription change if one exists on this subscription.
483
+ */
484
+ interface PendingSubscriptionChange {
485
+ id: string;
486
+ }
487
+ /**
488
+ * The Price Interval resource represents a period of time for which a price will
489
+ * bill on a subscription. A subscription’s price intervals define its billing
490
+ * behavior.
491
+ */
492
+ interface PriceInterval {
493
+ id: string;
494
+ /**
495
+ * The day of the month that Orb bills for this price
496
+ */
497
+ billing_cycle_day: number;
498
+ /**
499
+ * The end of the current billing period. This is an exclusive timestamp, such that
500
+ * the instant returned is exactly the end of the billing period. Set to null if
501
+ * this price interval is not currently active.
502
+ */
503
+ current_billing_period_end_date: string | null;
504
+ /**
505
+ * The start date of the current billing period. This is an inclusive timestamp;
506
+ * the instant returned is exactly the beginning of the billing period. Set to null
507
+ * if this price interval is not currently active.
508
+ */
509
+ current_billing_period_start_date: string | null;
510
+ /**
511
+ * The end date of the price interval. This is the date that Orb stops billing for
512
+ * this price.
513
+ */
514
+ end_date: string | null;
515
+ /**
516
+ * An additional filter to apply to usage queries.
517
+ */
518
+ filter: string | null;
519
+ /**
520
+ * The fixed fee quantity transitions for this price interval. This is only
521
+ * relevant for fixed fees.
522
+ */
523
+ fixed_fee_quantity_transitions: Array<PriceInterval.FixedFeeQuantityTransition> | null;
524
+ /**
525
+ * The Price resource represents a price that can be billed on a subscription,
526
+ * resulting in a charge on an invoice in the form of an invoice line item. Prices
527
+ * take a quantity and determine an amount to bill.
528
+ *
529
+ * Orb supports a few different pricing models out of the box. Each of these models
530
+ * is serialized differently in a given Price object. The model_type field
531
+ * determines the key for the configuration object that is present.
532
+ *
533
+ * For more on the types of prices, see
534
+ * [the core concepts documentation](/core-concepts#plan-and-price)
535
+ */
536
+ price: PricesAPI.Price;
537
+ /**
538
+ * The start date of the price interval. This is the date that Orb starts billing
539
+ * for this price.
540
+ */
541
+ start_date: string;
542
+ /**
543
+ * A list of customer IDs whose usage events will be aggregated and billed under
544
+ * this price interval.
545
+ */
546
+ usage_customer_ids: Array<string> | null;
547
+ }
548
+ namespace PriceInterval {
549
+ interface FixedFeeQuantityTransition {
550
+ effective_date: string;
551
+ price_id: string;
552
+ quantity: number;
553
+ }
554
+ }
555
+ interface RedeemedCoupon {
556
+ coupon_id: string;
557
+ end_date: string | null;
558
+ start_date: string;
559
+ }
560
+ interface TrialInfo {
561
+ end_date: string | null;
562
+ }
563
+ /**
564
+ * The resources that were changed as part of this operation. Only present when
565
+ * fetched through the subscription changes API or if the
566
+ * `include_changed_resources` parameter was passed in the request.
567
+ */
568
+ interface ChangedResources {
569
+ /**
570
+ * The credit notes that were created as part of this operation.
571
+ */
572
+ created_credit_notes: Array<CreditNotesAPI.CreditNote>;
573
+ /**
574
+ * The invoices that were created as part of this operation.
575
+ */
576
+ created_invoices: Array<InvoicesAPI.Invoice>;
577
+ /**
578
+ * The credit notes that were voided as part of this operation.
579
+ */
580
+ voided_credit_notes: Array<CreditNotesAPI.CreditNote>;
581
+ /**
582
+ * The invoices that were voided as part of this operation.
583
+ */
584
+ voided_invoices: Array<InvoicesAPI.Invoice>;
585
+ }
586
+ }
587
+ }
588
+ /**
589
+ * A subscription change represents a desired new subscription / pending change to
590
+ * an existing subscription. It is a way to first preview the effects on the
591
+ * subscription as well as any changes/creation of invoices (see
592
+ * `subscription.changed_resources`).
593
+ */
594
+ export interface SubscriptionChangeApplyResponse {
595
+ id: string;
596
+ /**
597
+ * Subscription change will be cancelled at this time and can no longer be applied.
598
+ */
599
+ expiration_time: string;
600
+ status: 'pending' | 'applied' | 'cancelled';
601
+ subscription: SubscriptionChangeApplyResponse.Subscription | null;
602
+ /**
603
+ * When this change was applied.
604
+ */
605
+ applied_at?: string | null;
606
+ /**
607
+ * When this change was cancelled.
608
+ */
609
+ cancelled_at?: string | null;
610
+ }
611
+ export declare namespace SubscriptionChangeApplyResponse {
612
+ interface Subscription {
613
+ id: string;
614
+ /**
615
+ * The current plan phase that is active, only if the subscription's plan has
616
+ * phases.
617
+ */
618
+ active_plan_phase_order: number | null;
619
+ /**
620
+ * The adjustment intervals for this subscription sorted by the start_date of the
621
+ * adjustment interval.
622
+ */
623
+ adjustment_intervals: Array<Subscription.AdjustmentInterval>;
624
+ /**
625
+ * Determines whether issued invoices for this subscription will automatically be
626
+ * charged with the saved payment method on the due date. This property defaults to
627
+ * the plan's behavior. If null, defaults to the customer's setting.
628
+ */
629
+ auto_collection: boolean | null;
630
+ billing_cycle_anchor_configuration: Subscription.BillingCycleAnchorConfiguration;
631
+ /**
632
+ * The day of the month on which the billing cycle is anchored. If the maximum
633
+ * number of days in a month is greater than this value, the last day of the month
634
+ * is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing
635
+ * period begins on the 30th.
636
+ */
637
+ billing_cycle_day: number;
638
+ created_at: string;
639
+ /**
640
+ * The end of the current billing period. This is an exclusive timestamp, such that
641
+ * the instant returned is not part of the billing period. Set to null for
642
+ * subscriptions that are not currently active.
643
+ */
644
+ current_billing_period_end_date: string | null;
645
+ /**
646
+ * The start date of the current billing period. This is an inclusive timestamp;
647
+ * the instant returned is exactly the beginning of the billing period. Set to null
648
+ * if the subscription is not currently active.
649
+ */
650
+ current_billing_period_start_date: string | null;
651
+ /**
652
+ * A customer is a buyer of your products, and the other party to the billing
653
+ * relationship.
654
+ *
655
+ * In Orb, customers are assigned system generated identifiers automatically, but
656
+ * it's often desirable to have these match existing identifiers in your system. To
657
+ * avoid having to denormalize Orb ID information, you can pass in an
658
+ * `external_customer_id` with your own identifier. See
659
+ * [Customer ID Aliases](/events-and-metrics/customer-aliases) for further
660
+ * information about how these aliases work in Orb.
661
+ *
662
+ * In addition to having an identifier in your system, a customer may exist in a
663
+ * payment provider solution like Stripe. Use the `payment_provider_id` and the
664
+ * `payment_provider` enum field to express this mapping.
665
+ *
666
+ * A customer also has a timezone (from the standard
667
+ * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to
668
+ * your account's timezone. See [Timezone localization](/essentials/timezones) for
669
+ * information on what this timezone parameter influences within Orb.
670
+ */
671
+ customer: CustomersAPI.Customer;
672
+ /**
673
+ * Determines the default memo on this subscriptions' invoices. Note that if this
674
+ * is not provided, it is determined by the plan configuration.
675
+ */
676
+ default_invoice_memo: string | null;
677
+ /**
678
+ * The discount intervals for this subscription sorted by the start_date.
679
+ */
680
+ discount_intervals: Array<Subscription.AmountDiscountInterval | Subscription.PercentageDiscountInterval | Subscription.UsageDiscountInterval>;
681
+ /**
682
+ * The date Orb stops billing for this subscription.
683
+ */
684
+ end_date: string | null;
685
+ fixed_fee_quantity_schedule: Array<Subscription.FixedFeeQuantitySchedule>;
686
+ invoicing_threshold: string | null;
687
+ /**
688
+ * The maximum intervals for this subscription sorted by the start_date.
689
+ */
690
+ maximum_intervals: Array<Subscription.MaximumInterval>;
691
+ /**
692
+ * User specified key-value pairs for the resource. If not present, this defaults
693
+ * to an empty dictionary. Individual keys can be removed by setting the value to
694
+ * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
695
+ * `null`.
696
+ */
697
+ metadata: Record<string, string>;
698
+ /**
699
+ * The minimum intervals for this subscription sorted by the start_date.
700
+ */
701
+ minimum_intervals: Array<Subscription.MinimumInterval>;
702
+ /**
703
+ * Determines the difference between the invoice issue date for subscription
704
+ * invoices as the date that they are due. A value of `0` here represents that the
705
+ * invoice is due on issue, whereas a value of `30` represents that the customer
706
+ * has a month to pay the invoice.
707
+ */
708
+ net_terms: number;
709
+ /**
710
+ * A pending subscription change if one exists on this subscription.
711
+ */
712
+ pending_subscription_change: Subscription.PendingSubscriptionChange | null;
713
+ /**
714
+ * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
715
+ * subscribed to by a customer. Plans define the billing behavior of the
716
+ * subscription. You can see more about how to configure prices in the
717
+ * [Price resource](/reference/price).
718
+ */
719
+ plan: PlansAPI.Plan;
720
+ /**
721
+ * The price intervals for this subscription.
722
+ */
723
+ price_intervals: Array<Subscription.PriceInterval>;
724
+ redeemed_coupon: Subscription.RedeemedCoupon | null;
725
+ /**
726
+ * The date Orb starts billing for this subscription.
727
+ */
728
+ start_date: string;
729
+ status: 'active' | 'ended' | 'upcoming';
730
+ trial_info: Subscription.TrialInfo;
731
+ /**
732
+ * The resources that were changed as part of this operation. Only present when
733
+ * fetched through the subscription changes API or if the
734
+ * `include_changed_resources` parameter was passed in the request.
735
+ */
736
+ changed_resources?: Subscription.ChangedResources | null;
737
+ }
738
+ namespace Subscription {
739
+ interface AdjustmentInterval {
740
+ id: string;
741
+ adjustment: AdjustmentInterval.PlanPhaseUsageDiscountAdjustment | AdjustmentInterval.PlanPhaseAmountDiscountAdjustment | AdjustmentInterval.PlanPhasePercentageDiscountAdjustment | AdjustmentInterval.PlanPhaseMinimumAdjustment | AdjustmentInterval.PlanPhaseMaximumAdjustment;
742
+ /**
743
+ * The price interval IDs that this adjustment applies to.
744
+ */
745
+ applies_to_price_interval_ids: Array<string>;
746
+ /**
747
+ * The end date of the adjustment interval.
748
+ */
749
+ end_date: string | null;
750
+ /**
751
+ * The start date of the adjustment interval.
752
+ */
753
+ start_date: string;
754
+ }
755
+ namespace AdjustmentInterval {
756
+ interface PlanPhaseUsageDiscountAdjustment {
757
+ id: string;
758
+ adjustment_type: 'usage_discount';
759
+ /**
760
+ * The price IDs that this adjustment applies to.
761
+ */
762
+ applies_to_price_ids: Array<string>;
763
+ /**
764
+ * True for adjustments that apply to an entire invocice, false for adjustments
765
+ * that apply to only one price.
766
+ */
767
+ is_invoice_level: boolean;
768
+ /**
769
+ * The plan phase in which this adjustment is active.
770
+ */
771
+ plan_phase_order: number | null;
772
+ /**
773
+ * The reason for the adjustment.
774
+ */
775
+ reason: string | null;
776
+ /**
777
+ * The number of usage units by which to discount the price this adjustment applies
778
+ * to in a given billing period.
779
+ */
780
+ usage_discount: number;
781
+ }
782
+ interface PlanPhaseAmountDiscountAdjustment {
783
+ id: string;
784
+ adjustment_type: 'amount_discount';
785
+ /**
786
+ * The amount by which to discount the prices this adjustment applies to in a given
787
+ * billing period.
788
+ */
789
+ amount_discount: string;
790
+ /**
791
+ * The price IDs that this adjustment applies to.
792
+ */
793
+ applies_to_price_ids: Array<string>;
794
+ /**
795
+ * True for adjustments that apply to an entire invocice, false for adjustments
796
+ * that apply to only one price.
797
+ */
798
+ is_invoice_level: boolean;
799
+ /**
800
+ * The plan phase in which this adjustment is active.
801
+ */
802
+ plan_phase_order: number | null;
803
+ /**
804
+ * The reason for the adjustment.
805
+ */
806
+ reason: string | null;
807
+ }
808
+ interface PlanPhasePercentageDiscountAdjustment {
809
+ id: string;
810
+ adjustment_type: 'percentage_discount';
811
+ /**
812
+ * The price IDs that this adjustment applies to.
813
+ */
814
+ applies_to_price_ids: Array<string>;
815
+ /**
816
+ * True for adjustments that apply to an entire invocice, false for adjustments
817
+ * that apply to only one price.
818
+ */
819
+ is_invoice_level: boolean;
820
+ /**
821
+ * The percentage (as a value between 0 and 1) by which to discount the price
822
+ * intervals this adjustment applies to in a given billing period.
823
+ */
824
+ percentage_discount: number;
825
+ /**
826
+ * The plan phase in which this adjustment is active.
827
+ */
828
+ plan_phase_order: number | null;
829
+ /**
830
+ * The reason for the adjustment.
831
+ */
832
+ reason: string | null;
833
+ }
834
+ interface PlanPhaseMinimumAdjustment {
835
+ id: string;
836
+ adjustment_type: 'minimum';
837
+ /**
838
+ * The price IDs that this adjustment applies to.
839
+ */
840
+ applies_to_price_ids: Array<string>;
841
+ /**
842
+ * True for adjustments that apply to an entire invocice, false for adjustments
843
+ * that apply to only one price.
844
+ */
845
+ is_invoice_level: boolean;
846
+ /**
847
+ * The item ID that revenue from this minimum will be attributed to.
848
+ */
849
+ item_id: string;
850
+ /**
851
+ * The minimum amount to charge in a given billing period for the prices this
852
+ * adjustment applies to.
853
+ */
854
+ minimum_amount: string;
855
+ /**
856
+ * The plan phase in which this adjustment is active.
857
+ */
858
+ plan_phase_order: number | null;
859
+ /**
860
+ * The reason for the adjustment.
861
+ */
862
+ reason: string | null;
863
+ }
864
+ interface PlanPhaseMaximumAdjustment {
865
+ id: string;
866
+ adjustment_type: 'maximum';
867
+ /**
868
+ * The price IDs that this adjustment applies to.
869
+ */
870
+ applies_to_price_ids: Array<string>;
871
+ /**
872
+ * True for adjustments that apply to an entire invocice, false for adjustments
873
+ * that apply to only one price.
874
+ */
875
+ is_invoice_level: boolean;
876
+ /**
877
+ * The maximum amount to charge in a given billing period for the prices this
878
+ * adjustment applies to.
879
+ */
880
+ maximum_amount: string;
881
+ /**
882
+ * The plan phase in which this adjustment is active.
883
+ */
884
+ plan_phase_order: number | null;
885
+ /**
886
+ * The reason for the adjustment.
887
+ */
888
+ reason: string | null;
889
+ }
890
+ }
891
+ interface BillingCycleAnchorConfiguration {
892
+ /**
893
+ * The day of the month on which the billing cycle is anchored. If the maximum
894
+ * number of days in a month is greater than this value, the last day of the month
895
+ * is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing
896
+ * period begins on the 30th.
897
+ */
898
+ day: number;
899
+ /**
900
+ * The month on which the billing cycle is anchored (e.g. a quarterly price
901
+ * anchored in February would have cycles starting February, May, August, and
902
+ * November).
903
+ */
904
+ month?: number | null;
905
+ /**
906
+ * The year on which the billing cycle is anchored (e.g. a 2 year billing cycle
907
+ * anchored on 2021 would have cycles starting on 2021, 2023, 2025, etc.).
908
+ */
909
+ year?: number | null;
910
+ }
911
+ interface AmountDiscountInterval {
912
+ /**
913
+ * Only available if discount_type is `amount`.
914
+ */
915
+ amount_discount: string;
916
+ /**
917
+ * The price ids that this discount interval applies to.
918
+ */
919
+ applies_to_price_ids: Array<string>;
920
+ /**
921
+ * The price interval ids that this discount interval applies to.
922
+ */
923
+ applies_to_price_interval_ids: Array<string>;
924
+ discount_type: 'amount';
925
+ /**
926
+ * The end date of the discount interval.
927
+ */
928
+ end_date: string | null;
929
+ /**
930
+ * The start date of the discount interval.
931
+ */
932
+ start_date: string;
933
+ }
934
+ interface PercentageDiscountInterval {
935
+ /**
936
+ * The price ids that this discount interval applies to.
937
+ */
938
+ applies_to_price_ids: Array<string>;
939
+ /**
940
+ * The price interval ids that this discount interval applies to.
941
+ */
942
+ applies_to_price_interval_ids: Array<string>;
943
+ discount_type: 'percentage';
944
+ /**
945
+ * The end date of the discount interval.
946
+ */
947
+ end_date: string | null;
948
+ /**
949
+ * Only available if discount_type is `percentage`.This is a number between 0
950
+ * and 1.
951
+ */
952
+ percentage_discount: number;
953
+ /**
954
+ * The start date of the discount interval.
955
+ */
956
+ start_date: string;
957
+ }
958
+ interface UsageDiscountInterval {
959
+ /**
960
+ * The price ids that this discount interval applies to.
961
+ */
962
+ applies_to_price_ids: Array<string>;
963
+ /**
964
+ * The price interval ids that this discount interval applies to.
965
+ */
966
+ applies_to_price_interval_ids: Array<string>;
967
+ discount_type: 'usage';
968
+ /**
969
+ * The end date of the discount interval.
970
+ */
971
+ end_date: string | null;
972
+ /**
973
+ * The start date of the discount interval.
974
+ */
975
+ start_date: string;
976
+ /**
977
+ * Only available if discount_type is `usage`. Number of usage units that this
978
+ * discount is for
979
+ */
980
+ usage_discount: number;
981
+ }
982
+ interface FixedFeeQuantitySchedule {
983
+ end_date: string | null;
984
+ price_id: string;
985
+ quantity: number;
986
+ start_date: string;
987
+ }
988
+ interface MaximumInterval {
989
+ /**
990
+ * The price ids that this maximum interval applies to.
991
+ */
992
+ applies_to_price_ids: Array<string>;
993
+ /**
994
+ * The price interval ids that this maximum interval applies to.
995
+ */
996
+ applies_to_price_interval_ids: Array<string>;
997
+ /**
998
+ * The end date of the maximum interval.
999
+ */
1000
+ end_date: string | null;
1001
+ /**
1002
+ * The maximum amount to charge in a given billing period for the price intervals
1003
+ * this transform applies to.
1004
+ */
1005
+ maximum_amount: string;
1006
+ /**
1007
+ * The start date of the maximum interval.
1008
+ */
1009
+ start_date: string;
1010
+ }
1011
+ interface MinimumInterval {
1012
+ /**
1013
+ * The price ids that this minimum interval applies to.
1014
+ */
1015
+ applies_to_price_ids: Array<string>;
1016
+ /**
1017
+ * The price interval ids that this minimum interval applies to.
1018
+ */
1019
+ applies_to_price_interval_ids: Array<string>;
1020
+ /**
1021
+ * The end date of the minimum interval.
1022
+ */
1023
+ end_date: string | null;
1024
+ /**
1025
+ * The minimum amount to charge in a given billing period for the price intervals
1026
+ * this minimum applies to.
1027
+ */
1028
+ minimum_amount: string;
1029
+ /**
1030
+ * The start date of the minimum interval.
1031
+ */
1032
+ start_date: string;
1033
+ }
1034
+ /**
1035
+ * A pending subscription change if one exists on this subscription.
1036
+ */
1037
+ interface PendingSubscriptionChange {
1038
+ id: string;
1039
+ }
1040
+ /**
1041
+ * The Price Interval resource represents a period of time for which a price will
1042
+ * bill on a subscription. A subscription’s price intervals define its billing
1043
+ * behavior.
1044
+ */
1045
+ interface PriceInterval {
1046
+ id: string;
1047
+ /**
1048
+ * The day of the month that Orb bills for this price
1049
+ */
1050
+ billing_cycle_day: number;
1051
+ /**
1052
+ * The end of the current billing period. This is an exclusive timestamp, such that
1053
+ * the instant returned is exactly the end of the billing period. Set to null if
1054
+ * this price interval is not currently active.
1055
+ */
1056
+ current_billing_period_end_date: string | null;
1057
+ /**
1058
+ * The start date of the current billing period. This is an inclusive timestamp;
1059
+ * the instant returned is exactly the beginning of the billing period. Set to null
1060
+ * if this price interval is not currently active.
1061
+ */
1062
+ current_billing_period_start_date: string | null;
1063
+ /**
1064
+ * The end date of the price interval. This is the date that Orb stops billing for
1065
+ * this price.
1066
+ */
1067
+ end_date: string | null;
1068
+ /**
1069
+ * An additional filter to apply to usage queries.
1070
+ */
1071
+ filter: string | null;
1072
+ /**
1073
+ * The fixed fee quantity transitions for this price interval. This is only
1074
+ * relevant for fixed fees.
1075
+ */
1076
+ fixed_fee_quantity_transitions: Array<PriceInterval.FixedFeeQuantityTransition> | null;
1077
+ /**
1078
+ * The Price resource represents a price that can be billed on a subscription,
1079
+ * resulting in a charge on an invoice in the form of an invoice line item. Prices
1080
+ * take a quantity and determine an amount to bill.
1081
+ *
1082
+ * Orb supports a few different pricing models out of the box. Each of these models
1083
+ * is serialized differently in a given Price object. The model_type field
1084
+ * determines the key for the configuration object that is present.
1085
+ *
1086
+ * For more on the types of prices, see
1087
+ * [the core concepts documentation](/core-concepts#plan-and-price)
1088
+ */
1089
+ price: PricesAPI.Price;
1090
+ /**
1091
+ * The start date of the price interval. This is the date that Orb starts billing
1092
+ * for this price.
1093
+ */
1094
+ start_date: string;
1095
+ /**
1096
+ * A list of customer IDs whose usage events will be aggregated and billed under
1097
+ * this price interval.
1098
+ */
1099
+ usage_customer_ids: Array<string> | null;
1100
+ }
1101
+ namespace PriceInterval {
1102
+ interface FixedFeeQuantityTransition {
1103
+ effective_date: string;
1104
+ price_id: string;
1105
+ quantity: number;
1106
+ }
1107
+ }
1108
+ interface RedeemedCoupon {
1109
+ coupon_id: string;
1110
+ end_date: string | null;
1111
+ start_date: string;
1112
+ }
1113
+ interface TrialInfo {
1114
+ end_date: string | null;
1115
+ }
1116
+ /**
1117
+ * The resources that were changed as part of this operation. Only present when
1118
+ * fetched through the subscription changes API or if the
1119
+ * `include_changed_resources` parameter was passed in the request.
1120
+ */
1121
+ interface ChangedResources {
1122
+ /**
1123
+ * The credit notes that were created as part of this operation.
1124
+ */
1125
+ created_credit_notes: Array<CreditNotesAPI.CreditNote>;
1126
+ /**
1127
+ * The invoices that were created as part of this operation.
1128
+ */
1129
+ created_invoices: Array<InvoicesAPI.Invoice>;
1130
+ /**
1131
+ * The credit notes that were voided as part of this operation.
1132
+ */
1133
+ voided_credit_notes: Array<CreditNotesAPI.CreditNote>;
1134
+ /**
1135
+ * The invoices that were voided as part of this operation.
1136
+ */
1137
+ voided_invoices: Array<InvoicesAPI.Invoice>;
1138
+ }
1139
+ }
1140
+ }
1141
+ /**
1142
+ * A subscription change represents a desired new subscription / pending change to
1143
+ * an existing subscription. It is a way to first preview the effects on the
1144
+ * subscription as well as any changes/creation of invoices (see
1145
+ * `subscription.changed_resources`).
1146
+ */
1147
+ export interface SubscriptionChangeCancelResponse {
1148
+ id: string;
1149
+ /**
1150
+ * Subscription change will be cancelled at this time and can no longer be applied.
1151
+ */
1152
+ expiration_time: string;
1153
+ status: 'pending' | 'applied' | 'cancelled';
1154
+ subscription: SubscriptionChangeCancelResponse.Subscription | null;
1155
+ /**
1156
+ * When this change was applied.
1157
+ */
1158
+ applied_at?: string | null;
1159
+ /**
1160
+ * When this change was cancelled.
1161
+ */
1162
+ cancelled_at?: string | null;
1163
+ }
1164
+ export declare namespace SubscriptionChangeCancelResponse {
1165
+ interface Subscription {
1166
+ id: string;
1167
+ /**
1168
+ * The current plan phase that is active, only if the subscription's plan has
1169
+ * phases.
1170
+ */
1171
+ active_plan_phase_order: number | null;
1172
+ /**
1173
+ * The adjustment intervals for this subscription sorted by the start_date of the
1174
+ * adjustment interval.
1175
+ */
1176
+ adjustment_intervals: Array<Subscription.AdjustmentInterval>;
1177
+ /**
1178
+ * Determines whether issued invoices for this subscription will automatically be
1179
+ * charged with the saved payment method on the due date. This property defaults to
1180
+ * the plan's behavior. If null, defaults to the customer's setting.
1181
+ */
1182
+ auto_collection: boolean | null;
1183
+ billing_cycle_anchor_configuration: Subscription.BillingCycleAnchorConfiguration;
1184
+ /**
1185
+ * The day of the month on which the billing cycle is anchored. If the maximum
1186
+ * number of days in a month is greater than this value, the last day of the month
1187
+ * is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing
1188
+ * period begins on the 30th.
1189
+ */
1190
+ billing_cycle_day: number;
1191
+ created_at: string;
1192
+ /**
1193
+ * The end of the current billing period. This is an exclusive timestamp, such that
1194
+ * the instant returned is not part of the billing period. Set to null for
1195
+ * subscriptions that are not currently active.
1196
+ */
1197
+ current_billing_period_end_date: string | null;
1198
+ /**
1199
+ * The start date of the current billing period. This is an inclusive timestamp;
1200
+ * the instant returned is exactly the beginning of the billing period. Set to null
1201
+ * if the subscription is not currently active.
1202
+ */
1203
+ current_billing_period_start_date: string | null;
1204
+ /**
1205
+ * A customer is a buyer of your products, and the other party to the billing
1206
+ * relationship.
1207
+ *
1208
+ * In Orb, customers are assigned system generated identifiers automatically, but
1209
+ * it's often desirable to have these match existing identifiers in your system. To
1210
+ * avoid having to denormalize Orb ID information, you can pass in an
1211
+ * `external_customer_id` with your own identifier. See
1212
+ * [Customer ID Aliases](/events-and-metrics/customer-aliases) for further
1213
+ * information about how these aliases work in Orb.
1214
+ *
1215
+ * In addition to having an identifier in your system, a customer may exist in a
1216
+ * payment provider solution like Stripe. Use the `payment_provider_id` and the
1217
+ * `payment_provider` enum field to express this mapping.
1218
+ *
1219
+ * A customer also has a timezone (from the standard
1220
+ * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to
1221
+ * your account's timezone. See [Timezone localization](/essentials/timezones) for
1222
+ * information on what this timezone parameter influences within Orb.
1223
+ */
1224
+ customer: CustomersAPI.Customer;
1225
+ /**
1226
+ * Determines the default memo on this subscriptions' invoices. Note that if this
1227
+ * is not provided, it is determined by the plan configuration.
1228
+ */
1229
+ default_invoice_memo: string | null;
1230
+ /**
1231
+ * The discount intervals for this subscription sorted by the start_date.
1232
+ */
1233
+ discount_intervals: Array<Subscription.AmountDiscountInterval | Subscription.PercentageDiscountInterval | Subscription.UsageDiscountInterval>;
1234
+ /**
1235
+ * The date Orb stops billing for this subscription.
1236
+ */
1237
+ end_date: string | null;
1238
+ fixed_fee_quantity_schedule: Array<Subscription.FixedFeeQuantitySchedule>;
1239
+ invoicing_threshold: string | null;
1240
+ /**
1241
+ * The maximum intervals for this subscription sorted by the start_date.
1242
+ */
1243
+ maximum_intervals: Array<Subscription.MaximumInterval>;
1244
+ /**
1245
+ * User specified key-value pairs for the resource. If not present, this defaults
1246
+ * to an empty dictionary. Individual keys can be removed by setting the value to
1247
+ * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
1248
+ * `null`.
1249
+ */
1250
+ metadata: Record<string, string>;
1251
+ /**
1252
+ * The minimum intervals for this subscription sorted by the start_date.
1253
+ */
1254
+ minimum_intervals: Array<Subscription.MinimumInterval>;
1255
+ /**
1256
+ * Determines the difference between the invoice issue date for subscription
1257
+ * invoices as the date that they are due. A value of `0` here represents that the
1258
+ * invoice is due on issue, whereas a value of `30` represents that the customer
1259
+ * has a month to pay the invoice.
1260
+ */
1261
+ net_terms: number;
1262
+ /**
1263
+ * A pending subscription change if one exists on this subscription.
1264
+ */
1265
+ pending_subscription_change: Subscription.PendingSubscriptionChange | null;
1266
+ /**
1267
+ * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
1268
+ * subscribed to by a customer. Plans define the billing behavior of the
1269
+ * subscription. You can see more about how to configure prices in the
1270
+ * [Price resource](/reference/price).
1271
+ */
1272
+ plan: PlansAPI.Plan;
1273
+ /**
1274
+ * The price intervals for this subscription.
1275
+ */
1276
+ price_intervals: Array<Subscription.PriceInterval>;
1277
+ redeemed_coupon: Subscription.RedeemedCoupon | null;
1278
+ /**
1279
+ * The date Orb starts billing for this subscription.
1280
+ */
1281
+ start_date: string;
1282
+ status: 'active' | 'ended' | 'upcoming';
1283
+ trial_info: Subscription.TrialInfo;
1284
+ /**
1285
+ * The resources that were changed as part of this operation. Only present when
1286
+ * fetched through the subscription changes API or if the
1287
+ * `include_changed_resources` parameter was passed in the request.
1288
+ */
1289
+ changed_resources?: Subscription.ChangedResources | null;
1290
+ }
1291
+ namespace Subscription {
1292
+ interface AdjustmentInterval {
1293
+ id: string;
1294
+ adjustment: AdjustmentInterval.PlanPhaseUsageDiscountAdjustment | AdjustmentInterval.PlanPhaseAmountDiscountAdjustment | AdjustmentInterval.PlanPhasePercentageDiscountAdjustment | AdjustmentInterval.PlanPhaseMinimumAdjustment | AdjustmentInterval.PlanPhaseMaximumAdjustment;
1295
+ /**
1296
+ * The price interval IDs that this adjustment applies to.
1297
+ */
1298
+ applies_to_price_interval_ids: Array<string>;
1299
+ /**
1300
+ * The end date of the adjustment interval.
1301
+ */
1302
+ end_date: string | null;
1303
+ /**
1304
+ * The start date of the adjustment interval.
1305
+ */
1306
+ start_date: string;
1307
+ }
1308
+ namespace AdjustmentInterval {
1309
+ interface PlanPhaseUsageDiscountAdjustment {
1310
+ id: string;
1311
+ adjustment_type: 'usage_discount';
1312
+ /**
1313
+ * The price IDs that this adjustment applies to.
1314
+ */
1315
+ applies_to_price_ids: Array<string>;
1316
+ /**
1317
+ * True for adjustments that apply to an entire invocice, false for adjustments
1318
+ * that apply to only one price.
1319
+ */
1320
+ is_invoice_level: boolean;
1321
+ /**
1322
+ * The plan phase in which this adjustment is active.
1323
+ */
1324
+ plan_phase_order: number | null;
1325
+ /**
1326
+ * The reason for the adjustment.
1327
+ */
1328
+ reason: string | null;
1329
+ /**
1330
+ * The number of usage units by which to discount the price this adjustment applies
1331
+ * to in a given billing period.
1332
+ */
1333
+ usage_discount: number;
1334
+ }
1335
+ interface PlanPhaseAmountDiscountAdjustment {
1336
+ id: string;
1337
+ adjustment_type: 'amount_discount';
1338
+ /**
1339
+ * The amount by which to discount the prices this adjustment applies to in a given
1340
+ * billing period.
1341
+ */
1342
+ amount_discount: string;
1343
+ /**
1344
+ * The price IDs that this adjustment applies to.
1345
+ */
1346
+ applies_to_price_ids: Array<string>;
1347
+ /**
1348
+ * True for adjustments that apply to an entire invocice, false for adjustments
1349
+ * that apply to only one price.
1350
+ */
1351
+ is_invoice_level: boolean;
1352
+ /**
1353
+ * The plan phase in which this adjustment is active.
1354
+ */
1355
+ plan_phase_order: number | null;
1356
+ /**
1357
+ * The reason for the adjustment.
1358
+ */
1359
+ reason: string | null;
1360
+ }
1361
+ interface PlanPhasePercentageDiscountAdjustment {
1362
+ id: string;
1363
+ adjustment_type: 'percentage_discount';
1364
+ /**
1365
+ * The price IDs that this adjustment applies to.
1366
+ */
1367
+ applies_to_price_ids: Array<string>;
1368
+ /**
1369
+ * True for adjustments that apply to an entire invocice, false for adjustments
1370
+ * that apply to only one price.
1371
+ */
1372
+ is_invoice_level: boolean;
1373
+ /**
1374
+ * The percentage (as a value between 0 and 1) by which to discount the price
1375
+ * intervals this adjustment applies to in a given billing period.
1376
+ */
1377
+ percentage_discount: number;
1378
+ /**
1379
+ * The plan phase in which this adjustment is active.
1380
+ */
1381
+ plan_phase_order: number | null;
1382
+ /**
1383
+ * The reason for the adjustment.
1384
+ */
1385
+ reason: string | null;
1386
+ }
1387
+ interface PlanPhaseMinimumAdjustment {
1388
+ id: string;
1389
+ adjustment_type: 'minimum';
1390
+ /**
1391
+ * The price IDs that this adjustment applies to.
1392
+ */
1393
+ applies_to_price_ids: Array<string>;
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
+ * The item ID that revenue from this minimum will be attributed to.
1401
+ */
1402
+ item_id: string;
1403
+ /**
1404
+ * The minimum amount to charge in a given billing period for the prices this
1405
+ * adjustment applies to.
1406
+ */
1407
+ minimum_amount: string;
1408
+ /**
1409
+ * The plan phase in which this adjustment is active.
1410
+ */
1411
+ plan_phase_order: number | null;
1412
+ /**
1413
+ * The reason for the adjustment.
1414
+ */
1415
+ reason: string | null;
1416
+ }
1417
+ interface PlanPhaseMaximumAdjustment {
1418
+ id: string;
1419
+ adjustment_type: 'maximum';
1420
+ /**
1421
+ * The price IDs that this adjustment applies to.
1422
+ */
1423
+ applies_to_price_ids: Array<string>;
1424
+ /**
1425
+ * True for adjustments that apply to an entire invocice, false for adjustments
1426
+ * that apply to only one price.
1427
+ */
1428
+ is_invoice_level: boolean;
1429
+ /**
1430
+ * The maximum amount to charge in a given billing period for the prices this
1431
+ * adjustment applies to.
1432
+ */
1433
+ maximum_amount: string;
1434
+ /**
1435
+ * The plan phase in which this adjustment is active.
1436
+ */
1437
+ plan_phase_order: number | null;
1438
+ /**
1439
+ * The reason for the adjustment.
1440
+ */
1441
+ reason: string | null;
1442
+ }
1443
+ }
1444
+ interface BillingCycleAnchorConfiguration {
1445
+ /**
1446
+ * The day of the month on which the billing cycle is anchored. If the maximum
1447
+ * number of days in a month is greater than this value, the last day of the month
1448
+ * is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing
1449
+ * period begins on the 30th.
1450
+ */
1451
+ day: number;
1452
+ /**
1453
+ * The month on which the billing cycle is anchored (e.g. a quarterly price
1454
+ * anchored in February would have cycles starting February, May, August, and
1455
+ * November).
1456
+ */
1457
+ month?: number | null;
1458
+ /**
1459
+ * The year on which the billing cycle is anchored (e.g. a 2 year billing cycle
1460
+ * anchored on 2021 would have cycles starting on 2021, 2023, 2025, etc.).
1461
+ */
1462
+ year?: number | null;
1463
+ }
1464
+ interface AmountDiscountInterval {
1465
+ /**
1466
+ * Only available if discount_type is `amount`.
1467
+ */
1468
+ amount_discount: string;
1469
+ /**
1470
+ * The price ids that this discount interval applies to.
1471
+ */
1472
+ applies_to_price_ids: Array<string>;
1473
+ /**
1474
+ * The price interval ids that this discount interval applies to.
1475
+ */
1476
+ applies_to_price_interval_ids: Array<string>;
1477
+ discount_type: 'amount';
1478
+ /**
1479
+ * The end date of the discount interval.
1480
+ */
1481
+ end_date: string | null;
1482
+ /**
1483
+ * The start date of the discount interval.
1484
+ */
1485
+ start_date: string;
1486
+ }
1487
+ interface PercentageDiscountInterval {
1488
+ /**
1489
+ * The price ids that this discount interval applies to.
1490
+ */
1491
+ applies_to_price_ids: Array<string>;
1492
+ /**
1493
+ * The price interval ids that this discount interval applies to.
1494
+ */
1495
+ applies_to_price_interval_ids: Array<string>;
1496
+ discount_type: 'percentage';
1497
+ /**
1498
+ * The end date of the discount interval.
1499
+ */
1500
+ end_date: string | null;
1501
+ /**
1502
+ * Only available if discount_type is `percentage`.This is a number between 0
1503
+ * and 1.
1504
+ */
1505
+ percentage_discount: number;
1506
+ /**
1507
+ * The start date of the discount interval.
1508
+ */
1509
+ start_date: string;
1510
+ }
1511
+ interface UsageDiscountInterval {
1512
+ /**
1513
+ * The price ids that this discount interval applies to.
1514
+ */
1515
+ applies_to_price_ids: Array<string>;
1516
+ /**
1517
+ * The price interval ids that this discount interval applies to.
1518
+ */
1519
+ applies_to_price_interval_ids: Array<string>;
1520
+ discount_type: 'usage';
1521
+ /**
1522
+ * The end date of the discount interval.
1523
+ */
1524
+ end_date: string | null;
1525
+ /**
1526
+ * The start date of the discount interval.
1527
+ */
1528
+ start_date: string;
1529
+ /**
1530
+ * Only available if discount_type is `usage`. Number of usage units that this
1531
+ * discount is for
1532
+ */
1533
+ usage_discount: number;
1534
+ }
1535
+ interface FixedFeeQuantitySchedule {
1536
+ end_date: string | null;
1537
+ price_id: string;
1538
+ quantity: number;
1539
+ start_date: string;
1540
+ }
1541
+ interface MaximumInterval {
1542
+ /**
1543
+ * The price ids that this maximum interval applies to.
1544
+ */
1545
+ applies_to_price_ids: Array<string>;
1546
+ /**
1547
+ * The price interval ids that this maximum interval applies to.
1548
+ */
1549
+ applies_to_price_interval_ids: Array<string>;
1550
+ /**
1551
+ * The end date of the maximum interval.
1552
+ */
1553
+ end_date: string | null;
1554
+ /**
1555
+ * The maximum amount to charge in a given billing period for the price intervals
1556
+ * this transform applies to.
1557
+ */
1558
+ maximum_amount: string;
1559
+ /**
1560
+ * The start date of the maximum interval.
1561
+ */
1562
+ start_date: string;
1563
+ }
1564
+ interface MinimumInterval {
1565
+ /**
1566
+ * The price ids that this minimum interval applies to.
1567
+ */
1568
+ applies_to_price_ids: Array<string>;
1569
+ /**
1570
+ * The price interval ids that this minimum interval applies to.
1571
+ */
1572
+ applies_to_price_interval_ids: Array<string>;
1573
+ /**
1574
+ * The end date of the minimum interval.
1575
+ */
1576
+ end_date: string | null;
1577
+ /**
1578
+ * The minimum amount to charge in a given billing period for the price intervals
1579
+ * this minimum applies to.
1580
+ */
1581
+ minimum_amount: string;
1582
+ /**
1583
+ * The start date of the minimum interval.
1584
+ */
1585
+ start_date: string;
1586
+ }
1587
+ /**
1588
+ * A pending subscription change if one exists on this subscription.
1589
+ */
1590
+ interface PendingSubscriptionChange {
1591
+ id: string;
1592
+ }
1593
+ /**
1594
+ * The Price Interval resource represents a period of time for which a price will
1595
+ * bill on a subscription. A subscription’s price intervals define its billing
1596
+ * behavior.
1597
+ */
1598
+ interface PriceInterval {
1599
+ id: string;
1600
+ /**
1601
+ * The day of the month that Orb bills for this price
1602
+ */
1603
+ billing_cycle_day: number;
1604
+ /**
1605
+ * The end of the current billing period. This is an exclusive timestamp, such that
1606
+ * the instant returned is exactly the end of the billing period. Set to null if
1607
+ * this price interval is not currently active.
1608
+ */
1609
+ current_billing_period_end_date: string | null;
1610
+ /**
1611
+ * The start date of the current billing period. This is an inclusive timestamp;
1612
+ * the instant returned is exactly the beginning of the billing period. Set to null
1613
+ * if this price interval is not currently active.
1614
+ */
1615
+ current_billing_period_start_date: string | null;
1616
+ /**
1617
+ * The end date of the price interval. This is the date that Orb stops billing for
1618
+ * this price.
1619
+ */
1620
+ end_date: string | null;
1621
+ /**
1622
+ * An additional filter to apply to usage queries.
1623
+ */
1624
+ filter: string | null;
1625
+ /**
1626
+ * The fixed fee quantity transitions for this price interval. This is only
1627
+ * relevant for fixed fees.
1628
+ */
1629
+ fixed_fee_quantity_transitions: Array<PriceInterval.FixedFeeQuantityTransition> | null;
1630
+ /**
1631
+ * The Price resource represents a price that can be billed on a subscription,
1632
+ * resulting in a charge on an invoice in the form of an invoice line item. Prices
1633
+ * take a quantity and determine an amount to bill.
1634
+ *
1635
+ * Orb supports a few different pricing models out of the box. Each of these models
1636
+ * is serialized differently in a given Price object. The model_type field
1637
+ * determines the key for the configuration object that is present.
1638
+ *
1639
+ * For more on the types of prices, see
1640
+ * [the core concepts documentation](/core-concepts#plan-and-price)
1641
+ */
1642
+ price: PricesAPI.Price;
1643
+ /**
1644
+ * The start date of the price interval. This is the date that Orb starts billing
1645
+ * for this price.
1646
+ */
1647
+ start_date: string;
1648
+ /**
1649
+ * A list of customer IDs whose usage events will be aggregated and billed under
1650
+ * this price interval.
1651
+ */
1652
+ usage_customer_ids: Array<string> | null;
1653
+ }
1654
+ namespace PriceInterval {
1655
+ interface FixedFeeQuantityTransition {
1656
+ effective_date: string;
1657
+ price_id: string;
1658
+ quantity: number;
1659
+ }
1660
+ }
1661
+ interface RedeemedCoupon {
1662
+ coupon_id: string;
1663
+ end_date: string | null;
1664
+ start_date: string;
1665
+ }
1666
+ interface TrialInfo {
1667
+ end_date: string | null;
1668
+ }
1669
+ /**
1670
+ * The resources that were changed as part of this operation. Only present when
1671
+ * fetched through the subscription changes API or if the
1672
+ * `include_changed_resources` parameter was passed in the request.
1673
+ */
1674
+ interface ChangedResources {
1675
+ /**
1676
+ * The credit notes that were created as part of this operation.
1677
+ */
1678
+ created_credit_notes: Array<CreditNotesAPI.CreditNote>;
1679
+ /**
1680
+ * The invoices that were created as part of this operation.
1681
+ */
1682
+ created_invoices: Array<InvoicesAPI.Invoice>;
1683
+ /**
1684
+ * The credit notes that were voided as part of this operation.
1685
+ */
1686
+ voided_credit_notes: Array<CreditNotesAPI.CreditNote>;
1687
+ /**
1688
+ * The invoices that were voided as part of this operation.
1689
+ */
1690
+ voided_invoices: Array<InvoicesAPI.Invoice>;
1691
+ }
1692
+ }
1693
+ }
1694
+ export interface SubscriptionChangeApplyParams {
1695
+ /**
1696
+ * Description to apply to the balance transaction representing this credit.
1697
+ */
1698
+ description?: string | null;
1699
+ /**
1700
+ * Amount already collected to apply to the customer's balance.
1701
+ */
1702
+ previously_collected_amount?: string | null;
1703
+ }
1704
+ export declare namespace SubscriptionChanges {
1705
+ export { type SubscriptionChangeRetrieveResponse as SubscriptionChangeRetrieveResponse, type SubscriptionChangeApplyResponse as SubscriptionChangeApplyResponse, type SubscriptionChangeCancelResponse as SubscriptionChangeCancelResponse, type SubscriptionChangeApplyParams as SubscriptionChangeApplyParams, };
1706
+ }
1707
+ //# sourceMappingURL=subscription-changes.d.ts.map