orb-billing 4.73.0 → 4.74.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 (42) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +18 -30
  3. package/index.d.mts +2 -2
  4. package/index.d.ts +2 -2
  5. package/index.d.ts.map +1 -1
  6. package/index.js.map +1 -1
  7. package/index.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/resources/customers/credits/top-ups.d.ts +24 -12
  10. package/resources/customers/credits/top-ups.d.ts.map +1 -1
  11. package/resources/customers/credits/top-ups.js.map +1 -1
  12. package/resources/customers/credits/top-ups.mjs.map +1 -1
  13. package/resources/events/events.d.ts +3 -3
  14. package/resources/events/events.d.ts.map +1 -1
  15. package/resources/index.d.ts +1 -1
  16. package/resources/index.d.ts.map +1 -1
  17. package/resources/index.js.map +1 -1
  18. package/resources/index.mjs.map +1 -1
  19. package/resources/invoice-line-items.d.ts +1 -1
  20. package/resources/invoice-line-items.d.ts.map +1 -1
  21. package/resources/invoices.d.ts +2 -2
  22. package/resources/invoices.d.ts.map +1 -1
  23. package/resources/prices/prices.d.ts +1 -1
  24. package/resources/prices/prices.d.ts.map +1 -1
  25. package/resources/subscriptions.d.ts +866 -129
  26. package/resources/subscriptions.d.ts.map +1 -1
  27. package/resources/subscriptions.js +6 -0
  28. package/resources/subscriptions.js.map +1 -1
  29. package/resources/subscriptions.mjs +6 -0
  30. package/resources/subscriptions.mjs.map +1 -1
  31. package/src/index.ts +4 -0
  32. package/src/resources/customers/credits/top-ups.ts +24 -12
  33. package/src/resources/events/events.ts +3 -3
  34. package/src/resources/index.ts +2 -0
  35. package/src/resources/invoice-line-items.ts +1 -1
  36. package/src/resources/invoices.ts +2 -2
  37. package/src/resources/prices/prices.ts +1 -1
  38. package/src/resources/subscriptions.ts +1120 -200
  39. package/src/version.ts +1 -1
  40. package/version.d.ts +1 -1
  41. package/version.js +1 -1
  42. package/version.mjs +1 -1
@@ -752,6 +752,17 @@ export class Subscriptions extends APIResource {
752
752
  return this._client.post(`/subscriptions/${subscriptionId}/price_intervals`, { body, ...options });
753
753
  }
754
754
 
