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
@@ -650,6 +650,10 @@ export declare class Subscriptions extends APIResource {
650
650
  * intervals.
651
651
  */
652
652
  priceIntervals(subscriptionId: string, body: SubscriptionPriceIntervalsParams, options?: Core.RequestOptions): Core.APIPromise<SubscriptionPriceIntervalsResponse>;
653
+ /**
654
+ * Redeem a coupon effective at a given time.
655
+ */
656
+ redeemCoupon(subscriptionId: string, body: SubscriptionRedeemCouponParams, options?: Core.RequestOptions): Core.APIPromise<SubscriptionRedeemCouponResponse>;
653
657
  /**
654
658
  * This endpoint can be used to change an existing subscription's plan. It returns
655
659
  * the serialized updated subscription object.
@@ -1636,39 +1640,754 @@ export declare namespace SubscriptionUsage {
1636
1640
  }
1637
1641
  }
1638
1642
  }
1639
- interface GroupedSubscriptionUsage {
1640
- data: Array<GroupedSubscriptionUsage.Data>;
1641
- pagination_metadata?: Shared.PaginationMetadata | null;
1643
+ interface GroupedSubscriptionUsage {
1644
+ data: Array<GroupedSubscriptionUsage.Data>;
1645
+ pagination_metadata?: Shared.PaginationMetadata | null;
1646
+ }
1647
+ namespace GroupedSubscriptionUsage {
1648
+ interface Data {
1649
+ billable_metric: Data.BillableMetric;
1650
+ metric_group: Data.MetricGroup;
1651
+ usage: Array<Data.Usage>;
1652
+ view_mode: 'periodic' | 'cumulative';
1653
+ }
1654
+ namespace Data {
1655
+ interface BillableMetric {
1656
+ id: string;
1657
+ name: string;
1658
+ }
1659
+ interface MetricGroup {
1660
+ property_key: string;
1661
+ property_value: string;
1662
+ }
1663
+ interface Usage {
1664
+ quantity: number;
1665
+ timeframe_end: string;
1666
+ timeframe_start: string;
1667
+ }
1668
+ }
1669
+ }
1670
+ }
1671
+ export interface Subscriptions {
1672
+ data: Array<Subscription>;
1673
+ pagination_metadata: Shared.PaginationMetadata;
1674
+ }
1675
+ export interface SubscriptionCreateResponse {
1676
+ id: string;
1677
+ /**
1678
+ * The current plan phase that is active, only if the subscription's plan has
1679
+ * phases.
1680
+ */
1681
+ active_plan_phase_order: number | null;
1682
+ /**
1683
+ * The adjustment intervals for this subscription sorted by the start_date of the
1684
+ * adjustment interval.
1685
+ */
1686
+ adjustment_intervals: Array<SubscriptionCreateResponse.AdjustmentInterval>;
1687
+ /**
1688
+ * Determines whether issued invoices for this subscription will automatically be
1689
+ * charged with the saved payment method on the due date. This property defaults to
1690
+ * the plan's behavior. If null, defaults to the customer's setting.
1691
+ */
1692
+ auto_collection: boolean | null;
1693
+ billing_cycle_anchor_configuration: SubscriptionCreateResponse.BillingCycleAnchorConfiguration;
1694
+ /**
1695
+ * The day of the month on which the billing cycle is anchored. If the maximum
1696
+ * number of days in a month is greater than this value, the last day of the month
1697
+ * is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing
1698
+ * period begins on the 30th.
1699
+ */
1700
+ billing_cycle_day: number;
1701
+ created_at: string;
1702
+ /**
1703
+ * The end of the current billing period. This is an exclusive timestamp, such that
1704
+ * the instant returned is not part of the billing period. Set to null for
1705
+ * subscriptions that are not currently active.
1706
+ */
1707
+ current_billing_period_end_date: string | null;
1708
+ /**
1709
+ * The start date of the current billing period. This is an inclusive timestamp;
1710
+ * the instant returned is exactly the beginning of the billing period. Set to null
1711
+ * if the subscription is not currently active.
1712
+ */
1713
+ current_billing_period_start_date: string | null;
1714
+ /**
1715
+ * A customer is a buyer of your products, and the other party to the billing
1716
+ * relationship.
1717
+ *
1718
+ * In Orb, customers are assigned system generated identifiers automatically, but
1719
+ * it's often desirable to have these match existing identifiers in your system. To
1720
+ * avoid having to denormalize Orb ID information, you can pass in an
1721
+ * `external_customer_id` with your own identifier. See
1722
+ * [Customer ID Aliases](/events-and-metrics/customer-aliases) for further
1723
+ * information about how these aliases work in Orb.
1724
+ *
1725
+ * In addition to having an identifier in your system, a customer may exist in a
1726
+ * payment provider solution like Stripe. Use the `payment_provider_id` and the
1727
+ * `payment_provider` enum field to express this mapping.
1728
+ *
1729
+ * A customer also has a timezone (from the standard
1730
+ * [IANA timezone database](https://www.iana.org/time-zones)), which defaults to
1731
+ * your account's timezone. See [Timezone localization](/essentials/timezones) for
1732
+ * information on what this timezone parameter influences within Orb.
1733
+ */
1734
+ customer: CustomersAPI.Customer;
1735
+ /**
1736
+ * Determines the default memo on this subscriptions' invoices. Note that if this
1737
+ * is not provided, it is determined by the plan configuration.
1738
+ */
1739
+ default_invoice_memo: string | null;
1740
+ /**
1741
+ * @deprecated The discount intervals for this subscription sorted by the
1742
+ * start_date.
1743
+ */
1744
+ discount_intervals: Array<SubscriptionCreateResponse.AmountDiscountInterval | SubscriptionCreateResponse.PercentageDiscountInterval | SubscriptionCreateResponse.UsageDiscountInterval>;
1745
+ /**
1746
+ * The date Orb stops billing for this subscription.
1747
+ */
1748
+ end_date: string | null;
1749
+ fixed_fee_quantity_schedule: Array<SubscriptionCreateResponse.FixedFeeQuantitySchedule>;
1750
+ invoicing_threshold: string | null;
1751
+ /**
1752
+ * @deprecated The maximum intervals for this subscription sorted by the
1753
+ * start_date.
1754
+ */
1755
+ maximum_intervals: Array<SubscriptionCreateResponse.MaximumInterval>;
1756
+ /**
1757
+ * User specified key-value pairs for the resource. If not present, this defaults
1758
+ * to an empty dictionary. Individual keys can be removed by setting the value to
1759
+ * `null`, and the entire metadata mapping can be cleared by setting `metadata` to
1760
+ * `null`.
1761
+ */
1762
+ metadata: Record<string, string>;
1763
+ /**
1764
+ * @deprecated The minimum intervals for this subscription sorted by the
1765
+ * start_date.
1766
+ */
1767
+ minimum_intervals: Array<SubscriptionCreateResponse.MinimumInterval>;
1768
+ /**
1769
+ * The name of the subscription.
1770
+ */
1771
+ name: string;
1772
+ /**
1773
+ * Determines the difference between the invoice issue date for subscription
1774
+ * invoices as the date that they are due. A value of `0` here represents that the
1775
+ * invoice is due on issue, whereas a value of `30` represents that the customer
1776
+ * has a month to pay the invoice.
1777
+ */
1778
+ net_terms: number;
1779
+ /**
1780
+ * A pending subscription change if one exists on this subscription.
1781
+ */
1782
+ pending_subscription_change: SubscriptionCreateResponse.PendingSubscriptionChange | null;
1783
+ /**
1784
+ * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
1785
+ * subscribed to by a customer. Plans define the billing behavior of the
1786
+ * subscription. You can see more about how to configure prices in the
1787
+ * [Price resource](/reference/price).
1788
+ */
1789
+ plan: PlansAPI.Plan | null;
1790
+ /**
1791
+ * The price intervals for this subscription.
1792
+ */
1793
+ price_intervals: Array<SubscriptionCreateResponse.PriceInterval>;
1794
+ redeemed_coupon: SubscriptionCreateResponse.RedeemedCoupon | null;
1795
+ /**
1796
+ * The date Orb starts billing for this subscription.
1797
+ */
1798
+ start_date: string;
1799
+ status: 'active' | 'ended' | 'upcoming';
1800
+ trial_info: SubscriptionCreateResponse.TrialInfo;
1801
+ /**
1802
+ * The resources that were changed as part of this operation. Only present when
1803
+ * fetched through the subscription changes API or if the
1804
+ * `include_changed_resources` parameter was passed in the request.
1805
+ */
1806
+ changed_resources?: SubscriptionCreateResponse.ChangedResources | null;
1807
+ }
1808
+ export declare namespace SubscriptionCreateResponse {
1809
+ interface AdjustmentInterval {
1810
+ id: string;
1811
+ adjustment: AdjustmentInterval.PlanPhaseUsageDiscountAdjustment | AdjustmentInterval.PlanPhaseAmountDiscountAdjustment | AdjustmentInterval.PlanPhasePercentageDiscountAdjustment | AdjustmentInterval.PlanPhaseMinimumAdjustment | AdjustmentInterval.PlanPhaseMaximumAdjustment;
1812
+ /**
1813
+ * The price interval IDs that this adjustment applies to.
1814
+ */
1815
+ applies_to_price_interval_ids: Array<string>;
1816
+ /**
1817
+ * The end date of the adjustment interval.
1818
+ */
1819
+ end_date: string | null;
1820
+ /**
1821
+ * The start date of the adjustment interval.
1822
+ */
1823
+ start_date: string;
1824
+ }
1825
+ namespace AdjustmentInterval {
1826
+ interface PlanPhaseUsageDiscountAdjustment {
1827
+ id: string;
1828
+ adjustment_type: 'usage_discount';
1829
+ /**
1830
+ * @deprecated The price IDs that this adjustment applies to.
1831
+ */
1832
+ applies_to_price_ids: Array<string>;
1833
+ /**
1834
+ * The filters that determine which prices to apply this adjustment to.
1835
+ */
1836
+ filters: Array<PlanPhaseUsageDiscountAdjustment.Filter>;
1837
+ /**
1838
+ * True for adjustments that apply to an entire invocice, false for adjustments
1839
+ * that apply to only one price.
1840
+ */
1841
+ is_invoice_level: boolean;
1842
+ /**
1843
+ * The plan phase in which this adjustment is active.
1844
+ */
1845
+ plan_phase_order: number | null;
1846
+ /**
1847
+ * The reason for the adjustment.
1848
+ */
1849
+ reason: string | null;
1850
+ /**
1851
+ * The number of usage units by which to discount the price this adjustment applies
1852
+ * to in a given billing period.
1853
+ */
1854
+ usage_discount: number;
1855
+ }
1856
+ namespace PlanPhaseUsageDiscountAdjustment {
1857
+ interface Filter {
1858
+ /**
1859
+ * The property of the price to filter on.
1860
+ */
1861
+ field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
1862
+ /**
1863
+ * Should prices that match the filter be included or excluded.
1864
+ */
1865
+ operator: 'includes' | 'excludes';
1866
+ /**
1867
+ * The IDs or values that match this filter.
1868
+ */
1869
+ values: Array<string>;
1870
+ }
1871
+ }
1872
+ interface PlanPhaseAmountDiscountAdjustment {
1873
+ id: string;
1874
+ adjustment_type: 'amount_discount';
1875
+ /**
1876
+ * The amount by which to discount the prices this adjustment applies to in a given
1877
+ * billing period.
1878
+ */
1879
+ amount_discount: string;
1880
+ /**
1881
+ * @deprecated The price IDs that this adjustment applies to.
1882
+ */
1883
+ applies_to_price_ids: Array<string>;
1884
+ /**
1885
+ * The filters that determine which prices to apply this adjustment to.
1886
+ */
1887
+ filters: Array<PlanPhaseAmountDiscountAdjustment.Filter>;
1888
+ /**
1889
+ * True for adjustments that apply to an entire invocice, false for adjustments
1890
+ * that apply to only one price.
1891
+ */
1892
+ is_invoice_level: boolean;
1893
+ /**
1894
+ * The plan phase in which this adjustment is active.
1895
+ */
1896
+ plan_phase_order: number | null;
1897
+ /**
1898
+ * The reason for the adjustment.
1899
+ */
1900
+ reason: string | null;
1901
+ }
1902
+ namespace PlanPhaseAmountDiscountAdjustment {
1903
+ interface Filter {
1904
+ /**
1905
+ * The property of the price to filter on.
1906
+ */
1907
+ field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
1908
+ /**
1909
+ * Should prices that match the filter be included or excluded.
1910
+ */
1911
+ operator: 'includes' | 'excludes';
1912
+ /**
1913
+ * The IDs or values that match this filter.
1914
+ */
1915
+ values: Array<string>;
1916
+ }
1917
+ }
1918
+ interface PlanPhasePercentageDiscountAdjustment {
1919
+ id: string;
1920
+ adjustment_type: 'percentage_discount';
1921
+ /**
1922
+ * @deprecated The price IDs that this adjustment applies to.
1923
+ */
1924
+ applies_to_price_ids: Array<string>;
1925
+ /**
1926
+ * The filters that determine which prices to apply this adjustment to.
1927
+ */
1928
+ filters: Array<PlanPhasePercentageDiscountAdjustment.Filter>;
1929
+ /**
1930
+ * True for adjustments that apply to an entire invocice, false for adjustments
1931
+ * that apply to only one price.
1932
+ */
1933
+ is_invoice_level: boolean;
1934
+ /**
1935
+ * The percentage (as a value between 0 and 1) by which to discount the price
1936
+ * intervals this adjustment applies to in a given billing period.
1937
+ */
1938
+ percentage_discount: number;
1939
+ /**
1940
+ * The plan phase in which this adjustment is active.
1941
+ */
1942
+ plan_phase_order: number | null;
1943
+ /**
1944
+ * The reason for the adjustment.
1945
+ */
1946
+ reason: string | null;
1947
+ }
1948
+ namespace PlanPhasePercentageDiscountAdjustment {
1949
+ interface Filter {
1950
+ /**
1951
+ * The property of the price to filter on.
1952
+ */
1953
+ field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
1954
+ /**
1955
+ * Should prices that match the filter be included or excluded.
1956
+ */
1957
+ operator: 'includes' | 'excludes';
1958
+ /**
1959
+ * The IDs or values that match this filter.
1960
+ */
1961
+ values: Array<string>;
1962
+ }
1963
+ }
1964
+ interface PlanPhaseMinimumAdjustment {
1965
+ id: string;
1966
+ adjustment_type: 'minimum';
1967
+ /**
1968
+ * @deprecated The price IDs that this adjustment applies to.
1969
+ */
1970
+ applies_to_price_ids: Array<string>;
1971
+ /**
1972
+ * The filters that determine which prices to apply this adjustment to.
1973
+ */
1974
+ filters: Array<PlanPhaseMinimumAdjustment.Filter>;
1975
+ /**
1976
+ * True for adjustments that apply to an entire invocice, false for adjustments
1977
+ * that apply to only one price.
1978
+ */
1979
+ is_invoice_level: boolean;
1980
+ /**
1981
+ * The item ID that revenue from this minimum will be attributed to.
1982
+ */
1983
+ item_id: string;
1984
+ /**
1985
+ * The minimum amount to charge in a given billing period for the prices this
1986
+ * adjustment applies to.
1987
+ */
1988
+ minimum_amount: string;
1989
+ /**
1990
+ * The plan phase in which this adjustment is active.
1991
+ */
1992
+ plan_phase_order: number | null;
1993
+ /**
1994
+ * The reason for the adjustment.
1995
+ */
1996
+ reason: string | null;
1997
+ }
1998
+ namespace PlanPhaseMinimumAdjustment {
1999
+ interface Filter {
2000
+ /**
2001
+ * The property of the price to filter on.
2002
+ */
2003
+ field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
2004
+ /**
2005
+ * Should prices that match the filter be included or excluded.
2006
+ */
2007
+ operator: 'includes' | 'excludes';
2008
+ /**
2009
+ * The IDs or values that match this filter.
2010
+ */
2011
+ values: Array<string>;
2012
+ }
2013
+ }
2014
+ interface PlanPhaseMaximumAdjustment {
2015
+ id: string;
2016
+ adjustment_type: 'maximum';
2017
+ /**
2018
+ * @deprecated The price IDs that this adjustment applies to.
2019
+ */
2020
+ applies_to_price_ids: Array<string>;
2021
+ /**
2022
+ * The filters that determine which prices to apply this adjustment to.
2023
+ */
2024
+ filters: Array<PlanPhaseMaximumAdjustment.Filter>;
2025
+ /**
2026
+ * True for adjustments that apply to an entire invocice, false for adjustments
2027
+ * that apply to only one price.
2028
+ */
2029
+ is_invoice_level: boolean;
2030
+ /**
2031
+ * The maximum amount to charge in a given billing period for the prices this
2032
+ * adjustment applies to.
2033
+ */
2034
+ maximum_amount: string;
2035
+ /**
2036
+ * The plan phase in which this adjustment is active.
2037
+ */
2038
+ plan_phase_order: number | null;
2039
+ /**
2040
+ * The reason for the adjustment.
2041
+ */
2042
+ reason: string | null;
2043
+ }
2044
+ namespace PlanPhaseMaximumAdjustment {
2045
+ interface Filter {
2046
+ /**
2047
+ * The property of the price to filter on.
2048
+ */
2049
+ field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
2050
+ /**
2051
+ * Should prices that match the filter be included or excluded.
2052
+ */
2053
+ operator: 'includes' | 'excludes';
2054
+ /**
2055
+ * The IDs or values that match this filter.
2056
+ */
2057
+ values: Array<string>;
2058
+ }
2059
+ }
2060
+ }
2061
+ interface BillingCycleAnchorConfiguration {
2062
+ /**
2063
+ * The day of the month on which the billing cycle is anchored. If the maximum
2064
+ * number of days in a month is greater than this value, the last day of the month
2065
+ * is the billing cycle day (e.g. billing_cycle_day=31 for April means the billing
2066
+ * period begins on the 30th.
2067
+ */
2068
+ day: number;
2069
+ /**
2070
+ * The month on which the billing cycle is anchored (e.g. a quarterly price
2071
+ * anchored in February would have cycles starting February, May, August, and
2072
+ * November).
2073
+ */
2074
+ month?: number | null;
2075
+ /**
2076
+ * The year on which the billing cycle is anchored (e.g. a 2 year billing cycle
2077
+ * anchored on 2021 would have cycles starting on 2021, 2023, 2025, etc.).
2078
+ */
2079
+ year?: number | null;
2080
+ }
2081
+ interface AmountDiscountInterval {
2082
+ /**
2083
+ * Only available if discount_type is `amount`.
2084
+ */
2085
+ amount_discount: string;
2086
+ /**
2087
+ * The price interval ids that this discount interval applies to.
2088
+ */
2089
+ applies_to_price_interval_ids: Array<string>;
2090
+ discount_type: 'amount';
2091
+ /**
2092
+ * The end date of the discount interval.
2093
+ */
2094
+ end_date: string | null;
2095
+ /**
2096
+ * The filters that determine which prices this discount interval applies to.
2097
+ */
2098
+ filters: Array<AmountDiscountInterval.Filter>;
2099
+ /**
2100
+ * The start date of the discount interval.
2101
+ */
2102
+ start_date: string;
2103
+ }
2104
+ namespace AmountDiscountInterval {
2105
+ interface Filter {
2106
+ /**
2107
+ * The property of the price to filter on.
2108
+ */
2109
+ field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
2110
+ /**
2111
+ * Should prices that match the filter be included or excluded.
2112
+ */
2113
+ operator: 'includes' | 'excludes';
2114
+ /**
2115
+ * The IDs or values that match this filter.
2116
+ */
2117
+ values: Array<string>;
2118
+ }
2119
+ }
2120
+ interface PercentageDiscountInterval {
2121
+ /**
2122
+ * The price interval ids that this discount interval applies to.
2123
+ */
2124
+ applies_to_price_interval_ids: Array<string>;
2125
+ discount_type: 'percentage';
2126
+ /**
2127
+ * The end date of the discount interval.
2128
+ */
2129
+ end_date: string | null;
2130
+ /**
2131
+ * The filters that determine which prices this discount interval applies to.
2132
+ */
2133
+ filters: Array<PercentageDiscountInterval.Filter>;
2134
+ /**
2135
+ * Only available if discount_type is `percentage`.This is a number between 0
2136
+ * and 1.
2137
+ */
2138
+ percentage_discount: number;
2139
+ /**
2140
+ * The start date of the discount interval.
2141
+ */
2142
+ start_date: string;
2143
+ }
2144
+ namespace PercentageDiscountInterval {
2145
+ interface Filter {
2146
+ /**
2147
+ * The property of the price to filter on.
2148
+ */
2149
+ field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
2150
+ /**
2151
+ * Should prices that match the filter be included or excluded.
2152
+ */
2153
+ operator: 'includes' | 'excludes';
2154
+ /**
2155
+ * The IDs or values that match this filter.
2156
+ */
2157
+ values: Array<string>;
2158
+ }
2159
+ }
2160
+ interface UsageDiscountInterval {
2161
+ /**
2162
+ * The price interval ids that this discount interval applies to.
2163
+ */
2164
+ applies_to_price_interval_ids: Array<string>;
2165
+ discount_type: 'usage';
2166
+ /**
2167
+ * The end date of the discount interval.
2168
+ */
2169
+ end_date: string | null;
2170
+ /**
2171
+ * The filters that determine which prices this discount interval applies to.
2172
+ */
2173
+ filters: Array<UsageDiscountInterval.Filter>;
2174
+ /**
2175
+ * The start date of the discount interval.
2176
+ */
2177
+ start_date: string;
2178
+ /**
2179
+ * Only available if discount_type is `usage`. Number of usage units that this
2180
+ * discount is for
2181
+ */
2182
+ usage_discount: number;
2183
+ }
2184
+ namespace UsageDiscountInterval {
2185
+ interface Filter {
2186
+ /**
2187
+ * The property of the price to filter on.
2188
+ */
2189
+ field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
2190
+ /**
2191
+ * Should prices that match the filter be included or excluded.
2192
+ */
2193
+ operator: 'includes' | 'excludes';
2194
+ /**
2195
+ * The IDs or values that match this filter.
2196
+ */
2197
+ values: Array<string>;
2198
+ }
2199
+ }
2200
+ interface FixedFeeQuantitySchedule {
2201
+ end_date: string | null;
2202
+ price_id: string;
2203
+ quantity: number;
2204
+ start_date: string;
2205
+ }
2206
+ interface MaximumInterval {
2207
+ /**
2208
+ * The price interval ids that this maximum interval applies to.
2209
+ */
2210
+ applies_to_price_interval_ids: Array<string>;
2211
+ /**
2212
+ * The end date of the maximum interval.
2213
+ */
2214
+ end_date: string | null;
2215
+ /**
2216
+ * The filters that determine which prices this maximum interval applies to.
2217
+ */
2218
+ filters: Array<MaximumInterval.Filter>;
2219
+ /**
2220
+ * The maximum amount to charge in a given billing period for the price intervals
2221
+ * this transform applies to.
2222
+ */
2223
+ maximum_amount: string;
2224
+ /**
2225
+ * The start date of the maximum interval.
2226
+ */
2227
+ start_date: string;
2228
+ }
2229
+ namespace MaximumInterval {
2230
+ interface Filter {
2231
+ /**
2232
+ * The property of the price to filter on.
2233
+ */
2234
+ field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
2235
+ /**
2236
+ * Should prices that match the filter be included or excluded.
2237
+ */
2238
+ operator: 'includes' | 'excludes';
2239
+ /**
2240
+ * The IDs or values that match this filter.
2241
+ */
2242
+ values: Array<string>;
2243
+ }
2244
+ }
2245
+ interface MinimumInterval {
2246
+ /**
2247
+ * The price interval ids that this minimum interval applies to.
2248
+ */
2249
+ applies_to_price_interval_ids: Array<string>;
2250
+ /**
2251
+ * The end date of the minimum interval.
2252
+ */
2253
+ end_date: string | null;
2254
+ /**
2255
+ * The filters that determine which prices this minimum interval applies to.
2256
+ */
2257
+ filters: Array<MinimumInterval.Filter>;
2258
+ /**
2259
+ * The minimum amount to charge in a given billing period for the price intervals
2260
+ * this minimum applies to.
2261
+ */
2262
+ minimum_amount: string;
2263
+ /**
2264
+ * The start date of the minimum interval.
2265
+ */
2266
+ start_date: string;
2267
+ }
2268
+ namespace MinimumInterval {
2269
+ interface Filter {
2270
+ /**
2271
+ * The property of the price to filter on.
2272
+ */
2273
+ field: 'price_id' | 'item_id' | 'price_type' | 'currency' | 'pricing_unit_id';
2274
+ /**
2275
+ * Should prices that match the filter be included or excluded.
2276
+ */
2277
+ operator: 'includes' | 'excludes';
2278
+ /**
2279
+ * The IDs or values that match this filter.
2280
+ */
2281
+ values: Array<string>;
2282
+ }
2283
+ }
2284
+ /**
2285
+ * A pending subscription change if one exists on this subscription.
2286
+ */
2287
+ interface PendingSubscriptionChange {
2288
+ id: string;
2289
+ }
2290
+ /**
2291
+ * The Price Interval resource represents a period of time for which a price will
2292
+ * bill on a subscription. A subscription’s price intervals define its billing
2293
+ * behavior.
2294
+ */
2295
+ interface PriceInterval {
2296
+ id: string;
2297
+ /**
2298
+ * The day of the month that Orb bills for this price
2299
+ */
2300
+ billing_cycle_day: number;
2301
+ /**
2302
+ * The end of the current billing period. This is an exclusive timestamp, such that
2303
+ * the instant returned is exactly the end of the billing period. Set to null if
2304
+ * this price interval is not currently active.
2305
+ */
2306
+ current_billing_period_end_date: string | null;
2307
+ /**
2308
+ * The start date of the current billing period. This is an inclusive timestamp;
2309
+ * the instant returned is exactly the beginning of the billing period. Set to null
2310
+ * if this price interval is not currently active.
2311
+ */
2312
+ current_billing_period_start_date: string | null;
2313
+ /**
2314
+ * The end date of the price interval. This is the date that Orb stops billing for
2315
+ * this price.
2316
+ */
2317
+ end_date: string | null;
2318
+ /**
2319
+ * An additional filter to apply to usage queries.
2320
+ */
2321
+ filter: string | null;
2322
+ /**
2323
+ * The fixed fee quantity transitions for this price interval. This is only
2324
+ * relevant for fixed fees.
2325
+ */
2326
+ fixed_fee_quantity_transitions: Array<PriceInterval.FixedFeeQuantityTransition> | null;
2327
+ /**
2328
+ * The Price resource represents a price that can be billed on a subscription,
2329
+ * resulting in a charge on an invoice in the form of an invoice line item. Prices
2330
+ * take a quantity and determine an amount to bill.
2331
+ *
2332
+ * Orb supports a few different pricing models out of the box. Each of these models
2333
+ * is serialized differently in a given Price object. The model_type field
2334
+ * determines the key for the configuration object that is present.
2335
+ *
2336
+ * For more on the types of prices, see
2337
+ * [the core concepts documentation](/core-concepts#plan-and-price)
2338
+ */
2339
+ price: PricesAPI.Price;
2340
+ /**
2341
+ * The start date of the price interval. This is the date that Orb starts billing
2342
+ * for this price.
2343
+ */
2344
+ start_date: string;
2345
+ /**
2346
+ * A list of customer IDs whose usage events will be aggregated and billed under
2347
+ * this price interval.
2348
+ */
2349
+ usage_customer_ids: Array<string> | null;
2350
+ }
2351
+ namespace PriceInterval {
2352
+ interface FixedFeeQuantityTransition {
2353
+ effective_date: string;
2354
+ price_id: string;
2355
+ quantity: number;
2356
+ }
2357
+ }
2358
+ interface RedeemedCoupon {
2359
+ coupon_id: string;
2360
+ end_date: string | null;
2361
+ start_date: string;
1642
2362
  }
1643
- namespace GroupedSubscriptionUsage {
1644
- interface Data {
1645
- billable_metric: Data.BillableMetric;
1646
- metric_group: Data.MetricGroup;
1647
- usage: Array<Data.Usage>;
1648
- view_mode: 'periodic' | 'cumulative';
1649
- }
1650
- namespace Data {
1651
- interface BillableMetric {
1652
- id: string;
1653
- name: string;
1654
- }
1655
- interface MetricGroup {
1656
- property_key: string;
1657
- property_value: string;
1658
- }
1659
- interface Usage {
1660
- quantity: number;
1661
- timeframe_end: string;
1662
- timeframe_start: string;
1663
- }
1664
- }
2363
+ interface TrialInfo {
2364
+ end_date: string | null;
2365
+ }
2366
+ /**
2367
+ * The resources that were changed as part of this operation. Only present when
2368
+ * fetched through the subscription changes API or if the
2369
+ * `include_changed_resources` parameter was passed in the request.
2370
+ */
2371
+ interface ChangedResources {
2372
+ /**
2373
+ * The credit notes that were created as part of this operation.
2374
+ */
2375
+ created_credit_notes: Array<CreditNotesAPI.CreditNote>;
2376
+ /**
2377
+ * The invoices that were created as part of this operation.
2378
+ */
2379
+ created_invoices: Array<InvoicesAPI.Invoice>;
2380
+ /**
2381
+ * The credit notes that were voided as part of this operation.
2382
+ */
2383
+ voided_credit_notes: Array<CreditNotesAPI.CreditNote>;
2384
+ /**
2385
+ * The invoices that were voided as part of this operation.
2386
+ */
2387
+ voided_invoices: Array<InvoicesAPI.Invoice>;
1665
2388
  }
1666
2389
  }
1667
- export interface Subscriptions {
1668
- data: Array<Subscription>;
1669
- pagination_metadata: Shared.PaginationMetadata;
1670
- }
1671
- export interface SubscriptionCreateResponse {
2390
+ export interface SubscriptionCancelResponse {
1672
2391
  id: string;
1673
2392
  /**
1674
2393
  * The current plan phase that is active, only if the subscription's plan has
@@ -1679,14 +2398,14 @@ export interface SubscriptionCreateResponse {
1679
2398
  * The adjustment intervals for this subscription sorted by the start_date of the
1680
2399
  * adjustment interval.
1681
2400
  */
1682
- adjustment_intervals: Array<SubscriptionCreateResponse.AdjustmentInterval>;
2401
+ adjustment_intervals: Array<SubscriptionCancelResponse.AdjustmentInterval>;
1683
2402
  /**
1684
2403
  * Determines whether issued invoices for this subscription will automatically be
1685
2404
  * charged with the saved payment method on the due date. This property defaults to
1686
2405
  * the plan's behavior. If null, defaults to the customer's setting.
1687
2406
  */
1688
2407
  auto_collection: boolean | null;
1689
- billing_cycle_anchor_configuration: SubscriptionCreateResponse.BillingCycleAnchorConfiguration;
2408
+ billing_cycle_anchor_configuration: SubscriptionCancelResponse.BillingCycleAnchorConfiguration;
1690
2409
  /**
1691
2410
  * The day of the month on which the billing cycle is anchored. If the maximum
1692
2411
  * number of days in a month is greater than this value, the last day of the month
@@ -1737,18 +2456,18 @@ export interface SubscriptionCreateResponse {
1737
2456
  * @deprecated The discount intervals for this subscription sorted by the
1738
2457
  * start_date.
1739
2458
  */
1740
- discount_intervals: Array<SubscriptionCreateResponse.AmountDiscountInterval | SubscriptionCreateResponse.PercentageDiscountInterval | SubscriptionCreateResponse.UsageDiscountInterval>;
2459
+ discount_intervals: Array<SubscriptionCancelResponse.AmountDiscountInterval | SubscriptionCancelResponse.PercentageDiscountInterval | SubscriptionCancelResponse.UsageDiscountInterval>;
1741
2460
  /**
1742
2461
  * The date Orb stops billing for this subscription.
1743
2462
  */
1744
2463
  end_date: string | null;
1745
- fixed_fee_quantity_schedule: Array<SubscriptionCreateResponse.FixedFeeQuantitySchedule>;
2464
+ fixed_fee_quantity_schedule: Array<SubscriptionCancelResponse.FixedFeeQuantitySchedule>;
1746
2465
  invoicing_threshold: string | null;
1747
2466
  /**
1748
2467
  * @deprecated The maximum intervals for this subscription sorted by the
1749
2468
  * start_date.
1750
2469
  */
1751
- maximum_intervals: Array<SubscriptionCreateResponse.MaximumInterval>;
2470
+ maximum_intervals: Array<SubscriptionCancelResponse.MaximumInterval>;
1752
2471
  /**
1753
2472
  * User specified key-value pairs for the resource. If not present, this defaults
1754
2473
  * to an empty dictionary. Individual keys can be removed by setting the value to
@@ -1760,7 +2479,7 @@ export interface SubscriptionCreateResponse {
1760
2479
  * @deprecated The minimum intervals for this subscription sorted by the
1761
2480
  * start_date.
1762
2481
  */
1763
- minimum_intervals: Array<SubscriptionCreateResponse.MinimumInterval>;
2482
+ minimum_intervals: Array<SubscriptionCancelResponse.MinimumInterval>;
1764
2483
  /**
1765
2484
  * The name of the subscription.
1766
2485
  */
@@ -1775,7 +2494,7 @@ export interface SubscriptionCreateResponse {
1775
2494
  /**
1776
2495
  * A pending subscription change if one exists on this subscription.
1777
2496
  */
1778
- pending_subscription_change: SubscriptionCreateResponse.PendingSubscriptionChange | null;
2497
+ pending_subscription_change: SubscriptionCancelResponse.PendingSubscriptionChange | null;
1779
2498
  /**
1780
2499
  * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
1781
2500
  * subscribed to by a customer. Plans define the billing behavior of the
@@ -1786,22 +2505,22 @@ export interface SubscriptionCreateResponse {
1786
2505
  /**
1787
2506
  * The price intervals for this subscription.
1788
2507
  */
1789
- price_intervals: Array<SubscriptionCreateResponse.PriceInterval>;
1790
- redeemed_coupon: SubscriptionCreateResponse.RedeemedCoupon | null;
2508
+ price_intervals: Array<SubscriptionCancelResponse.PriceInterval>;
2509
+ redeemed_coupon: SubscriptionCancelResponse.RedeemedCoupon | null;
1791
2510
  /**
1792
2511
  * The date Orb starts billing for this subscription.
1793
2512
  */
1794
2513
  start_date: string;
1795
2514
  status: 'active' | 'ended' | 'upcoming';
1796
- trial_info: SubscriptionCreateResponse.TrialInfo;
2515
+ trial_info: SubscriptionCancelResponse.TrialInfo;
1797
2516
  /**
1798
2517
  * The resources that were changed as part of this operation. Only present when
1799
2518
  * fetched through the subscription changes API or if the
1800
2519
  * `include_changed_resources` parameter was passed in the request.
1801
2520
  */
1802
- changed_resources?: SubscriptionCreateResponse.ChangedResources | null;
2521
+ changed_resources?: SubscriptionCancelResponse.ChangedResources | null;
1803
2522
  }
1804
- export declare namespace SubscriptionCreateResponse {
2523
+ export declare namespace SubscriptionCancelResponse {
1805
2524
  interface AdjustmentInterval {
1806
2525
  id: string;
1807
2526
  adjustment: AdjustmentInterval.PlanPhaseUsageDiscountAdjustment | AdjustmentInterval.PlanPhaseAmountDiscountAdjustment | AdjustmentInterval.PlanPhasePercentageDiscountAdjustment | AdjustmentInterval.PlanPhaseMinimumAdjustment | AdjustmentInterval.PlanPhaseMaximumAdjustment;
@@ -2383,7 +3102,67 @@ export declare namespace SubscriptionCreateResponse {
2383
3102
  voided_invoices: Array<InvoicesAPI.Invoice>;
2384
3103
  }
2385
3104
  }
2386
- export interface SubscriptionCancelResponse {
3105
+ export interface SubscriptionFetchCostsResponse {
3106
+ data: Array<SubscriptionFetchCostsResponse.Data>;
3107
+ }
3108
+ export declare namespace SubscriptionFetchCostsResponse {
3109
+ interface Data {
3110
+ per_price_costs: Array<Data.PerPriceCost>;
3111
+ /**
3112
+ * Total costs for the timeframe, excluding any minimums and discounts.
3113
+ */
3114
+ subtotal: string;
3115
+ timeframe_end: string;
3116
+ timeframe_start: string;
3117
+ /**
3118
+ * Total costs for the timeframe, including any minimums and discounts.
3119
+ */
3120
+ total: string;
3121
+ }
3122
+ namespace Data {
3123
+ interface PerPriceCost {
3124
+ /**
3125
+ * The price object
3126
+ */
3127
+ price: PricesAPI.Price;
3128
+ /**
3129
+ * The price the cost is associated with
3130
+ */
3131
+ price_id: string;
3132
+ /**
3133
+ * Price's contributions for the timeframe, excluding any minimums and discounts.
3134
+ */
3135
+ subtotal: string;
3136
+ /**
3137
+ * Price's contributions for the timeframe, including minimums and discounts.
3138
+ */
3139
+ total: string;
3140
+ /**
3141
+ * The price's quantity for the timeframe
3142
+ */
3143
+ quantity?: number | null;
3144
+ }
3145
+ }
3146
+ }
3147
+ export interface SubscriptionFetchScheduleResponse {
3148
+ created_at: string;
3149
+ end_date: string | null;
3150
+ plan: SubscriptionFetchScheduleResponse.Plan | null;
3151
+ start_date: string;
3152
+ }
3153
+ export declare namespace SubscriptionFetchScheduleResponse {
3154
+ interface Plan {
3155
+ id: string | null;
3156
+ /**
3157
+ * An optional user-defined ID for this plan resource, used throughout the system
3158
+ * as an alias for this Plan. Use this field to identify a plan by an existing
3159
+ * identifier in your system.
3160
+ */
3161
+ external_plan_id: string | null;
3162
+ name: string | null;
3163
+ }
3164
+ }
3165
+ export interface SubscriptionPriceIntervalsResponse {
2387
3166
  id: string;
2388
3167
  /**
2389
3168
  * The current plan phase that is active, only if the subscription's plan has
@@ -2394,14 +3173,14 @@ export interface SubscriptionCancelResponse {
2394
3173
  * The adjustment intervals for this subscription sorted by the start_date of the
2395
3174
  * adjustment interval.
2396
3175
  */
2397
- adjustment_intervals: Array<SubscriptionCancelResponse.AdjustmentInterval>;
3176
+ adjustment_intervals: Array<SubscriptionPriceIntervalsResponse.AdjustmentInterval>;
2398
3177
  /**
2399
3178
  * Determines whether issued invoices for this subscription will automatically be
2400
3179
  * charged with the saved payment method on the due date. This property defaults to
2401
3180
  * the plan's behavior. If null, defaults to the customer's setting.
2402
3181
  */
2403
3182
  auto_collection: boolean | null;
2404
- billing_cycle_anchor_configuration: SubscriptionCancelResponse.BillingCycleAnchorConfiguration;
3183
+ billing_cycle_anchor_configuration: SubscriptionPriceIntervalsResponse.BillingCycleAnchorConfiguration;
2405
3184
  /**
2406
3185
  * The day of the month on which the billing cycle is anchored. If the maximum
2407
3186
  * number of days in a month is greater than this value, the last day of the month
@@ -2452,18 +3231,18 @@ export interface SubscriptionCancelResponse {
2452
3231
  * @deprecated The discount intervals for this subscription sorted by the
2453
3232
  * start_date.
2454
3233
  */
2455
- discount_intervals: Array<SubscriptionCancelResponse.AmountDiscountInterval | SubscriptionCancelResponse.PercentageDiscountInterval | SubscriptionCancelResponse.UsageDiscountInterval>;
3234
+ discount_intervals: Array<SubscriptionPriceIntervalsResponse.AmountDiscountInterval | SubscriptionPriceIntervalsResponse.PercentageDiscountInterval | SubscriptionPriceIntervalsResponse.UsageDiscountInterval>;
2456
3235
  /**
2457
3236
  * The date Orb stops billing for this subscription.
2458
3237
  */
2459
3238
  end_date: string | null;
2460
- fixed_fee_quantity_schedule: Array<SubscriptionCancelResponse.FixedFeeQuantitySchedule>;
3239
+ fixed_fee_quantity_schedule: Array<SubscriptionPriceIntervalsResponse.FixedFeeQuantitySchedule>;
2461
3240
  invoicing_threshold: string | null;
2462
3241
  /**
2463
3242
  * @deprecated The maximum intervals for this subscription sorted by the
2464
3243
  * start_date.
2465
3244
  */
2466
- maximum_intervals: Array<SubscriptionCancelResponse.MaximumInterval>;
3245
+ maximum_intervals: Array<SubscriptionPriceIntervalsResponse.MaximumInterval>;
2467
3246
  /**
2468
3247
  * User specified key-value pairs for the resource. If not present, this defaults
2469
3248
  * to an empty dictionary. Individual keys can be removed by setting the value to
@@ -2475,7 +3254,7 @@ export interface SubscriptionCancelResponse {
2475
3254
  * @deprecated The minimum intervals for this subscription sorted by the
2476
3255
  * start_date.
2477
3256
  */
2478
- minimum_intervals: Array<SubscriptionCancelResponse.MinimumInterval>;
3257
+ minimum_intervals: Array<SubscriptionPriceIntervalsResponse.MinimumInterval>;
2479
3258
  /**
2480
3259
  * The name of the subscription.
2481
3260
  */
@@ -2490,7 +3269,7 @@ export interface SubscriptionCancelResponse {
2490
3269
  /**
2491
3270
  * A pending subscription change if one exists on this subscription.
2492
3271
  */
2493
- pending_subscription_change: SubscriptionCancelResponse.PendingSubscriptionChange | null;
3272
+ pending_subscription_change: SubscriptionPriceIntervalsResponse.PendingSubscriptionChange | null;
2494
3273
  /**
2495
3274
  * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
2496
3275
  * subscribed to by a customer. Plans define the billing behavior of the
@@ -2501,22 +3280,22 @@ export interface SubscriptionCancelResponse {
2501
3280
  /**
2502
3281
  * The price intervals for this subscription.
2503
3282
  */
2504
- price_intervals: Array<SubscriptionCancelResponse.PriceInterval>;
2505
- redeemed_coupon: SubscriptionCancelResponse.RedeemedCoupon | null;
3283
+ price_intervals: Array<SubscriptionPriceIntervalsResponse.PriceInterval>;
3284
+ redeemed_coupon: SubscriptionPriceIntervalsResponse.RedeemedCoupon | null;
2506
3285
  /**
2507
3286
  * The date Orb starts billing for this subscription.
2508
3287
  */
2509
3288
  start_date: string;
2510
3289
  status: 'active' | 'ended' | 'upcoming';
2511
- trial_info: SubscriptionCancelResponse.TrialInfo;
3290
+ trial_info: SubscriptionPriceIntervalsResponse.TrialInfo;
2512
3291
  /**
2513
3292
  * The resources that were changed as part of this operation. Only present when
2514
3293
  * fetched through the subscription changes API or if the
2515
3294
  * `include_changed_resources` parameter was passed in the request.
2516
3295
  */
2517
- changed_resources?: SubscriptionCancelResponse.ChangedResources | null;
3296
+ changed_resources?: SubscriptionPriceIntervalsResponse.ChangedResources | null;
2518
3297
  }
2519
- export declare namespace SubscriptionCancelResponse {
3298
+ export declare namespace SubscriptionPriceIntervalsResponse {
2520
3299
  interface AdjustmentInterval {
2521
3300
  id: string;
2522
3301
  adjustment: AdjustmentInterval.PlanPhaseUsageDiscountAdjustment | AdjustmentInterval.PlanPhaseAmountDiscountAdjustment | AdjustmentInterval.PlanPhasePercentageDiscountAdjustment | AdjustmentInterval.PlanPhaseMinimumAdjustment | AdjustmentInterval.PlanPhaseMaximumAdjustment;
@@ -3098,67 +3877,7 @@ export declare namespace SubscriptionCancelResponse {
3098
3877
  voided_invoices: Array<InvoicesAPI.Invoice>;
3099
3878
  }
3100
3879
  }
3101
- export interface SubscriptionFetchCostsResponse {
3102
- data: Array<SubscriptionFetchCostsResponse.Data>;
3103
- }
3104
- export declare namespace SubscriptionFetchCostsResponse {
3105
- interface Data {
3106
- per_price_costs: Array<Data.PerPriceCost>;
3107
- /**
3108
- * Total costs for the timeframe, excluding any minimums and discounts.
3109
- */
3110
- subtotal: string;
3111
- timeframe_end: string;
3112
- timeframe_start: string;
3113
- /**
3114
- * Total costs for the timeframe, including any minimums and discounts.
3115
- */
3116
- total: string;
3117
- }
3118
- namespace Data {
3119
- interface PerPriceCost {
3120
- /**
3121
- * The price object
3122
- */
3123
- price: PricesAPI.Price;
3124
- /**
3125
- * The price the cost is associated with
3126
- */
3127
- price_id: string;
3128
- /**
3129
- * Price's contributions for the timeframe, excluding any minimums and discounts.
3130
- */
3131
- subtotal: string;
3132
- /**
3133
- * Price's contributions for the timeframe, including minimums and discounts.
3134
- */
3135
- total: string;
3136
- /**
3137
- * The price's quantity for the timeframe
3138
- */
3139
- quantity?: number | null;
3140
- }
3141
- }
3142
- }
3143
- export interface SubscriptionFetchScheduleResponse {
3144
- created_at: string;
3145
- end_date: string | null;
3146
- plan: SubscriptionFetchScheduleResponse.Plan | null;
3147
- start_date: string;
3148
- }
3149
- export declare namespace SubscriptionFetchScheduleResponse {
3150
- interface Plan {
3151
- id: string | null;
3152
- /**
3153
- * An optional user-defined ID for this plan resource, used throughout the system
3154
- * as an alias for this Plan. Use this field to identify a plan by an existing
3155
- * identifier in your system.
3156
- */
3157
- external_plan_id: string | null;
3158
- name: string | null;
3159
- }
3160
- }
3161
- export interface SubscriptionPriceIntervalsResponse {
3880
+ export interface SubscriptionRedeemCouponResponse {
3162
3881
  id: string;
3163
3882
  /**
3164
3883
  * The current plan phase that is active, only if the subscription's plan has
@@ -3169,14 +3888,14 @@ export interface SubscriptionPriceIntervalsResponse {
3169
3888
  * The adjustment intervals for this subscription sorted by the start_date of the
3170
3889
  * adjustment interval.
3171
3890
  */
3172
- adjustment_intervals: Array<SubscriptionPriceIntervalsResponse.AdjustmentInterval>;
3891
+ adjustment_intervals: Array<SubscriptionRedeemCouponResponse.AdjustmentInterval>;
3173
3892
  /**
3174
3893
  * Determines whether issued invoices for this subscription will automatically be
3175
3894
  * charged with the saved payment method on the due date. This property defaults to
3176
3895
  * the plan's behavior. If null, defaults to the customer's setting.
3177
3896
  */
3178
3897
  auto_collection: boolean | null;
3179
- billing_cycle_anchor_configuration: SubscriptionPriceIntervalsResponse.BillingCycleAnchorConfiguration;
3898
+ billing_cycle_anchor_configuration: SubscriptionRedeemCouponResponse.BillingCycleAnchorConfiguration;
3180
3899
  /**
3181
3900
  * The day of the month on which the billing cycle is anchored. If the maximum
3182
3901
  * number of days in a month is greater than this value, the last day of the month
@@ -3227,18 +3946,18 @@ export interface SubscriptionPriceIntervalsResponse {
3227
3946
  * @deprecated The discount intervals for this subscription sorted by the
3228
3947
  * start_date.
3229
3948
  */
3230
- discount_intervals: Array<SubscriptionPriceIntervalsResponse.AmountDiscountInterval | SubscriptionPriceIntervalsResponse.PercentageDiscountInterval | SubscriptionPriceIntervalsResponse.UsageDiscountInterval>;
3949
+ discount_intervals: Array<SubscriptionRedeemCouponResponse.AmountDiscountInterval | SubscriptionRedeemCouponResponse.PercentageDiscountInterval | SubscriptionRedeemCouponResponse.UsageDiscountInterval>;
3231
3950
  /**
3232
3951
  * The date Orb stops billing for this subscription.
3233
3952
  */
3234
3953
  end_date: string | null;
3235
- fixed_fee_quantity_schedule: Array<SubscriptionPriceIntervalsResponse.FixedFeeQuantitySchedule>;
3954
+ fixed_fee_quantity_schedule: Array<SubscriptionRedeemCouponResponse.FixedFeeQuantitySchedule>;
3236
3955
  invoicing_threshold: string | null;
3237
3956
  /**
3238
3957
  * @deprecated The maximum intervals for this subscription sorted by the
3239
3958
  * start_date.
3240
3959
  */
3241
- maximum_intervals: Array<SubscriptionPriceIntervalsResponse.MaximumInterval>;
3960
+ maximum_intervals: Array<SubscriptionRedeemCouponResponse.MaximumInterval>;
3242
3961
  /**
3243
3962
  * User specified key-value pairs for the resource. If not present, this defaults
3244
3963
  * to an empty dictionary. Individual keys can be removed by setting the value to
@@ -3250,7 +3969,7 @@ export interface SubscriptionPriceIntervalsResponse {
3250
3969
  * @deprecated The minimum intervals for this subscription sorted by the
3251
3970
  * start_date.
3252
3971
  */
3253
- minimum_intervals: Array<SubscriptionPriceIntervalsResponse.MinimumInterval>;
3972
+ minimum_intervals: Array<SubscriptionRedeemCouponResponse.MinimumInterval>;
3254
3973
  /**
3255
3974
  * The name of the subscription.
3256
3975
  */
@@ -3265,7 +3984,7 @@ export interface SubscriptionPriceIntervalsResponse {
3265
3984
  /**
3266
3985
  * A pending subscription change if one exists on this subscription.
3267
3986
  */
3268
- pending_subscription_change: SubscriptionPriceIntervalsResponse.PendingSubscriptionChange | null;
3987
+ pending_subscription_change: SubscriptionRedeemCouponResponse.PendingSubscriptionChange | null;
3269
3988
  /**
3270
3989
  * The [Plan](/core-concepts#plan-and-price) resource represents a plan that can be
3271
3990
  * subscribed to by a customer. Plans define the billing behavior of the
@@ -3276,22 +3995,22 @@ export interface SubscriptionPriceIntervalsResponse {
3276
3995
  /**
3277
3996
  * The price intervals for this subscription.
3278
3997
  */
3279
- price_intervals: Array<SubscriptionPriceIntervalsResponse.PriceInterval>;
3280
- redeemed_coupon: SubscriptionPriceIntervalsResponse.RedeemedCoupon | null;
3998
+ price_intervals: Array<SubscriptionRedeemCouponResponse.PriceInterval>;
3999
+ redeemed_coupon: SubscriptionRedeemCouponResponse.RedeemedCoupon | null;
3281
4000
  /**
3282
4001
  * The date Orb starts billing for this subscription.
3283
4002
  */
3284
4003
  start_date: string;
3285
4004
  status: 'active' | 'ended' | 'upcoming';
3286
- trial_info: SubscriptionPriceIntervalsResponse.TrialInfo;
4005
+ trial_info: SubscriptionRedeemCouponResponse.TrialInfo;
3287
4006
  /**
3288
4007
  * The resources that were changed as part of this operation. Only present when
3289
4008
  * fetched through the subscription changes API or if the
3290
4009
  * `include_changed_resources` parameter was passed in the request.
3291
4010
  */
3292
- changed_resources?: SubscriptionPriceIntervalsResponse.ChangedResources | null;
4011
+ changed_resources?: SubscriptionRedeemCouponResponse.ChangedResources | null;
3293
4012
  }
3294
- export declare namespace SubscriptionPriceIntervalsResponse {
4013
+ export declare namespace SubscriptionRedeemCouponResponse {
3295
4014
  interface AdjustmentInterval {
3296
4015
  id: string;
3297
4016
  adjustment: AdjustmentInterval.PlanPhaseUsageDiscountAdjustment | AdjustmentInterval.PlanPhaseAmountDiscountAdjustment | AdjustmentInterval.PlanPhasePercentageDiscountAdjustment | AdjustmentInterval.PlanPhaseMinimumAdjustment | AdjustmentInterval.PlanPhaseMaximumAdjustment;
@@ -20407,6 +21126,24 @@ export declare namespace SubscriptionPriceIntervalsParams {
20407
21126
  start_date?: (string & {}) | Shared.BillingCycleRelativeDate;
20408
21127
  }
20409
21128
  }
21129
+ export interface SubscriptionRedeemCouponParams {
21130
+ change_option: 'requested_date' | 'end_of_subscription_term' | 'immediate';
21131
+ /**
21132
+ * Coupon ID to be redeemed for this subscription.
21133
+ */
21134
+ coupon_id: string;
21135
+ /**
21136
+ * If false, this request will fail if it would void an issued invoice or create a
21137
+ * credit note. Consider using this as a safety mechanism if you do not expect
21138
+ * existing invoices to be changed.
21139
+ */
21140
+ allow_invoice_credit_or_void?: boolean | null;
21141
+ /**
21142
+ * The date that the coupon discount should take effect. This parameter can only be
21143
+ * passed if the `change_option` is `requested_date`.
21144
+ */
21145
+ change_date?: string | null;
21146
+ }
20410
21147
  export interface SubscriptionSchedulePlanChangeParams {
20411
21148
  change_option: 'requested_date' | 'end_of_subscription_term' | 'immediate';
20412
21149
  /**
@@ -28139,6 +28876,6 @@ export interface SubscriptionUpdateTrialParams {
28139
28876
  shift?: boolean;
28140
28877
  }
28141
28878
  export declare namespace Subscriptions {
28142
- export { type Subscription as Subscription, type SubscriptionUsage as SubscriptionUsage, type Subscriptions as Subscriptions, type SubscriptionCreateResponse as SubscriptionCreateResponse, type SubscriptionCancelResponse as SubscriptionCancelResponse, type SubscriptionFetchCostsResponse as SubscriptionFetchCostsResponse, type SubscriptionFetchScheduleResponse as SubscriptionFetchScheduleResponse, type SubscriptionPriceIntervalsResponse as SubscriptionPriceIntervalsResponse, type SubscriptionSchedulePlanChangeResponse as SubscriptionSchedulePlanChangeResponse, type SubscriptionTriggerPhaseResponse as SubscriptionTriggerPhaseResponse, type SubscriptionUnscheduleCancellationResponse as SubscriptionUnscheduleCancellationResponse, type SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse as SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse, type SubscriptionUnschedulePendingPlanChangesResponse as SubscriptionUnschedulePendingPlanChangesResponse, type SubscriptionUpdateFixedFeeQuantityResponse as SubscriptionUpdateFixedFeeQuantityResponse, type SubscriptionUpdateTrialResponse as SubscriptionUpdateTrialResponse, SubscriptionsPage as SubscriptionsPage, SubscriptionFetchScheduleResponsesPage as SubscriptionFetchScheduleResponsesPage, type SubscriptionCreateParams as SubscriptionCreateParams, type SubscriptionUpdateParams as SubscriptionUpdateParams, type SubscriptionListParams as SubscriptionListParams, type SubscriptionCancelParams as SubscriptionCancelParams, type SubscriptionFetchCostsParams as SubscriptionFetchCostsParams, type SubscriptionFetchScheduleParams as SubscriptionFetchScheduleParams, type SubscriptionFetchUsageParams as SubscriptionFetchUsageParams, type SubscriptionPriceIntervalsParams as SubscriptionPriceIntervalsParams, type SubscriptionSchedulePlanChangeParams as SubscriptionSchedulePlanChangeParams, type SubscriptionTriggerPhaseParams as SubscriptionTriggerPhaseParams, type SubscriptionUnscheduleFixedFeeQuantityUpdatesParams as SubscriptionUnscheduleFixedFeeQuantityUpdatesParams, type SubscriptionUpdateFixedFeeQuantityParams as SubscriptionUpdateFixedFeeQuantityParams, type SubscriptionUpdateTrialParams as SubscriptionUpdateTrialParams, };
28879
+ export { type Subscription as Subscription, type SubscriptionUsage as SubscriptionUsage, type Subscriptions as Subscriptions, type SubscriptionCreateResponse as SubscriptionCreateResponse, type SubscriptionCancelResponse as SubscriptionCancelResponse, type SubscriptionFetchCostsResponse as SubscriptionFetchCostsResponse, type SubscriptionFetchScheduleResponse as SubscriptionFetchScheduleResponse, type SubscriptionPriceIntervalsResponse as SubscriptionPriceIntervalsResponse, type SubscriptionRedeemCouponResponse as SubscriptionRedeemCouponResponse, type SubscriptionSchedulePlanChangeResponse as SubscriptionSchedulePlanChangeResponse, type SubscriptionTriggerPhaseResponse as SubscriptionTriggerPhaseResponse, type SubscriptionUnscheduleCancellationResponse as SubscriptionUnscheduleCancellationResponse, type SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse as SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse, type SubscriptionUnschedulePendingPlanChangesResponse as SubscriptionUnschedulePendingPlanChangesResponse, type SubscriptionUpdateFixedFeeQuantityResponse as SubscriptionUpdateFixedFeeQuantityResponse, type SubscriptionUpdateTrialResponse as SubscriptionUpdateTrialResponse, SubscriptionsPage as SubscriptionsPage, SubscriptionFetchScheduleResponsesPage as SubscriptionFetchScheduleResponsesPage, type SubscriptionCreateParams as SubscriptionCreateParams, type SubscriptionUpdateParams as SubscriptionUpdateParams, type SubscriptionListParams as SubscriptionListParams, type SubscriptionCancelParams as SubscriptionCancelParams, type SubscriptionFetchCostsParams as SubscriptionFetchCostsParams, type SubscriptionFetchScheduleParams as SubscriptionFetchScheduleParams, type SubscriptionFetchUsageParams as SubscriptionFetchUsageParams, type SubscriptionPriceIntervalsParams as SubscriptionPriceIntervalsParams, type SubscriptionRedeemCouponParams as SubscriptionRedeemCouponParams, type SubscriptionSchedulePlanChangeParams as SubscriptionSchedulePlanChangeParams, type SubscriptionTriggerPhaseParams as SubscriptionTriggerPhaseParams, type SubscriptionUnscheduleFixedFeeQuantityUpdatesParams as SubscriptionUnscheduleFixedFeeQuantityUpdatesParams, type SubscriptionUpdateFixedFeeQuantityParams as SubscriptionUpdateFixedFeeQuantityParams, type SubscriptionUpdateTrialParams as SubscriptionUpdateTrialParams, };
28143
28880
  }
28144
28881
  //# sourceMappingURL=subscriptions.d.ts.map