orb-billing 4.32.0 → 4.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/README.md +2 -2
- package/package.json +2 -2
- package/resources/customers/customers.d.ts +2 -4
- package/resources/customers/customers.d.ts.map +1 -1
- package/resources/customers/customers.js +15 -8
- package/resources/customers/customers.js.map +1 -1
- package/resources/customers/customers.mjs +15 -8
- package/resources/customers/customers.mjs.map +1 -1
- package/resources/events/volume.d.ts +8 -9
- package/resources/events/volume.d.ts.map +1 -1
- package/resources/events/volume.js +16 -5
- package/resources/events/volume.js.map +1 -1
- package/resources/events/volume.mjs +16 -5
- package/resources/events/volume.mjs.map +1 -1
- package/resources/invoices.d.ts +3 -5
- package/resources/invoices.d.ts.map +1 -1
- package/resources/invoices.js +14 -8
- package/resources/invoices.js.map +1 -1
- package/resources/invoices.mjs +14 -8
- package/resources/invoices.mjs.map +1 -1
- package/resources/items.d.ts +1 -2
- package/resources/items.d.ts.map +1 -1
- package/resources/items.js +4 -4
- package/resources/items.js.map +1 -1
- package/resources/items.mjs +4 -4
- package/resources/items.mjs.map +1 -1
- package/resources/metrics.d.ts +1 -2
- package/resources/metrics.d.ts.map +1 -1
- package/resources/metrics.js +6 -4
- package/resources/metrics.js.map +1 -1
- package/resources/metrics.mjs +6 -4
- package/resources/metrics.mjs.map +1 -1
- package/resources/plans/external-plan-id.d.ts +1 -2
- package/resources/plans/external-plan-id.d.ts.map +1 -1
- package/resources/plans/external-plan-id.js +7 -5
- package/resources/plans/external-plan-id.js.map +1 -1
- package/resources/plans/external-plan-id.mjs +7 -5
- package/resources/plans/external-plan-id.mjs.map +1 -1
- package/resources/plans/plans.d.ts +1 -2
- package/resources/plans/plans.d.ts.map +1 -1
- package/resources/plans/plans.js +7 -4
- package/resources/plans/plans.js.map +1 -1
- package/resources/plans/plans.mjs +7 -4
- package/resources/plans/plans.mjs.map +1 -1
- package/resources/prices/external-price-id.d.ts +1 -2
- package/resources/prices/external-price-id.d.ts.map +1 -1
- package/resources/prices/external-price-id.js +6 -5
- package/resources/prices/external-price-id.js.map +1 -1
- package/resources/prices/external-price-id.mjs +6 -5
- package/resources/prices/external-price-id.mjs.map +1 -1
- package/resources/prices/prices.d.ts +1 -2
- package/resources/prices/prices.d.ts.map +1 -1
- package/resources/prices/prices.js +6 -4
- package/resources/prices/prices.js.map +1 -1
- package/resources/prices/prices.mjs +6 -4
- package/resources/prices/prices.mjs.map +1 -1
- package/resources/subscriptions.d.ts +10 -12
- package/resources/subscriptions.d.ts.map +1 -1
- package/resources/subscriptions.js +346 -18
- package/resources/subscriptions.js.map +1 -1
- package/resources/subscriptions.mjs +346 -18
- package/resources/subscriptions.mjs.map +1 -1
- package/src/resources/customers/customers.ts +2 -20
- package/src/resources/events/volume.ts +9 -18
- package/src/resources/invoices.ts +3 -20
- package/src/resources/items.ts +1 -10
- package/src/resources/metrics.ts +1 -10
- package/src/resources/plans/external-plan-id.ts +1 -11
- package/src/resources/plans/plans.ts +1 -10
- package/src/resources/prices/external-price-id.ts +1 -11
- package/src/resources/prices/prices.ts +1 -10
- package/src/resources/subscriptions.ts +10 -43
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -30,16 +30,271 @@ const core_1 = require("../core.js");
|
|
|
30
30
|
const SubscriptionsAPI = __importStar(require("./subscriptions.js"));
|
|
31
31
|
const pagination_1 = require("../pagination.js");
|
|
32
32
|
class Subscriptions extends resource_1.APIResource {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
/**
|
|
34
|
+
* A subscription represents the purchase of a plan by a customer. The customer is
|
|
35
|
+
* identified by either the `customer_id` or the `external_customer_id`, and
|
|
36
|
+
* exactly one of these fields must be provided.
|
|
37
|
+
*
|
|
38
|
+
* By default, subscriptions begin on the day that they're created and renew
|
|
39
|
+
* automatically for each billing cycle at the cadence that's configured in the
|
|
40
|
+
* plan definition.
|
|
41
|
+
*
|
|
42
|
+
* The default configuration for subscriptions in Orb is **In-advance billing** and
|
|
43
|
+
* **Beginning of month alignment** (see
|
|
44
|
+
* [Subscription](../guides/concepts#subscription) for more details).
|
|
45
|
+
*
|
|
46
|
+
* In order to change the alignment behavior, Orb also supports billing
|
|
47
|
+
* subscriptions on the day of the month they are created. If
|
|
48
|
+
* `align_billing_with_subscription_start_date = true` is specified, subscriptions
|
|
49
|
+
* have billing cycles that are aligned with their `start_date`. For example, a
|
|
50
|
+
* subscription that begins on January 15th will have a billing cycle from January
|
|
51
|
+
* 15th to February 15th. Every subsequent billing cycle will continue to start and
|
|
52
|
+
* invoice on the 15th.
|
|
53
|
+
*
|
|
54
|
+
* If the "day" value is greater than the number of days in the month, the next
|
|
55
|
+
* billing cycle will start at the end of the month. For example, if the start_date
|
|
56
|
+
* is January 31st, the next billing cycle will start on February 28th.
|
|
57
|
+
*
|
|
58
|
+
* If a customer was created with a currency, Orb only allows subscribing the
|
|
59
|
+
* customer to a plan with a matching `invoicing_currency`. If the customer does
|
|
60
|
+
* not have a currency set, on subscription creation, we set the customer's
|
|
61
|
+
* currency to be the `invoicing_currency` of the plan.
|
|
62
|
+
*
|
|
63
|
+
* ## Customize your customer's subscriptions
|
|
64
|
+
*
|
|
65
|
+
* Prices and adjustments in a plan can be added, removed, or replaced for the
|
|
66
|
+
* subscription being created. This is useful when a customer has prices that
|
|
67
|
+
* differ from the default prices for a specific plan.
|
|
68
|
+
*
|
|
69
|
+
* :::info This feature is only available for accounts that have migrated to
|
|
70
|
+
* Subscription Overrides Version 2. You can find your Subscription Overrides
|
|
71
|
+
* Version at the bottom of your [Plans page](https://app.withorb.com/plans) :::
|
|
72
|
+
*
|
|
73
|
+
* ### Adding Prices
|
|
74
|
+
*
|
|
75
|
+
* To add prices, provide a list of objects with the key `add_prices`. An object in
|
|
76
|
+
* the list must specify an existing add-on price with a `price_id` or
|
|
77
|
+
* `external_price_id` field, or create a new add-on price by including an object
|
|
78
|
+
* with the key `price`, identical to what would be used in the request body for
|
|
79
|
+
* the [create price endpoint](../reference/create-price). See the
|
|
80
|
+
* [Price resource](../reference/price) for the specification of different price
|
|
81
|
+
* model configurations possible in this object.
|
|
82
|
+
*
|
|
83
|
+
* If the plan has phases, each object in the list must include a number with
|
|
84
|
+
* `plan_phase_order` key to indicate which phase the price should be added to.
|
|
85
|
+
*
|
|
86
|
+
* An object in the list can specify an optional `start_date` and optional
|
|
87
|
+
* `end_date`. This is equivalent to creating a price interval with the
|
|
88
|
+
* [add/edit price intervals endpoint](../reference/add-edit-price-intervals). If
|
|
89
|
+
* unspecified, the start or end date of the phase or subscription will be used.
|
|
90
|
+
*
|
|
91
|
+
* An object in the list can specify an optional `minimum_amount`,
|
|
92
|
+
* `maximum_amount`, or `discounts`. This will create adjustments which apply only
|
|
93
|
+
* to this price.
|
|
94
|
+
*
|
|
95
|
+
* Additionally, an object in the list can specify an optional `reference_id`. This
|
|
96
|
+
* ID can be used to reference this price when
|
|
97
|
+
* [adding an adjustment](#adding-adjustments) in the same API call. However the ID
|
|
98
|
+
* is _transient_ and cannot be used to refer to the price in future API calls.
|
|
99
|
+
*
|
|
100
|
+
* ### Removing Prices
|
|
101
|
+
*
|
|
102
|
+
* To remove prices, provide a list of objects with the key `remove_prices`. An
|
|
103
|
+
* object in the list must specify a plan price with either a `price_id` or
|
|
104
|
+
* `external_price_id` field.
|
|
105
|
+
*
|
|
106
|
+
* ### Replacing Prices
|
|
107
|
+
*
|
|
108
|
+
* To replace prices, provide a list of objects with the key `replace_prices`. An
|
|
109
|
+
* object in the list must specify a plan price to replace with the
|
|
110
|
+
* `replaces_price_id` key, and it must specify a price to replace it with by
|
|
111
|
+
* either referencing an existing add-on price with a `price_id` or
|
|
112
|
+
* `external_price_id` field, or by creating a new add-on price by including an
|
|
113
|
+
* object with the key `price`, identical to what would be used in the request body
|
|
114
|
+
* for the [create price endpoint](../reference/create-price). See the
|
|
115
|
+
* [Price resource](../reference/price) for the specification of different price
|
|
116
|
+
* model configurations possible in this object.
|
|
117
|
+
*
|
|
118
|
+
* For fixed fees, an object in the list can supply a `fixed_price_quantity`
|
|
119
|
+
* instead of a `price`, `price_id`, or `external_price_id` field. This will update
|
|
120
|
+
* only the quantity for the price, similar to the
|
|
121
|
+
* [Update price quantity](../reference/update-fixed-fee-quantity) endpoint.
|
|
122
|
+
*
|
|
123
|
+
* The replacement price will have the same phase, if applicable, and the same
|
|
124
|
+
* start and end dates as the price it replaces.
|
|
125
|
+
*
|
|
126
|
+
* An object in the list can specify an optional `minimum_amount`,
|
|
127
|
+
* `maximum_amount`, or `discounts`. This will create adjustments which apply only
|
|
128
|
+
* to this price.
|
|
129
|
+
*
|
|
130
|
+
* Additionally, an object in the list can specify an optional `reference_id`. This
|
|
131
|
+
* ID can be used to reference the replacement price when
|
|
132
|
+
* [adding an adjustment](#adding-adjustments) in the same API call. However the ID
|
|
133
|
+
* is _transient_ and cannot be used to refer to the price in future API calls.
|
|
134
|
+
*
|
|
135
|
+
* ### Adding adjustments
|
|
136
|
+
*
|
|
137
|
+
* To add adjustments, provide a list of objects with the key `add_adjustments`. An
|
|
138
|
+
* object in the list must include an object with the key `adjustment`, identical
|
|
139
|
+
* to the adjustment object in the
|
|
140
|
+
* [add/edit price intervals endpoint](../reference/add-edit-price-intervals).
|
|
141
|
+
*
|
|
142
|
+
* If the plan has phases, each object in the list must include a number with
|
|
143
|
+
* `plan_phase_order` key to indicate which phase the adjustment should be added
|
|
144
|
+
* to.
|
|
145
|
+
*
|
|
146
|
+
* An object in the list can specify an optional `start_date` and optional
|
|
147
|
+
* `end_date`. If unspecified, the start or end date of the phase or subscription
|
|
148
|
+
* will be used.
|
|
149
|
+
*
|
|
150
|
+
* ### Removing adjustments
|
|
151
|
+
*
|
|
152
|
+
* To remove adjustments, provide a list of objects with the key
|
|
153
|
+
* `remove_adjustments`. An object in the list must include a key, `adjustment_id`,
|
|
154
|
+
* with the ID of the adjustment to be removed.
|
|
155
|
+
*
|
|
156
|
+
* ### Replacing adjustments
|
|
157
|
+
*
|
|
158
|
+
* To replace adjustments, provide a list of objects with the key
|
|
159
|
+
* `replace_adjustments`. An object in the list must specify a plan adjustment to
|
|
160
|
+
* replace with the `replaces_adjustment_id` key, and it must specify an adjustment
|
|
161
|
+
* to replace it with by including an object with the key `adjustment`, identical
|
|
162
|
+
* to the adjustment object in the
|
|
163
|
+
* [add/edit price intervals endpoint](../reference/add-edit-price-intervals).
|
|
164
|
+
*
|
|
165
|
+
* The replacement adjustment will have the same phase, if applicable, and the same
|
|
166
|
+
* start and end dates as the adjustment it replaces.
|
|
167
|
+
*
|
|
168
|
+
* ## Price overrides (DEPRECATED)
|
|
169
|
+
*
|
|
170
|
+
* :::info Price overrides are being phased out in favor adding/removing/replacing
|
|
171
|
+
* prices. (See
|
|
172
|
+
* [Customize your customer's subscriptions](../reference/create-subscription#customize-your-customers-subscriptions))
|
|
173
|
+
* :::
|
|
174
|
+
*
|
|
175
|
+
* Price overrides are used to update some or all prices in a plan for the specific
|
|
176
|
+
* subscription being created. This is useful when a new customer has negotiated a
|
|
177
|
+
* rate that is unique to the customer.
|
|
178
|
+
*
|
|
179
|
+
* To override prices, provide a list of objects with the key `price_overrides`.
|
|
180
|
+
* The price object in the list of overrides is expected to contain the existing
|
|
181
|
+
* price id, the `model_type` and configuration. (See the
|
|
182
|
+
* [Price resource](../reference/price) for the specification of different price
|
|
183
|
+
* model configurations.) The numerical values can be updated, but the billable
|
|
184
|
+
* metric, cadence, type, and name of a price can not be overridden.
|
|
185
|
+
*
|
|
186
|
+
* ### Maximums and Minimums
|
|
187
|
+
*
|
|
188
|
+
* Minimums and maximums, much like price overrides, can be useful when a new
|
|
189
|
+
* customer has negotiated a new or different minimum or maximum spend cap than the
|
|
190
|
+
* default for a given price. If one exists for a price and null is provided for
|
|
191
|
+
* the minimum/maximum override on creation, then there will be no minimum/maximum
|
|
192
|
+
* on the new subscription. If no value is provided, then the default price maximum
|
|
193
|
+
* or minimum is used.
|
|
194
|
+
*
|
|
195
|
+
* To add a minimum for a specific price, add `minimum_amount` to the specific
|
|
196
|
+
* price in the `price_overrides` object.
|
|
197
|
+
*
|
|
198
|
+
* To add a maximum for a specific price, add `maximum_amount` to the specific
|
|
199
|
+
* price in the `price_overrides` object.
|
|
200
|
+
*
|
|
201
|
+
* ### Minimum override example
|
|
202
|
+
*
|
|
203
|
+
* Price minimum override example:
|
|
204
|
+
*
|
|
205
|
+
* ```json
|
|
206
|
+
* {
|
|
207
|
+
* ...
|
|
208
|
+
* "id": "price_id",
|
|
209
|
+
* "model_type": "unit",
|
|
210
|
+
* "unit_config": {
|
|
211
|
+
* "unit_amount": "0.50"
|
|
212
|
+
* },
|
|
213
|
+
* "minimum_amount": "100.00"
|
|
214
|
+
* ...
|
|
215
|
+
* }
|
|
216
|
+
* ```
|
|
217
|
+
*
|
|
218
|
+
* Removing an existing minimum example
|
|
219
|
+
*
|
|
220
|
+
* ```json
|
|
221
|
+
* {
|
|
222
|
+
* ...
|
|
223
|
+
* "id": "price_id",
|
|
224
|
+
* "model_type": "unit",
|
|
225
|
+
* "unit_config": {
|
|
226
|
+
* "unit_amount": "0.50"
|
|
227
|
+
* },
|
|
228
|
+
* "minimum_amount": null
|
|
229
|
+
* ...
|
|
230
|
+
* }
|
|
231
|
+
* ```
|
|
232
|
+
*
|
|
233
|
+
* ### Discounts
|
|
234
|
+
*
|
|
235
|
+
* Discounts, like price overrides, can be useful when a new customer has
|
|
236
|
+
* negotiated a new or different discount than the default for a price. If a
|
|
237
|
+
* discount exists for a price and a null discount is provided on creation, then
|
|
238
|
+
* there will be no discount on the new subscription.
|
|
239
|
+
*
|
|
240
|
+
* To add a discount for a specific price, add `discount` to the price in the
|
|
241
|
+
* `price_overrides` object. Discount should be a dictionary of the format:
|
|
242
|
+
*
|
|
243
|
+
* ```ts
|
|
244
|
+
* {
|
|
245
|
+
* "discount_type": "amount" | "percentage" | "usage",
|
|
246
|
+
* "amount_discount": string,
|
|
247
|
+
* "percentage_discount": string,
|
|
248
|
+
* "usage_discount": string
|
|
249
|
+
* }
|
|
250
|
+
* ```
|
|
251
|
+
*
|
|
252
|
+
* where either `amount_discount`, `percentage_discount`, or `usage_discount` is
|
|
253
|
+
* provided.
|
|
254
|
+
*
|
|
255
|
+
* Price discount example
|
|
256
|
+
*
|
|
257
|
+
* ```json
|
|
258
|
+
* {
|
|
259
|
+
* ...
|
|
260
|
+
* "id": "price_id",
|
|
261
|
+
* "model_type": "unit",
|
|
262
|
+
* "unit_config": {
|
|
263
|
+
* "unit_amount": "0.50"
|
|
264
|
+
* },
|
|
265
|
+
* "discount": {"discount_type": "amount", "amount_discount": "175"},
|
|
266
|
+
* }
|
|
267
|
+
* ```
|
|
268
|
+
*
|
|
269
|
+
* Removing an existing discount example
|
|
270
|
+
*
|
|
271
|
+
* ```json
|
|
272
|
+
* {
|
|
273
|
+
* "customer_id": "customer_id",
|
|
274
|
+
* "plan_id": "plan_id",
|
|
275
|
+
* "discount": null,
|
|
276
|
+
* "price_overrides": [ ... ]
|
|
277
|
+
* ...
|
|
278
|
+
* }
|
|
279
|
+
* ```
|
|
280
|
+
*
|
|
281
|
+
* ## Threshold Billing
|
|
282
|
+
*
|
|
283
|
+
* Orb supports invoicing for a subscription when a preconfigured usage threshold
|
|
284
|
+
* is hit. To enable threshold billing, pass in an `invoicing_threshold`, which is
|
|
285
|
+
* specified in the subscription's invoicing currency, when creating a
|
|
286
|
+
* subscription. E.g. pass in `10.00` to issue an invoice when usage amounts hit
|
|
287
|
+
* $10.00 for a subscription that invoices in USD.
|
|
288
|
+
*/
|
|
289
|
+
create(body, options) {
|
|
37
290
|
return this._client.post('/subscriptions', { body, ...options });
|
|
38
291
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
292
|
+
/**
|
|
293
|
+
* This endpoint can be used to update the `metadata`, `net terms`,
|
|
294
|
+
* `auto_collection`, `invoicing_threshold`, and `default_invoice_memo` properties
|
|
295
|
+
* on a subscription.
|
|
296
|
+
*/
|
|
297
|
+
update(subscriptionId, body, options) {
|
|
43
298
|
return this._client.put(`/subscriptions/${subscriptionId}`, { body, ...options });
|
|
44
299
|
}
|
|
45
300
|
list(query = {}, options) {
|
|
@@ -139,10 +394,81 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
139
394
|
}
|
|
140
395
|
return this._client.get(`/subscriptions/${subscriptionId}/usage`, { query, ...options });
|
|
141
396
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
397
|
+
/**
|
|
398
|
+
* This endpoint is used to add and edit subscription
|
|
399
|
+
* [price intervals](../reference/price-interval). By making modifications to a
|
|
400
|
+
* subscription’s price intervals, you can
|
|
401
|
+
* [flexibly and atomically control the billing behavior of a subscription](../guides/product-catalog/modifying-subscriptions).
|
|
402
|
+
*
|
|
403
|
+
* ## Adding price intervals
|
|
404
|
+
*
|
|
405
|
+
* Prices can be added as price intervals to a subscription by specifying them in
|
|
406
|
+
* the `add` array. A `price_id` or `external_price_id` from an add-on price or
|
|
407
|
+
* previously removed plan price can be specified to reuse an existing price
|
|
408
|
+
* definition (however, please note that prices from other plans cannot be added to
|
|
409
|
+
* the subscription). Additionally, a new price can be specified using the `price`
|
|
410
|
+
* field — this price will be created automatically.
|
|
411
|
+
*
|
|
412
|
+
* A `start_date` must be specified for the price interval. This is the date when
|
|
413
|
+
* the price will start billing on the subscription, so this will notably result in
|
|
414
|
+
* an immediate charge at this time for any billed in advance fixed fees. The
|
|
415
|
+
* `end_date` will default to null, resulting in a price interval that will bill on
|
|
416
|
+
* a continually recurring basis. Both of these dates can be set in the past or the
|
|
417
|
+
* future and Orb will generate or modify invoices to ensure the subscription’s
|
|
418
|
+
* invoicing behavior is correct.
|
|
419
|
+
*
|
|
420
|
+
* Additionally, a discount, minimum, or maximum can be specified on the price
|
|
421
|
+
* interval. This will only apply to this price interval, not any other price
|
|
422
|
+
* intervals on the subscription.
|
|
423
|
+
*
|
|
424
|
+
* ## Adjustment intervals
|
|
425
|
+
*
|
|
426
|
+
* An adjustment interval represents the time period that a particular adjustment
|
|
427
|
+
* (a discount, minimum, or maximum) applies to the prices on a subscription.
|
|
428
|
+
* Adjustment intervals can be added to a subscription by specifying them in the
|
|
429
|
+
* `add_adjustments` array, or modified via the `edit_adjustments` array. When
|
|
430
|
+
* creating an adjustment interval, you'll need to provide the definition of the
|
|
431
|
+
* new adjustment (the type of adjustment, and which prices it applies to), as well
|
|
432
|
+
* as the start and end dates for the adjustment interval. The start and end dates
|
|
433
|
+
* of an existing adjustment interval can be edited via the `edit_adjustments`
|
|
434
|
+
* field (just like price intervals). (To "change" the amount of a discount,
|
|
435
|
+
* minimum, or maximum, then, you'll need to end the existing interval, and create
|
|
436
|
+
* a new adjustment interval with the new amount and a start date that matches the
|
|
437
|
+
* end date of the previous interval.)
|
|
438
|
+
*
|
|
439
|
+
* ## Editing price intervals
|
|
440
|
+
*
|
|
441
|
+
* Price intervals can be adjusted by specifying edits to make in the `edit` array.
|
|
442
|
+
* A `price_interval_id` to edit must be specified — this can be retrieved from the
|
|
443
|
+
* `price_intervals` field on the subscription.
|
|
444
|
+
*
|
|
445
|
+
* A new `start_date` or `end_date` can be specified to change the range of the
|
|
446
|
+
* price interval, which will modify past or future invoices to ensure correctness.
|
|
447
|
+
* If either of these dates are unspecified, they will default to the existing date
|
|
448
|
+
* on the price interval. To remove a price interval entirely from a subscription,
|
|
449
|
+
* set the `end_date` to be equivalent to the `start_date`.
|
|
450
|
+
*
|
|
451
|
+
* ## Fixed fee quantity transitions
|
|
452
|
+
*
|
|
453
|
+
* The fixed fee quantity transitions for a fixed fee price interval can also be
|
|
454
|
+
* specified when adding or editing by passing an array for
|
|
455
|
+
* `fixed_fee_quantity_transitions`. A fixed fee quantity transition must have a
|
|
456
|
+
* `quantity` and an `effective_date`, which is the date after which the new
|
|
457
|
+
* quantity will be used for billing. If a fixed fee quantity transition is
|
|
458
|
+
* scheduled at a billing period boundary, the full quantity will be billed on an
|
|
459
|
+
* invoice with the other prices on the subscription. If the fixed fee quantity
|
|
460
|
+
* transition is scheduled mid-billing period, the difference between the existing
|
|
461
|
+
* quantity and quantity specified in the transition will be prorated for the rest
|
|
462
|
+
* of the billing period and billed immediately, which will generate a new invoice.
|
|
463
|
+
*
|
|
464
|
+
* Notably, the list of fixed fee quantity transitions passed will overwrite the
|
|
465
|
+
* existing fixed fee quantity transitions on the price interval, so the entire
|
|
466
|
+
* list of transitions must be specified to add additional transitions. The
|
|
467
|
+
* existing list of transitions can be retrieved using the
|
|
468
|
+
* `fixed_fee_quantity_transitions` property on a subscription’s serialized price
|
|
469
|
+
* intervals.
|
|
470
|
+
*/
|
|
471
|
+
priceIntervals(subscriptionId, body, options) {
|
|
146
472
|
return this._client.post(`/subscriptions/${subscriptionId}/price_intervals`, { body, ...options });
|
|
147
473
|
}
|
|
148
474
|
/**
|
|
@@ -190,8 +516,9 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
190
516
|
* subscription when you schedule the plan change. This is useful when a customer
|
|
191
517
|
* has prices that differ from the default prices for a specific plan.
|
|
192
518
|
*
|
|
193
|
-
* :::info This feature is only available for accounts that have migrated
|
|
194
|
-
*
|
|
519
|
+
* :::info This feature is only available for accounts that have migrated to
|
|
520
|
+
* Subscription Overrides Version 2. You can find your Subscription Overrides
|
|
521
|
+
* Version at the bottom of your [Plans page](https://app.withorb.com/plans) :::
|
|
195
522
|
*
|
|
196
523
|
* ### Adding Prices
|
|
197
524
|
*
|
|
@@ -329,10 +656,11 @@ class Subscriptions extends resource_1.APIResource {
|
|
|
329
656
|
schedulePlanChange(subscriptionId, body, options) {
|
|
330
657
|
return this._client.post(`/subscriptions/${subscriptionId}/schedule_plan_change`, { body, ...options });
|
|
331
658
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
659
|
+
/**
|
|
660
|
+
* Manually trigger a phase, effective the given date (or the current time, if not
|
|
661
|
+
* specified).
|
|
662
|
+
*/
|
|
663
|
+
triggerPhase(subscriptionId, body, options) {
|
|
336
664
|
return this._client.post(`/subscriptions/${subscriptionId}/trigger_phase`, { body, ...options });
|
|
337
665
|
}
|
|
338
666
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../src/resources/subscriptions.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtF,6CAA0C;AAC1C,qCAA2C;AAE3C,qEAAoD;AAKpD,iDAAsD;AAEtD,MAAa,aAAc,SAAQ,sBAAW;
|
|
1
|
+
{"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../src/resources/subscriptions.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtF,6CAA0C;AAC1C,qCAA2C;AAE3C,qEAAoD;AAKpD,iDAAsD;AAEtD,MAAa,aAAc,SAAQ,sBAAW;IAC5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+PG;IACH,MAAM,CAAC,IAA8B,EAAE,OAA6B;QAClE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;;;OAIG;IACH,MAAM,CACJ,cAAsB,EACtB,IAA8B,EAC9B,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,cAAc,EAAE,EAAE,EAAE,IAAI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