755
+ /**
756
+ * Redeem a coupon effective at a given time.
757
+ */
758
+ redeemCoupon(
759
+ subscriptionId: string,
760
+ body: SubscriptionRedeemCouponParams,
761
+ options?: Core.RequestOptions,
762
+ ): Core.APIPromise<SubscriptionRedeemCouponResponse> {
763
+ return this._client.post(`/subscriptions/${subscriptionId}/redeem_coupon`, { body, ...options });
764
+ }
765
+
755
766
  /**
756
767
  * This endpoint can be used to change an existing subscription's plan. It returns
757
768
  * the serialized updated subscription object.
@@ -1931,91 +1942,976 @@ export namespace Subscription {
1931
1942
  export interface TrialInfo {
1932
1943
  end_date: string | null;
1933
1944
  }
1934
- }
1935
-
1936
- export type SubscriptionUsage =
1937
- | SubscriptionUsage.UngroupedSubscriptionUsage
1938
- | SubscriptionUsage.GroupedSubscriptionUsage;
1939
-
1940
- export namespace SubscriptionUsage {
1941
- export interface UngroupedSubscriptionUsage {
1942
- data: Array<UngroupedSubscriptionUsage.Data>;
1943
- }
1944
-
1945
- export namespace UngroupedSubscriptionUsage {
1946
- export interface Data {
1947
- billable_metric: Data.BillableMetric;
1948
-
1949
- usage: Array<Data.Usage>;
1950
-
1951
- view_mode: 'periodic' | 'cumulative';
1952
- }
1953
-
1954
- export namespace Data {
1955
- export interface BillableMetric {
1956
- id: string;
1957
-
1958
- name: string;
1959
- }
1960
-
1961
- export interface Usage {
1962
- quantity: number;
1963
-
1964
- timeframe_end: string;
1965
-
1966
- timeframe_start: string;
1967
- }
1968
- }
1969
- }
1970
-
1971
- export interface GroupedSubscriptionUsage {
1972
- data: Array<GroupedSubscriptionUsage.Data>;
1945
+ }
1946
+
1947
+ export type SubscriptionUsage =
1948
+ | SubscriptionUsage.UngroupedSubscriptionUsage
1949
+ | SubscriptionUsage.GroupedSubscriptionUsage;
1950
+
1951
+ export namespace SubscriptionUsage {
1952
+ export interface UngroupedSubscriptionUsage {
1953
+ data: Array<UngroupedSubscriptionUsage.Data>;
1954
+ }
1955
+
1956
+ export namespace UngroupedSubscriptionUsage {
1957
+ export interface Data {
1958
+ billable_metric: Data.BillableMetric;
1959
+
1960
+ usage: Array<Data.Usage>;
1961
+
1962
+ view_mode: 'periodic' | 'cumulative';
1963
+ }
1964
+
1965
+ export namespace Data {
1966
+ export interface BillableMetric {
1967
+ id: string;
1968
+
1969
+ name: string;
1970
+ }
1971
+
1972
+ export interface Usage {
1973
+ quantity: number;
1974
+
1975
+ timeframe_end: string;
1976
+
1977
+ timeframe_start: string;
1978
+ }
1979
+ }
1980
+ }
1981
+
1982
+ export interface GroupedSubscriptionUsage {
1983
+ data: Array<GroupedSubscriptionUsage.Data>;
1984
+
1985
+ pagination_metadata?: Shared.PaginationMetadata | null;
1986
+ }
1987
+
1988
+ export namespace GroupedSubscriptionUsage {
1989
+ export interface Data {
1990
+ billable_metric: Data.BillableMetric;
1991
+
1992
+ metric_group: Data.MetricGroup;
1993
+
1994
+ usage: Array<Data.Usage>;
1995
+
1996
+ view_mode: 'periodic' | 'cumulative';
1997
+ }
1998
+
1999
+ export namespace Data {
2000
+ export interface BillableMetric {
2001
+ id: string;
2002
+
2003
+ name: string;
2004
+ }
2005
+
2006
+ export interface MetricGroup {
2007
+ property_key: string;
2008
+
2009
+ property_value: string;
2010
+ }
2011
+
2012
+ export interface Usage {
2013
+ quantity: number;
2014
+
2015
+ timeframe_end: string;
2016
+
2017
+ timeframe_start: string;
2018
+ }
2019
+ }
2020
+ }
2021
+ }
2022
+
2023
+ export interface Subscriptions {
2024
+ data: Array<Subscription>;
2025
+
2026
+ pagination_metadata: Shared.PaginationMetadata;
2027
+ }
2028
+
2029
+ export interface SubscriptionCreateResponse {
2030
+ id: string;
2031
+
2032
+ /**
2033
+ * The current plan phase that is active, only if the subscription's plan has
2034
+ * phases.
2035
+ */
2036
+ active_plan_phase_order: number | null;
2037
+
2038
+ /**
2039
+ * The adjustment intervals for this subscription sorted by the start_date of the
2040
+ * adjustment interval.
2041
+ */
2042
+ adjustment_intervals: Array<SubscriptionCreateResponse.AdjustmentInterval>;
2043
+
2044
+ /**
2045
+ * Determines whether issued invoices for this subscription will automatically be
2046
+ * charged with the saved payment method on the due date. This property defaults to
2047
+ * the plan's behavior. If null, defaults to the customer's setting.
2048
+ */
2049
+ auto_collection: boolean | null;
2050
+
2051
+ billing_cycle_anchor_configuration: SubscriptionCreateResponse.BillingCycleAnchorConfiguration;
2052
+
2053
+ /**
2054
+ * The day of the month on which the billing cycle is anchored. If the maximum
2055
+ * number of days in a month is greater than this value, the last day of the month
2056
+ * is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing
2057
+ * period begins on the 30th.
2058
+ */
2059
+ billing_cycle_day: number;
2060
+
2061
+ created_at: string;
2062
+
2063
+ /**
2064
+ * The end of the current billing period. This is an exclusive timestamp, such that
2065
+ * the instant returned is not part of the billing period. Set to null for
2066
+ * subscriptions that are not currently active.
2067
+ */
2068
+ current_billing_period_end_date: string | null;
2069
+
2070
+ /**
2071
+ * The start date of the current billing period. This is an inclusive timestamp;
2072
+ * the instant returned is exactly the beginning of the billing period. Set to null
2073
+ * if the subscription is not currently active.
2074
+ */
2075
+ current_billing_period_start_date: string | null;
2076
+
2077
+ /**
2078
+ * A customer is a buyer of your products, and the other party to the billing
2079
+ * relationship.
2080
+ *
2081
+ * In Orb, customers are assigned system generated identifiers automatically, but
2082
+ * it's often desirable to have these match existing identifiers in your system. To
2083
+ * avoid having to denormalize Orb ID information, you can pass in an
2084
+ * `external_customer_id` with your own identifier. See
2085
+ * [Customer ID Aliases](/events-and-metrics/customer-aliases) for further
2086
+ * information about how these aliases work in Orb.
2087
+ *
2088
+ * In addition to having an identifier in your system, a customer may exist in a
2089
+ * payment provider solution like Stripe. Use the `payment_provider_id` and the
2090
+ * `payment_provider` enum field to express this mapping.
2091
+ *
2092
+ * A customer also has a timezone (from the standard
2093
+ * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to
2094
+ * your account's timezone. See [Timezone localization](/essentials/timezones) for
2095
+ * information on what this timezone parameter influences within Orb.
2096
+ */
2097
+ customer: CustomersAPI.Customer;
2098
+
2099
+ /**
2100
+ * Determines the default memo on this subscriptions' invoices. Note that if this
2101
+ * is not provided, it is determined by the plan configuration.
2102
+ */
2103
+ default_invoice_memo: string | null;
2104
+
2105
+ /**
2106
+ * @deprecated The discount intervals for this subscription sorted by the
2107
+ * start_date.
2108
+ */
2109
+ discount_intervals: Array<
2110
+ | SubscriptionCreateResponse.AmountDiscountInterval
2111
+ | SubscriptionCreateResponse.PercentageDiscountInterval
2112
+ | SubscriptionCreateResponse.UsageDiscountInterval
2113
+ >;
2114
+
2115
+ /**
2116
+ * The date Orb stops billing for this subscription.
2117
+ */
2118
+ end_date: string | null;
2119
+
2120
+ fixed_fee_quantity_schedule: Array<SubscriptionCreateResponse.FixedFeeQuantitySchedule>;
2121
+
2122
+ invoicing_threshold: string | null;
2123
+
2124
+ /**
2125
+ * @deprecated The maximum intervals for this subscription sorted by the
2126
+ * start_date.
2127
+ */
2128
+ maximum_intervals: Array<SubscriptionCreateResponse.MaximumInterval>;
2129
+
2130
+ /**
2131
+ * User specified key-value pairs for the resource. If not present, this defaults
2132
+ * to an empty dictionary. Individual keys can be removed by setting the value to
2133
+ * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
2134
+ * `null`.
2135
+ */
2136
+ metadata: Record<string, string>;
2137
+
2138
+ /**
2139
+ * @deprecated The minimum intervals for this subscription sorted by the
2140
+ * start_date.
2141
+ */
2142
+ minimum_intervals: Array<SubscriptionCreateResponse.MinimumInterval>;
2143
+
2144
+ /**
2145
+ * The name of the subscription.
2146
+ */
2147
+ name: string;
2148
+
2149
+ /**
2150
+ * Determines the difference between the invoice issue date for subscription
2151
+ * invoices as the date that they are due. A value of `0` here represents that the
2152
+ * invoice is due on issue, whereas a value of `30` represents that the customer
2153
+ * has a month to pay the invoice.
2154
+ */
2155
+ net_terms: number;
2156
+
2157
+ /**
2158
+ * A pending subscription change if one exists on this subscription.
2159
+ */
2160
+ pending_subscription_change: SubscriptionCreateResponse.PendingSubscriptionChange | null;
2161
+
2162
+ /**
2163
+ * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
2164
+ * subscribed to by a customer. Plans define the billing behavior of the
2165
+ * subscription. You can see more about how to configure prices in the
2166
+ * [Price resource](/reference/price).
2167
+ */
2168
+ plan: PlansAPI.Plan | null;
2169
+
2170
+ /**
2171
+ * The price intervals for this subscription.
2172
+ */
2173
+ price_intervals: Array<SubscriptionCreateResponse.PriceInterval>;
2174
+
2175
+ redeemed_coupon: SubscriptionCreateResponse.RedeemedCoupon | null;
2176
+
2177
+ /**
2178
+ * The date Orb starts billing for this subscription.
2179
+ */
2180
+ start_date: string;
2181
+
2182
+ status: 'active' | 'ended' | 'upcoming';
2183
+
2184
+ trial_info: SubscriptionCreateResponse.TrialInfo;
2185
+
2186
+ /**
2187
+ * The resources that were changed as part of this operation. Only present when
2188
+ * fetched through the subscription changes API or if the
2189
+ * `include_changed_resources` parameter was passed in the request.
2190
+ */
2191
+ changed_resources?: SubscriptionCreateResponse.ChangedResources | null;
2192
+ }
2193
+
2194
+ export namespace SubscriptionCreateResponse {
2195
+ export interface AdjustmentInterval {
2196
+ id: string;
2197
+
2198
+ adjustment:
2199
+ | AdjustmentInterval.PlanPhaseUsageDiscountAdjustment
2200
+ | AdjustmentInterval.PlanPhaseAmountDiscountAdjustment
2201
+ | AdjustmentInterval.PlanPhasePercentageDiscountAdjustment
2202
+ | AdjustmentInterval.PlanPhaseMinimumAdjustment
2203
+ | AdjustmentInterval.PlanPhaseMaximumAdjustment;
2204
+
2205
+ /**
2206
+ * The price interval IDs that this adjustment applies to.
2207
+ */
2208
+ applies_to_price_interval_ids: Array<string>;
2209
+
2210
+ /**
2211
+ * The end date of the adjustment interval.
2212
+ */
2213
+ end_date: string | null;
2214
+
2215
+ /**
2216
+ * The start date of the adjustment interval.
2217
+ */
2218
+ start_date: string;
2219
+ }
2220
+
2221
+ export namespace AdjustmentInterval {
2222
+ export interface PlanPhaseUsageDiscountAdjustment {
2223
+ id: string;
2224
+
2225
+ adjustment_type: 'usage_discount';
2226
+
2227
+ /**
2228
+ * @deprecated The price IDs that this adjustment applies to.
2229
+ */
2230
+ applies_to_price_ids: Array<string>;
2231
+
2232
+ /**
2233
+ * The filters that determine which prices to apply this adjustment to.
2234
+ */
2235
+ filters: Array<PlanPhaseUsageDiscountAdjustment.Filter>;
2236
+
2237
+ /**
2238
+ * True for adjustments that apply to an entire invocice, false for adjustments
2239
+ * that apply to only one price.
2240
+ */
2241
+ is_invoice_level: boolean;
2242
+
2243
+ /**
2244
+ * The plan phase in which this adjustment is active.
2245
+ */
2246
+ plan_phase_order: number | null;
2247
+
2248
+ /**
2249
+ * The reason for the adjustment.
2250
+ */
2251
+ reason: string | null;
2252
+
2253
+ /**
2254
+ * The number of usage units by which to discount the price this adjustment applies
2255
+ * to in a given billing period.
2256
+ */
2257
+ usage_discount: number;
2258
+ }
2259
+
2260
+ export namespace PlanPhaseUsageDiscountAdjustment {
2261
+ export interface Filter {
2262
+ /**
2263
+ * The property of the price to filter on.
2264
+ */
2265
+ field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
2266
+
2267
+ /**
2268
+ * Should prices that match the filter be included or excluded.
2269
+ */
2270
+ operator: 'includes' | 'excludes';
2271
+
2272
+ /**
2273
+ * The IDs or values that match this filter.
2274
+ */
2275
+ values: Array<string>;
2276
+ }
2277
+ }
2278
+
2279
+ export interface PlanPhaseAmountDiscountAdjustment {
2280
+ id: string;
2281
+
2282
+ adjustment_type: 'amount_discount';
2283
+
2284
+ /**
2285
+ * The amount by which to discount the prices this adjustment applies to in a given
2286
+ * billing period.
2287
+ */
2288
+ amount_discount: string;
2289
+
2290
+ /**
2291
+ * @deprecated The price IDs that this adjustment applies to.
2292
+ */
2293
+ applies_to_price_ids: Array<string>;
2294
+
2295
+ /**
2296
+ * The filters that determine which prices to apply this adjustment to.
2297
+ */
2298
+ filters: Array<PlanPhaseAmountDiscountAdjustment.Filter>;
2299
+
2300
+ /**
2301
+ * True for adjustments that apply to an entire invocice, false for adjustments
2302
+ * that apply to only one price.
2303
+ */
2304
+ is_invoice_level: boolean;
2305
+
2306
+ /**
2307
+ * The plan phase in which this adjustment is active.
2308
+ */
2309
+ plan_phase_order: number | null;
2310
+
2311
+ /**
2312
+ * The reason for the adjustment.
2313
+ */
2314
+ reason: string | null;
2315
+ }
2316
+
2317
+ export namespace PlanPhaseAmountDiscountAdjustment {
2318
+ export interface Filter {
2319
+ /**
2320
+ * The property of the price to filter on.
2321
+ */
2322
+ field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
2323
+
2324
+ /**
2325
+ * Should prices that match the filter be included or excluded.
2326
+ */
2327
+ operator: 'includes' | 'excludes';
2328
+
2329
+ /**
2330
+ * The IDs or values that match this filter.
2331
+ */
2332
+ values: Array<string>;
2333
+ }
2334
+ }
2335
+
2336
+ export interface PlanPhasePercentageDiscountAdjustment {
2337
+ id: string;
2338
+
2339
+ adjustment_type: 'percentage_discount';
2340
+
2341
+ /**
2342
+ * @deprecated The price IDs that this adjustment applies to.
2343
+ */
2344
+ applies_to_price_ids: Array<string>;
2345
+
2346
+ /**
2347
+ * The filters that determine which prices to apply this adjustment to.
2348
+ */
2349
+ filters: Array<PlanPhasePercentageDiscountAdjustment.Filter>;
2350
+
2351
+ /**
2352
+ * True for adjustments that apply to an entire invocice, false for adjustments
2353
+ * that apply to only one price.
2354
+ */
2355
+ is_invoice_level: boolean;
2356
+
2357
+ /**
2358
+ * The percentage (as a value between 0 and 1) by which to discount the price
2359
+ * intervals this adjustment applies to in a given billing period.
2360
+ */
2361
+ percentage_discount: number;
2362
+
2363
+ /**
2364
+ * The plan phase in which this adjustment is active.
2365
+ */
2366
+ plan_phase_order: number | null;
2367
+
2368
+ /**
2369
+ * The reason for the adjustment.
2370
+ */
2371
+ reason: string | null;
2372
+ }
2373
+
2374
+ export namespace PlanPhasePercentageDiscountAdjustment {
2375
+ export interface Filter {
2376
+ /**
2377
+ * The property of the price to filter on.
2378
+ */
2379
+ field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
2380
+
2381
+ /**
2382
+ * Should prices that match the filter be included or excluded.
2383
+ */
2384
+ operator: 'includes' | 'excludes';
2385
+
2386
+ /**
2387
+ * The IDs or values that match this filter.
2388
+ */
2389
+ values: Array<string>;
2390
+ }
2391
+ }
2392
+
2393
+ export interface PlanPhaseMinimumAdjustment {
2394
+ id: string;
2395
+
2396
+ adjustment_type: 'minimum';
2397
+
2398
+ /**
2399
+ * @deprecated The price IDs that this adjustment applies to.
2400
+ */
2401
+ applies_to_price_ids: Array<string>;
2402
+
2403
+ /**
2404
+ * The filters that determine which prices to apply this adjustment to.
2405
+ */
2406
+ filters: Array<PlanPhaseMinimumAdjustment.Filter>;
2407
+
2408
+ /**
2409
+ * True for adjustments that apply to an entire invocice, false for adjustments
2410
+ * that apply to only one price.
2411
+ */
2412
+ is_invoice_level: boolean;
2413
+
2414
+ /**
2415
+ * The item ID that revenue from this minimum will be attributed to.
2416
+ */
2417
+ item_id: string;
2418
+
2419
+ /**
2420
+ * The minimum amount to charge in a given billing period for the prices this
2421
+ * adjustment applies to.
2422
+ */
2423
+ minimum_amount: string;
2424
+
2425
+ /**
2426
+ * The plan phase in which this adjustment is active.
2427
+ */
2428
+ plan_phase_order: number | null;
2429
+
2430
+ /**
2431
+ * The reason for the adjustment.
2432
+ */
2433
+ reason: string | null;
2434
+ }
2435
+
2436
+ export namespace PlanPhaseMinimumAdjustment {
2437
+ export interface Filter {
2438
+ /**
2439
+ * The property of the price to filter on.
2440
+ */
2441
+ field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
2442
+
2443
+ /**
2444
+ * Should prices that match the filter be included or excluded.
2445
+ */
2446
+ operator: 'includes' | 'excludes';
2447
+
2448
+ /**
2449
+ * The IDs or values that match this filter.
2450
+ */
2451
+ values: Array<string>;
2452
+ }
2453
+ }
2454
+
2455
+ export interface PlanPhaseMaximumAdjustment {
2456
+ id: string;
2457
+
2458
+ adjustment_type: 'maximum';
2459
+
2460
+ /**
2461
+ * @deprecated The price IDs that this adjustment applies to.
2462
+ */
2463
+ applies_to_price_ids: Array<string>;
2464
+
2465
+ /**
2466
+ * The filters that determine which prices to apply this adjustment to.
2467
+ */
2468
+ filters: Array<PlanPhaseMaximumAdjustment.Filter>;
2469
+
2470
+ /**
2471
+ * True for adjustments that apply to an entire invocice, false for adjustments
2472
+ * that apply to only one price.
2473
+ */
2474
+ is_invoice_level: boolean;
2475
+
2476
+ /**
2477
+ * The maximum amount to charge in a given billing period for the prices this
2478
+ * adjustment applies to.
2479
+ */
2480
+ maximum_amount: string;
2481
+
2482
+ /**
2483
+ * The plan phase in which this adjustment is active.
2484
+ */
2485
+ plan_phase_order: number | null;
2486
+
2487
+ /**
2488
+ * The reason for the adjustment.
2489
+ */
2490
+ reason: string | null;
2491
+ }
2492
+
2493
+ export namespace PlanPhaseMaximumAdjustment {
2494
+ export interface Filter {
2495
+ /**
2496
+ * The property of the price to filter on.
2497
+ */
2498
+ field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
2499
+
2500
+ /**
2501
+ * Should prices that match the filter be included or excluded.
2502
+ */
2503
+ operator: 'includes' | 'excludes';
2504
+
2505
+ /**
2506
+ * The IDs or values that match this filter.
2507
+ */
2508
+ values: Array<string>;
2509
+ }
2510
+ }
2511
+ }
2512
+
2513
+ export interface BillingCycleAnchorConfiguration {
2514
+ /**
2515
+ * The day of the month on which the billing cycle is anchored. If the maximum
2516
+ * number of days in a month is greater than this value, the last day of the month
2517
+ * is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing
2518
+ * period begins on the 30th.
2519
+ */
2520
+ day: number;
2521
+
2522
+ /**
2523
+ * The month on which the billing cycle is anchored (e.g. a quarterly price
2524
+ * anchored in February would have cycles starting February, May, August, and
2525
+ * November).
2526
+ */
2527
+ month?: number | null;
2528
+
2529
+ /**
2530
+ * The year on which the billing cycle is anchored (e.g. a 2 year billing cycle
2531
+ * anchored on 2021 would have cycles starting on 2021, 2023, 2025, etc.).
2532
+ */
2533
+ year?: number | null;
2534
+ }
2535
+
2536
+ export interface AmountDiscountInterval {
2537
+ /**
2538
+ * Only available if discount_type is `amount`.
2539
+ */
2540
+ amount_discount: string;
2541
+
2542
+ /**
2543
+ * The price interval ids that this discount interval applies to.
2544
+ */
2545
+ applies_to_price_interval_ids: Array<string>;
2546
+
2547
+ discount_type: 'amount';
2548
+
2549
+ /**
2550
+ * The end date of the discount interval.
2551
+ */
2552
+ end_date: string | null;
2553
+
2554
+ /**
2555
+ * The filters that determine which prices this discount interval applies to.
2556
+ */
2557
+ filters: Array<AmountDiscountInterval.Filter>;
2558
+
2559
+ /**
2560
+ * The start date of the discount interval.
2561
+ */
2562
+ start_date: string;
2563
+ }
2564
+
2565
+ export namespace AmountDiscountInterval {
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 PercentageDiscountInterval {
2585
+ /**
2586
+ * The price interval ids that this discount interval applies to.
2587
+ */
2588
+ applies_to_price_interval_ids: Array<string>;
2589
+
2590
+ discount_type: 'percentage';
2591
+
2592
+ /**
2593
+ * The end date of the discount interval.
2594
+ */
2595
+ end_date: string | null;
2596
+
2597
+ /**
2598
+ * The filters that determine which prices this discount interval applies to.
2599
+ */
2600
+ filters: Array<PercentageDiscountInterval.Filter>;
2601
+
2602
+ /**
2603
+ * Only available if discount_type is `percentage`.This is a number between 0
2604
+ * and 1.
2605
+ */
2606
+ percentage_discount: number;
2607
+
2608
+ /**
2609
+ * The start date of the discount interval.
2610
+ */
2611
+ start_date: string;
2612
+ }
2613
+
2614
+ export namespace PercentageDiscountInterval {
2615
+ export interface Filter {
2616
+ /**
2617
+ * The property of the price to filter on.
2618
+ */
2619
+ field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
2620
+
2621
+ /**
2622
+ * Should prices that match the filter be included or excluded.
2623
+ */
2624
+ operator: 'includes' | 'excludes';
2625
+
2626
+ /**
2627
+ * The IDs or values that match this filter.
2628
+ */
2629
+ values: Array<string>;
2630
+ }
2631
+ }
2632
+
2633
+ export interface UsageDiscountInterval {
2634
+ /**
2635
+ * The price interval ids that this discount interval applies to.
2636
+ */
2637
+ applies_to_price_interval_ids: Array<string>;
2638
+
2639
+ discount_type: 'usage';
2640
+
2641
+ /**
2642
+ * The end date of the discount interval.
2643
+ */
2644
+ end_date: string | null;
2645
+
2646
+ /**
2647
+ * The filters that determine which prices this discount interval applies to.
2648
+ */
2649
+ filters: Array<UsageDiscountInterval.Filter>;
2650
+
2651
+ /**
2652
+ * The start date of the discount interval.
2653
+ */
2654
+ start_date: string;
2655
+
2656
+ /**
2657
+ * Only available if discount_type is `usage`. Number of usage units that this
2658
+ * discount is for
2659
+ */
2660
+ usage_discount: number;
2661
+ }
2662
+
2663
+ export namespace UsageDiscountInterval {
2664
+ export interface Filter {
2665
+ /**
2666
+ * The property of the price to filter on.
2667
+ */
2668
+ field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
2669
+
2670
+ /**
2671
+ * Should prices that match the filter be included or excluded.
2672
+ */
2673
+ operator: 'includes' | 'excludes';
2674
+
2675
+ /**
2676
+ * The IDs or values that match this filter.
2677
+ */
2678
+ values: Array<string>;
2679
+ }
2680
+ }
2681
+
2682
+ export interface FixedFeeQuantitySchedule {
2683
+ end_date: string | null;
2684
+
2685
+ price_id: string;
2686
+
2687
+ quantity: number;
2688
+
2689
+ start_date: string;
2690
+ }
2691
+
2692
+ export interface MaximumInterval {
2693
+ /**
2694
+ * The price interval ids that this maximum interval applies to.
2695
+ */
2696
+ applies_to_price_interval_ids: Array<string>;
2697
+
2698
+ /**
2699
+ * The end date of the maximum interval.
2700
+ */
2701
+ end_date: string | null;
2702
+
2703
+ /**
2704
+ * The filters that determine which prices this maximum interval applies to.
2705
+ */
2706
+ filters: Array<MaximumInterval.Filter>;
2707
+
2708
+ /**
2709
+ * The maximum amount to charge in a given billing period for the price intervals
2710
+ * this transform applies to.
2711
+ */
2712
+ maximum_amount: string;
2713
+
2714
+ /**
2715
+ * The start date of the maximum interval.
2716
+ */
2717
+ start_date: string;
2718
+ }
2719
+
2720
+ export namespace MaximumInterval {
2721
+ export interface Filter {
2722
+ /**
2723
+ * The property of the price to filter on.
2724
+ */
2725
+ field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
2726
+
2727
+ /**
2728
+ * Should prices that match the filter be included or excluded.
2729
+ */
2730
+ operator: 'includes' | 'excludes';
2731
+
2732
+ /**
2733
+ * The IDs or values that match this filter.
2734
+ */
2735
+ values: Array<string>;
2736
+ }
2737
+ }
2738
+
2739
+ export interface MinimumInterval {
2740
+ /**
2741
+ * The price interval ids that this minimum interval applies to.
2742
+ */
2743
+ applies_to_price_interval_ids: Array<string>;
2744
+
2745
+ /**
2746
+ * The end date of the minimum interval.
2747
+ */
2748
+ end_date: string | null;
2749
+
2750
+ /**
2751
+ * The filters that determine which prices this minimum interval applies to.
2752
+ */
2753
+ filters: Array<MinimumInterval.Filter>;
2754
+
2755
+ /**
2756
+ * The minimum amount to charge in a given billing period for the price intervals
2757
+ * this minimum applies to.
2758
+ */
2759
+ minimum_amount: string;
2760
+
2761
+ /**
2762
+ * The start date of the minimum interval.
2763
+ */
2764
+ start_date: string;
2765
+ }
2766
+
2767
+ export namespace MinimumInterval {
2768
+ export interface Filter {
2769
+ /**
2770
+ * The property of the price to filter on.
2771
+ */
2772
+ field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
2773
+
2774
+ /**
2775
+ * Should prices that match the filter be included or excluded.
2776
+ */
2777
+ operator: 'includes' | 'excludes';
2778
+
2779
+ /**
2780
+ * The IDs or values that match this filter.
2781
+ */
2782
+ values: Array<string>;
2783
+ }
2784
+ }
2785
+
2786
+ /**
2787
+ * A pending subscription change if one exists on this subscription.
2788
+ */
2789
+ export interface PendingSubscriptionChange {
2790
+ id: string;
2791
+ }
2792
+
2793
+ /**
2794
+ * The Price Interval resource represents a period of time for which a price will
2795
+ * bill on a subscription. A subscription’s price intervals define its billing
2796
+ * behavior.
2797
+ */
2798
+ export interface PriceInterval {
2799
+ id: string;
2800
+
2801
+ /**
2802
+ * The day of the month that Orb bills for this price
2803
+ */
2804
+ billing_cycle_day: number;
2805
+
2806
+ /**
2807
+ * The end of the current billing period. This is an exclusive timestamp, such that
2808
+ * the instant returned is exactly the end of the billing period. Set to null if
2809
+ * this price interval is not currently active.
2810
+ */
2811
+ current_billing_period_end_date: string | null;
2812
+
2813
+ /**
2814
+ * The start date of the current billing period. This is an inclusive timestamp;
2815
+ * the instant returned is exactly the beginning of the billing period. Set to null
2816
+ * if this price interval is not currently active.
2817
+ */
2818
+ current_billing_period_start_date: string | null;
2819
+
2820
+ /**
2821
+ * The end date of the price interval. This is the date that Orb stops billing for
2822
+ * this price.
2823
+ */
2824
+ end_date: string | null;
2825
+
2826
+ /**
2827
+ * An additional filter to apply to usage queries.
2828
+ */
2829
+ filter: string | null;
2830
+
2831
+ /**
2832
+ * The fixed fee quantity transitions for this price interval. This is only
2833
+ * relevant for fixed fees.
2834
+ */
2835
+ fixed_fee_quantity_transitions: Array<PriceInterval.FixedFeeQuantityTransition> | null;
2836
+
2837
+ /**
2838
+ * The Price resource represents a price that can be billed on a subscription,
2839
+ * resulting in a charge on an invoice in the form of an invoice line item. Prices
2840
+ * take a quantity and determine an amount to bill.
2841
+ *
2842
+ * Orb supports a few different pricing models out of the box. Each of these models
2843
+ * is serialized differently in a given Price object. The model_type field
2844
+ * determines the key for the configuration object that is present.
2845
+ *
2846
+ * For more on the types of prices, see
2847
+ * [the core concepts documentation](/core-concepts#plan-and-price)
2848
+ */
2849
+ price: PricesAPI.Price;
2850
+
2851
+ /**
2852
+ * The start date of the price interval. This is the date that Orb starts billing
2853
+ * for this price.
2854
+ */
2855
+ start_date: string;
2856
+
2857
+ /**
2858
+ * A list of customer IDs whose usage events will be aggregated and billed under
2859
+ * this price interval.
2860
+ */
2861
+ usage_customer_ids: Array<string> | null;
2862
+ }
2863
+
2864
+ export namespace PriceInterval {
2865
+ export interface FixedFeeQuantityTransition {
2866
+ effective_date: string;
2867
+
2868
+ price_id: string;
2869
+
2870
+ quantity: number;
2871
+ }
2872
+ }
2873
+
2874
+ export interface RedeemedCoupon {
2875
+ coupon_id: string;
2876
+
2877
+ end_date: string | null;
2878
+
2879
+ start_date: string;
2880
+ }
2881
+
2882
+ export interface TrialInfo {
2883
+ end_date: string | null;
2884
+ }
1973
2885
 
1974
- pagination_metadata?: Shared.PaginationMetadata | null;
1975
- }
1976
-
1977
- export namespace GroupedSubscriptionUsage {
1978
- export interface Data {
1979
- billable_metric: Data.BillableMetric;
1980
-
1981
- metric_group: Data.MetricGroup;
1982
-
1983
- usage: Array<Data.Usage>;
1984
-
1985
- view_mode: 'periodic' | 'cumulative';
1986
- }
1987
-
1988
- export namespace Data {
1989
- export interface BillableMetric {
1990
- id: string;
1991
-
1992
- name: string;
1993
- }
1994
-
1995
- export interface MetricGroup {
1996
- property_key: string;
1997
-
1998
- property_value: string;
1999
- }
2886
+ /**
2887
+ * The resources that were changed as part of this operation. Only present when
2888
+ * fetched through the subscription changes API or if the
2889
+ * `include_changed_resources` parameter was passed in the request.
2890
+ */
2891
+ export interface ChangedResources {
2892
+ /**
2893
+ * The credit notes that were created as part of this operation.
2894
+ */
2895
+ created_credit_notes: Array<CreditNotesAPI.CreditNote>;
2000
2896
 
2001
- export interface Usage {
2002
- quantity: number;
2897
+ /**
2898
+ * The invoices that were created as part of this operation.
2899
+ */
2900
+ created_invoices: Array<InvoicesAPI.Invoice>;
2003
2901
 
2004
- timeframe_end: string;
2902
+ /**
2903
+ * The credit notes that were voided as part of this operation.
2904
+ */
2905
+ voided_credit_notes: Array<CreditNotesAPI.CreditNote>;
2005
2906
 
2006
- timeframe_start: string;
2007
- }
2008
- }
2907
+ /**
2908
+ * The invoices that were voided as part of this operation.
2909
+ */
2910
+ voided_invoices: Array<InvoicesAPI.Invoice>;
2009
2911
  }
2010
2912
  }
2011
2913
 
2012
- export interface Subscriptions {
2013
- data: Array<Subscription>;
2014
-
2015
- pagination_metadata: Shared.PaginationMetadata;
2016
- }
2017
-
2018
- export interface SubscriptionCreateResponse {
2914
+ export interface SubscriptionCancelResponse {
2019
2915
  id: string;
2020
2916
 
2021
2917
  /**
@@ -2028,7 +2924,7 @@ export interface SubscriptionCreateResponse {
2028
2924
  * The adjustment intervals for this subscription sorted by the start_date of the
2029
2925
  * adjustment interval.
2030
2926
  */
2031
- adjustment_intervals: Array<SubscriptionCreateResponse.AdjustmentInterval>;
2927
+ adjustment_intervals: Array<SubscriptionCancelResponse.AdjustmentInterval>;
2032
2928
 
2033
2929
  /**
2034
2930
  * Determines whether issued invoices for this subscription will automatically be
@@ -2037,7 +2933,7 @@ export interface SubscriptionCreateResponse {
2037
2933
  */
2038
2934
  auto_collection: boolean | null;
2039
2935
 
2040
- billing_cycle_anchor_configuration: SubscriptionCreateResponse.BillingCycleAnchorConfiguration;
2936
+ billing_cycle_anchor_configuration: SubscriptionCancelResponse.BillingCycleAnchorConfiguration;
2041
2937
 
2042
2938
  /**
2043
2939
  * The day of the month on which the billing cycle is anchored. If the maximum
@@ -2096,9 +2992,9 @@ export interface SubscriptionCreateResponse {
2096
2992
  * start_date.
2097
2993
  */
2098
2994
  discount_intervals: Array<
2099
- | SubscriptionCreateResponse.AmountDiscountInterval
2100
- | SubscriptionCreateResponse.PercentageDiscountInterval
2101
- | SubscriptionCreateResponse.UsageDiscountInterval
2995
+ | SubscriptionCancelResponse.AmountDiscountInterval
2996
+ | SubscriptionCancelResponse.PercentageDiscountInterval
2997
+ | SubscriptionCancelResponse.UsageDiscountInterval
2102
2998
  >;
2103
2999
 
2104
3000
  /**
@@ -2106,7 +3002,7 @@ export interface SubscriptionCreateResponse {
2106
3002
  */
2107
3003
  end_date: string | null;
2108
3004
 
2109
- fixed_fee_quantity_schedule: Array<SubscriptionCreateResponse.FixedFeeQuantitySchedule>;
3005
+ fixed_fee_quantity_schedule: Array<SubscriptionCancelResponse.FixedFeeQuantitySchedule>;
2110
3006
 
2111
3007
  invoicing_threshold: string | null;
2112
3008
 
@@ -2114,7 +3010,7 @@ export interface SubscriptionCreateResponse {
2114
3010
  * @deprecated The maximum intervals for this subscription sorted by the
2115
3011
  * start_date.
2116
3012
  */
2117
- maximum_intervals: Array<SubscriptionCreateResponse.MaximumInterval>;
3013
+ maximum_intervals: Array<SubscriptionCancelResponse.MaximumInterval>;
2118
3014
 
2119
3015
  /**
2120
3016
  * User specified key-value pairs for the resource. If not present, this defaults
@@ -2128,7 +3024,7 @@ export interface SubscriptionCreateResponse {
2128
3024
  * @deprecated The minimum intervals for this subscription sorted by the
2129
3025
  * start_date.
2130
3026
  */
2131
- minimum_intervals: Array<SubscriptionCreateResponse.MinimumInterval>;
3027
+ minimum_intervals: Array<SubscriptionCancelResponse.MinimumInterval>;
2132
3028
 
2133
3029
  /**
2134
3030
  * The name of the subscription.
@@ -2146,7 +3042,7 @@ export interface SubscriptionCreateResponse {
2146
3042
  /**
2147
3043
  * A pending subscription change if one exists on this subscription.
2148
3044
  */
2149
- pending_subscription_change: SubscriptionCreateResponse.PendingSubscriptionChange | null;
3045
+ pending_subscription_change: SubscriptionCancelResponse.PendingSubscriptionChange | null;
2150
3046
 
2151
3047
  /**
2152
3048
  * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
@@ -2159,9 +3055,9 @@ export interface SubscriptionCreateResponse {
2159
3055
  /**
2160
3056
  * The price intervals for this subscription.
2161
3057
  */
2162
- price_intervals: Array<SubscriptionCreateResponse.PriceInterval>;
3058
+ price_intervals: Array<SubscriptionCancelResponse.PriceInterval>;
2163
3059
 
2164
- redeemed_coupon: SubscriptionCreateResponse.RedeemedCoupon | null;
3060
+ redeemed_coupon: SubscriptionCancelResponse.RedeemedCoupon | null;
2165
3061
 
2166
3062
  /**
2167
3063
  * The date Orb starts billing for this subscription.
@@ -2170,17 +3066,17 @@ export interface SubscriptionCreateResponse {
2170
3066
 
2171
3067
  status: 'active' | 'ended' | 'upcoming';
2172
3068
 
2173
- trial_info: SubscriptionCreateResponse.TrialInfo;
3069
+ trial_info: SubscriptionCancelResponse.TrialInfo;
2174
3070
 
2175
3071
  /**
2176
3072
  * The resources that were changed as part of this operation. Only present when
2177
3073
  * fetched through the subscription changes API or if the
2178
3074
  * `include_changed_resources` parameter was passed in the request.
2179
3075
  */
2180
- changed_resources?: SubscriptionCreateResponse.ChangedResources | null;
3076
+ changed_resources?: SubscriptionCancelResponse.ChangedResources | null;
2181
3077
  }
2182
3078
 
2183
- export namespace SubscriptionCreateResponse {
3079
+ export namespace SubscriptionCancelResponse {
2184
3080
  export interface AdjustmentInterval {
2185
3081
  id: string;
2186
3082
 
@@ -2900,7 +3796,85 @@ export namespace SubscriptionCreateResponse {
2900
3796
  }
2901
3797
  }
2902
3798
 
2903
- export interface SubscriptionCancelResponse {
3799
+ export interface SubscriptionFetchCostsResponse {
3800
+ data: Array<SubscriptionFetchCostsResponse.Data>;
3801
+ }
3802
+
3803
+ export namespace SubscriptionFetchCostsResponse {
3804
+ export interface Data {
3805
+ per_price_costs: Array<Data.PerPriceCost>;
3806
+
3807
+ /**
3808
+ * Total costs for the timeframe, excluding any minimums and discounts.
3809
+ */
3810
+ subtotal: string;
3811
+
3812
+ timeframe_end: string;
3813
+
3814
+ timeframe_start: string;
3815
+
3816
+ /**
3817
+ * Total costs for the timeframe, including any minimums and discounts.
3818
+ */
3819
+ total: string;
3820
+ }
3821
+
3822
+ export namespace Data {
3823
+ export interface PerPriceCost {
3824
+ /**
3825
+ * The price object
3826
+ */
3827
+ price: PricesAPI.Price;
3828
+
3829
+ /**
3830
+ * The price the cost is associated with
3831
+ */
3832
+ price_id: string;
3833
+
3834
+ /**
3835
+ * Price's contributions for the timeframe, excluding any minimums and discounts.
3836
+ */
3837
+ subtotal: string;
3838
+
3839
+ /**
3840
+ * Price's contributions for the timeframe, including minimums and discounts.
3841
+ */
3842
+ total: string;
3843
+
3844
+ /**
3845
+ * The price's quantity for the timeframe
3846
+ */
3847
+ quantity?: number | null;
3848
+ }
3849
+ }
3850
+ }
3851
+
3852
+ export interface SubscriptionFetchScheduleResponse {
3853
+ created_at: string;
3854
+
3855
+ end_date: string | null;
3856
+
3857
+ plan: SubscriptionFetchScheduleResponse.Plan | null;
3858
+
3859
+ start_date: string;
3860
+ }
3861
+
3862
+ export namespace SubscriptionFetchScheduleResponse {
3863
+ export interface Plan {
3864
+ id: string | null;
3865
+
3866
+ /**
3867
+ * An optional user-defined ID for this plan resource, used throughout the system
3868
+ * as an alias for this Plan. Use this field to identify a plan by an existing
3869
+ * identifier in your system.
3870
+ */
3871
+ external_plan_id: string | null;
3872
+
3873
+ name: string | null;
3874
+ }
3875
+ }
3876
+
3877
+ export interface SubscriptionPriceIntervalsResponse {
2904
3878
  id: string;
2905
3879
 
2906
3880
  /**
@@ -2913,7 +3887,7 @@ export interface SubscriptionCancelResponse {
2913
3887
  * The adjustment intervals for this subscription sorted by the start_date of the
2914
3888
  * adjustment interval.
2915
3889
  */
2916
- adjustment_intervals: Array<SubscriptionCancelResponse.AdjustmentInterval>;
3890
+ adjustment_intervals: Array<SubscriptionPriceIntervalsResponse.AdjustmentInterval>;
2917
3891
 
2918
3892
  /**
2919
3893
  * Determines whether issued invoices for this subscription will automatically be
@@ -2922,7 +3896,7 @@ export interface SubscriptionCancelResponse {
2922
3896
  */
2923
3897
  auto_collection: boolean | null;
2924
3898
 
2925
- billing_cycle_anchor_configuration: SubscriptionCancelResponse.BillingCycleAnchorConfiguration;
3899
+ billing_cycle_anchor_configuration: SubscriptionPriceIntervalsResponse.BillingCycleAnchorConfiguration;
2926
3900
 
2927
3901
  /**
2928
3902
  * The day of the month on which the billing cycle is anchored. If the maximum
@@ -2981,9 +3955,9 @@ export interface SubscriptionCancelResponse {
2981
3955
  * start_date.
2982
3956
  */
2983
3957
  discount_intervals: Array<
2984
- | SubscriptionCancelResponse.AmountDiscountInterval
2985
- | SubscriptionCancelResponse.PercentageDiscountInterval
2986
- | SubscriptionCancelResponse.UsageDiscountInterval
3958
+ | SubscriptionPriceIntervalsResponse.AmountDiscountInterval
3959
+ | SubscriptionPriceIntervalsResponse.PercentageDiscountInterval
3960
+ | SubscriptionPriceIntervalsResponse.UsageDiscountInterval
2987
3961
  >;
2988
3962
 
2989
3963
  /**
@@ -2991,7 +3965,7 @@ export interface SubscriptionCancelResponse {
2991
3965
  */
2992
3966
  end_date: string | null;
2993
3967
 
2994
- fixed_fee_quantity_schedule: Array<SubscriptionCancelResponse.FixedFeeQuantitySchedule>;
3968
+ fixed_fee_quantity_schedule: Array<SubscriptionPriceIntervalsResponse.FixedFeeQuantitySchedule>;
2995
3969
 
2996
3970
  invoicing_threshold: string | null;
2997
3971
 
@@ -2999,7 +3973,7 @@ export interface SubscriptionCancelResponse {
2999
3973
  * @deprecated The maximum intervals for this subscription sorted by the
3000
3974
  * start_date.
3001
3975
  */
3002
- maximum_intervals: Array<SubscriptionCancelResponse.MaximumInterval>;
3976
+ maximum_intervals: Array<SubscriptionPriceIntervalsResponse.MaximumInterval>;
3003
3977
 
3004
3978
  /**
3005
3979
  * User specified key-value pairs for the resource. If not present, this defaults
@@ -3013,7 +3987,7 @@ export interface SubscriptionCancelResponse {
3013
3987
  * @deprecated The minimum intervals for this subscription sorted by the
3014
3988
  * start_date.
3015
3989
  */
3016
- minimum_intervals: Array<SubscriptionCancelResponse.MinimumInterval>;
3990
+ minimum_intervals: Array<SubscriptionPriceIntervalsResponse.MinimumInterval>;
3017
3991
 
3018
3992
  /**
3019
3993
  * The name of the subscription.
@@ -3031,7 +4005,7 @@ export interface SubscriptionCancelResponse {
3031
4005
  /**
3032
4006
  * A pending subscription change if one exists on this subscription.
3033
4007
  */
3034
- pending_subscription_change: SubscriptionCancelResponse.PendingSubscriptionChange | null;
4008
+ pending_subscription_change: SubscriptionPriceIntervalsResponse.PendingSubscriptionChange | null;
3035
4009
 
3036
4010
  /**
3037
4011
  * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
@@ -3044,9 +4018,9 @@ export interface SubscriptionCancelResponse {
3044
4018
  /**
3045
4019
  * The price intervals for this subscription.
3046
4020
  */
3047
- price_intervals: Array<SubscriptionCancelResponse.PriceInterval>;
4021
+ price_intervals: Array<SubscriptionPriceIntervalsResponse.PriceInterval>;
3048
4022
 
3049
- redeemed_coupon: SubscriptionCancelResponse.RedeemedCoupon | null;
4023
+ redeemed_coupon: SubscriptionPriceIntervalsResponse.RedeemedCoupon | null;
3050
4024
 
3051
4025
  /**
3052
4026
  * The date Orb starts billing for this subscription.
@@ -3055,17 +4029,17 @@ export interface SubscriptionCancelResponse {
3055
4029
 
3056
4030
  status: 'active' | 'ended' | 'upcoming';
3057
4031
 
3058
- trial_info: SubscriptionCancelResponse.TrialInfo;
4032
+ trial_info: SubscriptionPriceIntervalsResponse.TrialInfo;
3059
4033
 
3060
4034
  /**
3061
4035
  * The resources that were changed as part of this operation. Only present when
3062
4036
  * fetched through the subscription changes API or if the
3063
4037
  * `include_changed_resources` parameter was passed in the request.
3064
4038
  */
3065
- changed_resources?: SubscriptionCancelResponse.ChangedResources | null;
4039
+ changed_resources?: SubscriptionPriceIntervalsResponse.ChangedResources | null;
3066
4040
  }
3067
4041
 
3068
- export namespace SubscriptionCancelResponse {
4042
+ export namespace SubscriptionPriceIntervalsResponse {
3069
4043
  export interface AdjustmentInterval {
3070
4044
  id: string;
3071
4045
 
@@ -3785,85 +4759,7 @@ export namespace SubscriptionCancelResponse {
3785
4759
  }
3786
4760
  }
3787
4761
 
3788
- export interface SubscriptionFetchCostsResponse {
3789
- data: Array<SubscriptionFetchCostsResponse.Data>;
3790
- }
3791
-
3792
- export namespace SubscriptionFetchCostsResponse {
3793
- export interface Data {
3794
- per_price_costs: Array<Data.PerPriceCost>;
3795
-
3796
- /**
3797
- * Total costs for the timeframe, excluding any minimums and discounts.
3798
- */
3799
- subtotal: string;
3800
-
3801
- timeframe_end: string;
3802
-
3803
- timeframe_start: string;
3804
-
3805
- /**
3806
- * Total costs for the timeframe, including any minimums and discounts.
3807
- */
3808
- total: string;
3809
- }
3810
-
3811
- export namespace Data {
3812
- export interface PerPriceCost {
3813
- /**
3814
- * The price object
3815
- */
3816
- price: PricesAPI.Price;
3817
-
3818
- /**
3819
- * The price the cost is associated with
3820
- */
3821
- price_id: string;
3822
-
3823
- /**
3824
- * Price's contributions for the timeframe, excluding any minimums and discounts.
3825
- */
3826
- subtotal: string;
3827
-
3828
- /**
3829
- * Price's contributions for the timeframe, including minimums and discounts.
3830
- */
3831
- total: string;
3832
-
3833
- /**
3834
- * The price's quantity for the timeframe
3835
- */
3836
- quantity?: number | null;
3837
- }
3838
- }
3839
- }
3840
-
3841
- export interface SubscriptionFetchScheduleResponse {
3842
- created_at: string;
3843
-
3844
- end_date: string | null;
3845
-
3846
- plan: SubscriptionFetchScheduleResponse.Plan | null;
3847
-
3848
- start_date: string;
3849
- }
3850
-
3851
- export namespace SubscriptionFetchScheduleResponse {
3852
- export interface Plan {
3853
- id: string | null;
3854
-
3855
- /**
3856
- * An optional user-defined ID for this plan resource, used throughout the system
3857
- * as an alias for this Plan. Use this field to identify a plan by an existing
3858
- * identifier in your system.
3859
- */
3860
- external_plan_id: string | null;
3861
-
3862
- name: string | null;
3863
- }
3864
- }
3865
-
3866
- export interface SubscriptionPriceIntervalsResponse {
4762
+ export interface SubscriptionRedeemCouponResponse {
3867
4763
  id: string;
3868
4764
 
3869
4765
  /**
@@ -3876,7 +4772,7 @@ export interface SubscriptionPriceIntervalsResponse {
3876
4772
  * The adjustment intervals for this subscription sorted by the start_date of the
3877
4773
  * adjustment interval.
3878
4774
  */
3879
- adjustment_intervals: Array<SubscriptionPriceIntervalsResponse.AdjustmentInterval>;
4775
+ adjustment_intervals: Array<SubscriptionRedeemCouponResponse.AdjustmentInterval>;
3880
4776
 
3881
4777
  /**
3882
4778
  * Determines whether issued invoices for this subscription will automatically be
@@ -3885,7 +4781,7 @@ export interface SubscriptionPriceIntervalsResponse {
3885
4781
  */
3886
4782
  auto_collection: boolean | null;
3887
4783
 
3888
- billing_cycle_anchor_configuration: SubscriptionPriceIntervalsResponse.BillingCycleAnchorConfiguration;
4784
+ billing_cycle_anchor_configuration: SubscriptionRedeemCouponResponse.BillingCycleAnchorConfiguration;
3889
4785
 
3890
4786
  /**
3891
4787
  * The day of the month on which the billing cycle is anchored. If the maximum
@@ -3944,9 +4840,9 @@ export interface SubscriptionPriceIntervalsResponse {
3944
4840
  * start_date.
3945
4841
  */
3946
4842
  discount_intervals: Array<
3947
- | SubscriptionPriceIntervalsResponse.AmountDiscountInterval
3948
- | SubscriptionPriceIntervalsResponse.PercentageDiscountInterval
3949
- | SubscriptionPriceIntervalsResponse.UsageDiscountInterval
4843
+ | SubscriptionRedeemCouponResponse.AmountDiscountInterval
4844
+ | SubscriptionRedeemCouponResponse.PercentageDiscountInterval
4845
+ | SubscriptionRedeemCouponResponse.UsageDiscountInterval
3950
4846
  >;
3951
4847
 
3952
4848
  /**
@@ -3954,7 +4850,7 @@ export interface SubscriptionPriceIntervalsResponse {
3954
4850
  */
3955
4851
  end_date: string | null;
3956
4852
 
3957
- fixed_fee_quantity_schedule: Array<SubscriptionPriceIntervalsResponse.FixedFeeQuantitySchedule>;
4853
+ fixed_fee_quantity_schedule: Array<SubscriptionRedeemCouponResponse.FixedFeeQuantitySchedule>;
3958
4854
 
3959
4855
  invoicing_threshold: string | null;
3960
4856
 
@@ -3962,7 +4858,7 @@ export interface SubscriptionPriceIntervalsResponse {
3962
4858
  * @deprecated The maximum intervals for this subscription sorted by the
3963
4859
  * start_date.
3964
4860
  */
3965
- maximum_intervals: Array<SubscriptionPriceIntervalsResponse.MaximumInterval>;
4861
+ maximum_intervals: Array<SubscriptionRedeemCouponResponse.MaximumInterval>;
3966
4862
 
3967
4863
  /**
3968
4864
  * User specified key-value pairs for the resource. If not present, this defaults
@@ -3976,7 +4872,7 @@ export interface SubscriptionPriceIntervalsResponse {
3976
4872
  * @deprecated The minimum intervals for this subscription sorted by the
3977
4873
  * start_date.
3978
4874
  */
3979
- minimum_intervals: Array<SubscriptionPriceIntervalsResponse.MinimumInterval>;
4875
+ minimum_intervals: Array<SubscriptionRedeemCouponResponse.MinimumInterval>;
3980
4876
 
3981
4877
  /**
3982
4878
  * The name of the subscription.
@@ -3994,7 +4890,7 @@ export interface SubscriptionPriceIntervalsResponse {
3994
4890
  /**
3995
4891
  * A pending subscription change if one exists on this subscription.
3996
4892
  */
3997
- pending_subscription_change: SubscriptionPriceIntervalsResponse.PendingSubscriptionChange | null;
4893
+ pending_subscription_change: SubscriptionRedeemCouponResponse.PendingSubscriptionChange | null;
3998
4894
 
3999
4895
  /**
4000
4896
  * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
@@ -4007,9 +4903,9 @@ export interface SubscriptionPriceIntervalsResponse {
4007
4903
  /**
4008
4904
  * The price intervals for this subscription.
4009
4905
  */
4010
- price_intervals: Array<SubscriptionPriceIntervalsResponse.PriceInterval>;
4906
+ price_intervals: Array<SubscriptionRedeemCouponResponse.PriceInterval>;
4011
4907
 
4012
- redeemed_coupon: SubscriptionPriceIntervalsResponse.RedeemedCoupon | null;
4908
+ redeemed_coupon: SubscriptionRedeemCouponResponse.RedeemedCoupon | null;
4013
4909
 
4014
4910
  /**
4015
4911
  * The date Orb starts billing for this subscription.
@@ -4018,17 +4914,17 @@ export interface SubscriptionPriceIntervalsResponse {
4018
4914
 
4019
4915
  status: 'active' | 'ended' | 'upcoming';
4020
4916
 
4021
- trial_info: SubscriptionPriceIntervalsResponse.TrialInfo;
4917
+ trial_info: SubscriptionRedeemCouponResponse.TrialInfo;
4022
4918
 
4023
4919
  /**
4024
4920
  * The resources that were changed as part of this operation. Only present when
4025
4921
  * fetched through the subscription changes API or if the
4026
4922
  * `include_changed_resources` parameter was passed in the request.
4027
4923
  */
4028
- changed_resources?: SubscriptionPriceIntervalsResponse.ChangedResources | null;
4924
+ changed_resources?: SubscriptionRedeemCouponResponse.ChangedResources | null;
4029
4925
  }
4030
4926
 
4031
- export namespace SubscriptionPriceIntervalsResponse {
4927
+ export namespace SubscriptionRedeemCouponResponse {
4032
4928
  export interface AdjustmentInterval {
4033
4929
  id: string;
4034
4930
 
@@ -24891,6 +25787,28 @@ export namespace SubscriptionPriceIntervalsParams {
24891
25787
  }
24892
25788
  }
24893
25789
 
25790
+ export interface SubscriptionRedeemCouponParams {
25791
+ change_option: 'requested_date' | 'end_of_subscription_term' | 'immediate';
25792
+
25793
+ /**
25794
+ * Coupon ID to be redeemed for this subscription.
25795
+ */
25796
+ coupon_id: string;
25797
+
25798
+ /**
25799
+ * If false, this request will fail if it would void an issued invoice or create a
25800
+ * credit note. Consider using this as a safety mechanism if you do not expect
25801
+ * existing invoices to be changed.
25802
+ */
25803
+ allow_invoice_credit_or_void?: boolean | null;
25804
+
25805
+ /**
25806
+ * The date that the coupon discount should take effect. This parameter can only be
25807
+ * passed if the `change_option` is `requested_date`.
25808
+ */
25809
+ change_date?: string | null;
25810
+ }
25811
+
24894
25812
  export interface SubscriptionSchedulePlanChangeParams {
24895
25813
  change_option: 'requested_date' | 'end_of_subscription_term' | 'immediate';
24896
25814
 
@@ -34242,6 +35160,7 @@ export declare namespace Subscriptions {
34242
35160
  type SubscriptionFetchCostsResponse as SubscriptionFetchCostsResponse,
34243
35161
  type SubscriptionFetchScheduleResponse as SubscriptionFetchScheduleResponse,
34244
35162
  type SubscriptionPriceIntervalsResponse as SubscriptionPriceIntervalsResponse,
35163
+ type SubscriptionRedeemCouponResponse as SubscriptionRedeemCouponResponse,
34245
35164
  type SubscriptionSchedulePlanChangeResponse as SubscriptionSchedulePlanChangeResponse,
34246
35165
  type SubscriptionTriggerPhaseResponse as SubscriptionTriggerPhaseResponse,
34247
35166
  type SubscriptionUnscheduleCancellationResponse as SubscriptionUnscheduleCancellationResponse,
@@ -34259,6 +35178,7 @@ export declare namespace Subscriptions {
34259
35178
  type SubscriptionFetchScheduleParams as SubscriptionFetchScheduleParams,
34260
35179
  type SubscriptionFetchUsageParams as SubscriptionFetchUsageParams,
34261
35180
  type SubscriptionPriceIntervalsParams as SubscriptionPriceIntervalsParams,
35181
+ type SubscriptionRedeemCouponParams as SubscriptionRedeemCouponParams,
34262
35182
  type SubscriptionSchedulePlanChangeParams as SubscriptionSchedulePlanChangeParams,
34263
35183
  type SubscriptionTriggerPhaseParams as SubscriptionTriggerPhaseParams,
34264
35184
  type SubscriptionUnscheduleFixedFeeQuantityUpdatesParams as SubscriptionUnscheduleFixedFeeQuantityUpdatesParams,