orb-billing 4.31.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 +17 -0
- package/README.md +2 -2
- package/core.d.ts.map +1 -1
- package/core.js +5 -3
- package/core.js.map +1 -1
- package/core.mjs +5 -3
- package/core.mjs.map +1 -1
- 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 +5 -7
- 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 +8939 -2963
- package/resources/subscriptions.d.ts.map +1 -1
- package/resources/subscriptions.js +497 -34
- package/resources/subscriptions.js.map +1 -1
- package/resources/subscriptions.mjs +497 -34
- package/resources/subscriptions.mjs.map +1 -1
- package/src/core.ts +7 -3
- package/src/resources/customers/customers.ts +2 -20
- package/src/resources/events/volume.ts +9 -18
- package/src/resources/invoices.ts +5 -22
- 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 +10251 -3124
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -4,16 +4,271 @@ import { isRequestOptions } from "../core.mjs";
|
|
|
4
4
|
import * as SubscriptionsAPI from "./subscriptions.mjs";
|
|
5
5
|
import { Page } from "../pagination.mjs";
|
|
6
6
|
export class Subscriptions extends APIResource {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
/**
|
|
8
|
+
* A subscription represents the purchase of a plan by a customer. The customer is
|
|
9
|
+
* identified by either the `customer_id` or the `external_customer_id`, and
|
|
10
|
+
* exactly one of these fields must be provided.
|
|
11
|
+
*
|
|
12
|
+
* By default, subscriptions begin on the day that they're created and renew
|
|
13
|
+
* automatically for each billing cycle at the cadence that's configured in the
|
|
14
|
+
* plan definition.
|
|
15
|
+
*
|
|
16
|
+
* The default configuration for subscriptions in Orb is **In-advance billing** and
|
|
17
|
+
* **Beginning of month alignment** (see
|
|
18
|
+
* [Subscription](../guides/concepts#subscription) for more details).
|
|
19
|
+
*
|
|
20
|
+
* In order to change the alignment behavior, Orb also supports billing
|
|
21
|
+
* subscriptions on the day of the month they are created. If
|
|
22
|
+
* `align_billing_with_subscription_start_date = true` is specified, subscriptions
|
|
23
|
+
* have billing cycles that are aligned with their `start_date`. For example, a
|
|
24
|
+
* subscription that begins on January 15th will have a billing cycle from January
|
|
25
|
+
* 15th to February 15th. Every subsequent billing cycle will continue to start and
|
|
26
|
+
* invoice on the 15th.
|
|
27
|
+
*
|
|
28
|
+
* If the "day" value is greater than the number of days in the month, the next
|
|
29
|
+
* billing cycle will start at the end of the month. For example, if the start_date
|
|
30
|
+
* is January 31st, the next billing cycle will start on February 28th.
|
|
31
|
+
*
|
|
32
|
+
* If a customer was created with a currency, Orb only allows subscribing the
|
|
33
|
+
* customer to a plan with a matching `invoicing_currency`. If the customer does
|
|
34
|
+
* not have a currency set, on subscription creation, we set the customer's
|
|
35
|
+
* currency to be the `invoicing_currency` of the plan.
|
|
36
|
+
*
|
|
37
|
+
* ## Customize your customer's subscriptions
|
|
38
|
+
*
|
|
39
|
+
* Prices and adjustments in a plan can be added, removed, or replaced for the
|
|
40
|
+
* subscription being created. This is useful when a customer has prices that
|
|
41
|
+
* differ from the default prices for a specific plan.
|
|
42
|
+
*
|
|
43
|
+
* :::info This feature is only available for accounts that have migrated to
|
|
44
|
+
* Subscription Overrides Version 2. You can find your Subscription Overrides
|
|
45
|
+
* Version at the bottom of your [Plans page](https://app.withorb.com/plans) :::
|
|
46
|
+
*
|
|
47
|
+
* ### Adding Prices
|
|
48
|
+
*
|
|
49
|
+
* To add prices, provide a list of objects with the key `add_prices`. An object in
|
|
50
|
+
* the list must specify an existing add-on price with a `price_id` or
|
|
51
|
+
* `external_price_id` field, or create a new add-on price by including an object
|
|
52
|
+
* with the key `price`, identical to what would be used in the request body for
|
|
53
|
+
* the [create price endpoint](../reference/create-price). See the
|
|
54
|
+
* [Price resource](../reference/price) for the specification of different price
|
|
55
|
+
* model configurations possible in this object.
|
|
56
|
+
*
|
|
57
|
+
* If the plan has phases, each object in the list must include a number with
|
|
58
|
+
* `plan_phase_order` key to indicate which phase the price should be added to.
|
|
59
|
+
*
|
|
60
|
+
* An object in the list can specify an optional `start_date` and optional
|
|
61
|
+
* `end_date`. This is equivalent to creating a price interval with the
|
|
62
|
+
* [add/edit price intervals endpoint](../reference/add-edit-price-intervals). If
|
|
63
|
+
* unspecified, the start or end date of the phase or subscription will be used.
|
|
64
|
+
*
|
|
65
|
+
* An object in the list can specify an optional `minimum_amount`,
|
|
66
|
+
* `maximum_amount`, or `discounts`. This will create adjustments which apply only
|
|
67
|
+
* to this price.
|
|
68
|
+
*
|
|
69
|
+
* Additionally, an object in the list can specify an optional `reference_id`. This
|
|
70
|
+
* ID can be used to reference this price when
|
|
71
|
+
* [adding an adjustment](#adding-adjustments) in the same API call. However the ID
|
|
72
|
+
* is _transient_ and cannot be used to refer to the price in future API calls.
|
|
73
|
+
*
|
|
74
|
+
* ### Removing Prices
|
|
75
|
+
*
|
|
76
|
+
* To remove prices, provide a list of objects with the key `remove_prices`. An
|
|
77
|
+
* object in the list must specify a plan price with either a `price_id` or
|
|
78
|
+
* `external_price_id` field.
|
|
79
|
+
*
|
|
80
|
+
* ### Replacing Prices
|
|
81
|
+
*
|
|
82
|
+
* To replace prices, provide a list of objects with the key `replace_prices`. An
|
|
83
|
+
* object in the list must specify a plan price to replace with the
|
|
84
|
+
* `replaces_price_id` key, and it must specify a price to replace it with by
|
|
85
|
+
* either referencing an existing add-on price with a `price_id` or
|
|
86
|
+
* `external_price_id` field, or by creating a new add-on price by including an
|
|
87
|
+
* object with the key `price`, identical to what would be used in the request body
|
|
88
|
+
* for the [create price endpoint](../reference/create-price). See the
|
|
89
|
+
* [Price resource](../reference/price) for the specification of different price
|
|
90
|
+
* model configurations possible in this object.
|
|
91
|
+
*
|
|
92
|
+
* For fixed fees, an object in the list can supply a `fixed_price_quantity`
|
|
93
|
+
* instead of a `price`, `price_id`, or `external_price_id` field. This will update
|
|
94
|
+
* only the quantity for the price, similar to the
|
|
95
|
+
* [Update price quantity](../reference/update-fixed-fee-quantity) endpoint.
|
|
96
|
+
*
|
|
97
|
+
* The replacement price will have the same phase, if applicable, and the same
|
|
98
|
+
* start and end dates as the price it replaces.
|
|
99
|
+
*
|
|
100
|
+
* An object in the list can specify an optional `minimum_amount`,
|
|
101
|
+
* `maximum_amount`, or `discounts`. This will create adjustments which apply only
|
|
102
|
+
* to this price.
|
|
103
|
+
*
|
|
104
|
+
* Additionally, an object in the list can specify an optional `reference_id`. This
|
|
105
|
+
* ID can be used to reference the replacement price when
|
|
106
|
+
* [adding an adjustment](#adding-adjustments) in the same API call. However the ID
|
|
107
|
+
* is _transient_ and cannot be used to refer to the price in future API calls.
|
|
108
|
+
*
|
|
109
|
+
* ### Adding adjustments
|
|
110
|
+
*
|
|
111
|
+
* To add adjustments, provide a list of objects with the key `add_adjustments`. An
|
|
112
|
+
* object in the list must include an object with the key `adjustment`, identical
|
|
113
|
+
* to the adjustment object in the
|
|
114
|
+
* [add/edit price intervals endpoint](../reference/add-edit-price-intervals).
|
|
115
|
+
*
|
|
116
|
+
* If the plan has phases, each object in the list must include a number with
|
|
117
|
+
* `plan_phase_order` key to indicate which phase the adjustment should be added
|
|
118
|
+
* to.
|
|
119
|
+
*
|
|
120
|
+
* An object in the list can specify an optional `start_date` and optional
|
|
121
|
+
* `end_date`. If unspecified, the start or end date of the phase or subscription
|
|
122
|
+
* will be used.
|
|
123
|
+
*
|
|
124
|
+
* ### Removing adjustments
|
|
125
|
+
*
|
|
126
|
+
* To remove adjustments, provide a list of objects with the key
|
|
127
|
+
* `remove_adjustments`. An object in the list must include a key, `adjustment_id`,
|
|
128
|
+
* with the ID of the adjustment to be removed.
|
|
129
|
+
*
|
|
130
|
+
* ### Replacing adjustments
|
|
131
|
+
*
|
|
132
|
+
* To replace adjustments, provide a list of objects with the key
|
|
133
|
+
* `replace_adjustments`. An object in the list must specify a plan adjustment to
|
|
134
|
+
* replace with the `replaces_adjustment_id` key, and it must specify an adjustment
|
|
135
|
+
* to replace it with by including an object with the key `adjustment`, identical
|
|
136
|
+
* to the adjustment object in the
|
|
137
|
+
* [add/edit price intervals endpoint](../reference/add-edit-price-intervals).
|
|
138
|
+
*
|
|
139
|
+
* The replacement adjustment will have the same phase, if applicable, and the same
|
|
140
|
+
* start and end dates as the adjustment it replaces.
|
|
141
|
+
*
|
|
142
|
+
* ## Price overrides (DEPRECATED)
|
|
143
|
+
*
|
|
144
|
+
* :::info Price overrides are being phased out in favor adding/removing/replacing
|
|
145
|
+
* prices. (See
|
|
146
|
+
* [Customize your customer's subscriptions](../reference/create-subscription#customize-your-customers-subscriptions))
|
|
147
|
+
* :::
|
|
148
|
+
*
|
|
149
|
+
* Price overrides are used to update some or all prices in a plan for the specific
|
|
150
|
+
* subscription being created. This is useful when a new customer has negotiated a
|
|
151
|
+
* rate that is unique to the customer.
|
|
152
|
+
*
|
|
153
|
+
* To override prices, provide a list of objects with the key `price_overrides`.
|
|
154
|
+
* The price object in the list of overrides is expected to contain the existing
|
|
155
|
+
* price id, the `model_type` and configuration. (See the
|
|
156
|
+
* [Price resource](../reference/price) for the specification of different price
|
|
157
|
+
* model configurations.) The numerical values can be updated, but the billable
|
|
158
|
+
* metric, cadence, type, and name of a price can not be overridden.
|
|
159
|
+
*
|
|
160
|
+
* ### Maximums and Minimums
|
|
161
|
+
*
|
|
162
|
+
* Minimums and maximums, much like price overrides, can be useful when a new
|
|
163
|
+
* customer has negotiated a new or different minimum or maximum spend cap than the
|
|
164
|
+
* default for a given price. If one exists for a price and null is provided for
|
|
165
|
+
* the minimum/maximum override on creation, then there will be no minimum/maximum
|
|
166
|
+
* on the new subscription. If no value is provided, then the default price maximum
|
|
167
|
+
* or minimum is used.
|
|
168
|
+
*
|
|
169
|
+
* To add a minimum for a specific price, add `minimum_amount` to the specific
|
|
170
|
+
* price in the `price_overrides` object.
|
|
171
|
+
*
|
|
172
|
+
* To add a maximum for a specific price, add `maximum_amount` to the specific
|
|
173
|
+
* price in the `price_overrides` object.
|
|
174
|
+
*
|
|
175
|
+
* ### Minimum override example
|
|
176
|
+
*
|
|
177
|
+
* Price minimum override example:
|
|
178
|
+
*
|
|
179
|
+
* ```json
|
|
180
|
+
* {
|
|
181
|
+
* ...
|
|
182
|
+
* "id": "price_id",
|
|
183
|
+
* "model_type": "unit",
|
|
184
|
+
* "unit_config": {
|
|
185
|
+
* "unit_amount": "0.50"
|
|
186
|
+
* },
|
|
187
|
+
* "minimum_amount": "100.00"
|
|
188
|
+
* ...
|
|
189
|
+
* }
|
|
190
|
+
* ```
|
|
191
|
+
*
|
|
192
|
+
* Removing an existing minimum example
|
|
193
|
+
*
|
|
194
|
+
* ```json
|
|
195
|
+
* {
|
|
196
|
+
* ...
|
|
197
|
+
* "id": "price_id",
|
|
198
|
+
* "model_type": "unit",
|
|
199
|
+
* "unit_config": {
|
|
200
|
+
* "unit_amount": "0.50"
|
|
201
|
+
* },
|
|
202
|
+
* "minimum_amount": null
|
|
203
|
+
* ...
|
|
204
|
+
* }
|
|
205
|
+
* ```
|
|
206
|
+
*
|
|
207
|
+
* ### Discounts
|
|
208
|
+
*
|
|
209
|
+
* Discounts, like price overrides, can be useful when a new customer has
|
|
210
|
+
* negotiated a new or different discount than the default for a price. If a
|
|
211
|
+
* discount exists for a price and a null discount is provided on creation, then
|
|
212
|
+
* there will be no discount on the new subscription.
|
|
213
|
+
*
|
|
214
|
+
* To add a discount for a specific price, add `discount` to the price in the
|
|
215
|
+
* `price_overrides` object. Discount should be a dictionary of the format:
|
|
216
|
+
*
|
|
217
|
+
* ```ts
|
|
218
|
+
* {
|
|
219
|
+
* "discount_type": "amount" | "percentage" | "usage",
|
|
220
|
+
* "amount_discount": string,
|
|
221
|
+
* "percentage_discount": string,
|
|
222
|
+
* "usage_discount": string
|
|
223
|
+
* }
|
|
224
|
+
* ```
|
|
225
|
+
*
|
|
226
|
+
* where either `amount_discount`, `percentage_discount`, or `usage_discount` is
|
|
227
|
+
* provided.
|
|
228
|
+
*
|
|
229
|
+
* Price discount example
|
|
230
|
+
*
|
|
231
|
+
* ```json
|
|
232
|
+
* {
|
|
233
|
+
* ...
|
|
234
|
+
* "id": "price_id",
|
|
235
|
+
* "model_type": "unit",
|
|
236
|
+
* "unit_config": {
|
|
237
|
+
* "unit_amount": "0.50"
|
|
238
|
+
* },
|
|
239
|
+
* "discount": {"discount_type": "amount", "amount_discount": "175"},
|
|
240
|
+
* }
|
|
241
|
+
* ```
|
|
242
|
+
*
|
|
243
|
+
* Removing an existing discount example
|
|
244
|
+
*
|
|
245
|
+
* ```json
|
|
246
|
+
* {
|
|
247
|
+
* "customer_id": "customer_id",
|
|
248
|
+
* "plan_id": "plan_id",
|
|
249
|
+
* "discount": null,
|
|
250
|
+
* "price_overrides": [ ... ]
|
|
251
|
+
* ...
|
|
252
|
+
* }
|
|
253
|
+
* ```
|
|
254
|
+
*
|
|
255
|
+
* ## Threshold Billing
|
|
256
|
+
*
|
|
257
|
+
* Orb supports invoicing for a subscription when a preconfigured usage threshold
|
|
258
|
+
* is hit. To enable threshold billing, pass in an `invoicing_threshold`, which is
|
|
259
|
+
* specified in the subscription's invoicing currency, when creating a
|
|
260
|
+
* subscription. E.g. pass in `10.00` to issue an invoice when usage amounts hit
|
|
261
|
+
* $10.00 for a subscription that invoices in USD.
|
|
262
|
+
*/
|
|
263
|
+
create(body, options) {
|
|
11
264
|
return this._client.post('/subscriptions', { body, ...options });
|
|
12
265
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
266
|
+
/**
|
|
267
|
+
* This endpoint can be used to update the `metadata`, `net terms`,
|
|
268
|
+
* `auto_collection`, `invoicing_threshold`, and `default_invoice_memo` properties
|
|
269
|
+
* on a subscription.
|
|
270
|
+
*/
|
|
271
|
+
update(subscriptionId, body, options) {
|
|
17
272
|
return this._client.put(`/subscriptions/${subscriptionId}`, { body, ...options });
|
|
18
273
|
}
|
|
19
274
|
list(query = {}, options) {
|
|
@@ -113,45 +368,252 @@ export class Subscriptions extends APIResource {
|
|
|
113
368
|
}
|
|
114
369
|
return this._client.get(`/subscriptions/${subscriptionId}/usage`, { query, ...options });
|
|
115
370
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
371
|
+
/**
|
|
372
|
+
* This endpoint is used to add and edit subscription
|
|
373
|
+
* [price intervals](../reference/price-interval). By making modifications to a
|
|
374
|
+
* subscription’s price intervals, you can
|
|
375
|
+
* [flexibly and atomically control the billing behavior of a subscription](../guides/product-catalog/modifying-subscriptions).
|
|
376
|
+
*
|
|
377
|
+
* ## Adding price intervals
|
|
378
|
+
*
|
|
379
|
+
* Prices can be added as price intervals to a subscription by specifying them in
|
|
380
|
+
* the `add` array. A `price_id` or `external_price_id` from an add-on price or
|
|
381
|
+
* previously removed plan price can be specified to reuse an existing price
|
|
382
|
+
* definition (however, please note that prices from other plans cannot be added to
|
|
383
|
+
* the subscription). Additionally, a new price can be specified using the `price`
|
|
384
|
+
* field — this price will be created automatically.
|
|
385
|
+
*
|
|
386
|
+
* A `start_date` must be specified for the price interval. This is the date when
|
|
387
|
+
* the price will start billing on the subscription, so this will notably result in
|
|
388
|
+
* an immediate charge at this time for any billed in advance fixed fees. The
|
|
389
|
+
* `end_date` will default to null, resulting in a price interval that will bill on
|
|
390
|
+
* a continually recurring basis. Both of these dates can be set in the past or the
|
|
391
|
+
* future and Orb will generate or modify invoices to ensure the subscription’s
|
|
392
|
+
* invoicing behavior is correct.
|
|
393
|
+
*
|
|
394
|
+
* Additionally, a discount, minimum, or maximum can be specified on the price
|
|
395
|
+
* interval. This will only apply to this price interval, not any other price
|
|
396
|
+
* intervals on the subscription.
|
|
397
|
+
*
|
|
398
|
+
* ## Adjustment intervals
|
|
399
|
+
*
|
|
400
|
+
* An adjustment interval represents the time period that a particular adjustment
|
|
401
|
+
* (a discount, minimum, or maximum) applies to the prices on a subscription.
|
|
402
|
+
* Adjustment intervals can be added to a subscription by specifying them in the
|
|
403
|
+
* `add_adjustments` array, or modified via the `edit_adjustments` array. When
|
|
404
|
+
* creating an adjustment interval, you'll need to provide the definition of the
|
|
405
|
+
* new adjustment (the type of adjustment, and which prices it applies to), as well
|
|
406
|
+
* as the start and end dates for the adjustment interval. The start and end dates
|
|
407
|
+
* of an existing adjustment interval can be edited via the `edit_adjustments`
|
|
408
|
+
* field (just like price intervals). (To "change" the amount of a discount,
|
|
409
|
+
* minimum, or maximum, then, you'll need to end the existing interval, and create
|
|
410
|
+
* a new adjustment interval with the new amount and a start date that matches the
|
|
411
|
+
* end date of the previous interval.)
|
|
412
|
+
*
|
|
413
|
+
* ## Editing price intervals
|
|
414
|
+
*
|
|
415
|
+
* Price intervals can be adjusted by specifying edits to make in the `edit` array.
|
|
416
|
+
* A `price_interval_id` to edit must be specified — this can be retrieved from the
|
|
417
|
+
* `price_intervals` field on the subscription.
|
|
418
|
+
*
|
|
419
|
+
* A new `start_date` or `end_date` can be specified to change the range of the
|
|
420
|
+
* price interval, which will modify past or future invoices to ensure correctness.
|
|
421
|
+
* If either of these dates are unspecified, they will default to the existing date
|
|
422
|
+
* on the price interval. To remove a price interval entirely from a subscription,
|
|
423
|
+
* set the `end_date` to be equivalent to the `start_date`.
|
|
424
|
+
*
|
|
425
|
+
* ## Fixed fee quantity transitions
|
|
426
|
+
*
|
|
427
|
+
* The fixed fee quantity transitions for a fixed fee price interval can also be
|
|
428
|
+
* specified when adding or editing by passing an array for
|
|
429
|
+
* `fixed_fee_quantity_transitions`. A fixed fee quantity transition must have a
|
|
430
|
+
* `quantity` and an `effective_date`, which is the date after which the new
|
|
431
|
+
* quantity will be used for billing. If a fixed fee quantity transition is
|
|
432
|
+
* scheduled at a billing period boundary, the full quantity will be billed on an
|
|
433
|
+
* invoice with the other prices on the subscription. If the fixed fee quantity
|
|
434
|
+
* transition is scheduled mid-billing period, the difference between the existing
|
|
435
|
+
* quantity and quantity specified in the transition will be prorated for the rest
|
|
436
|
+
* of the billing period and billed immediately, which will generate a new invoice.
|
|
437
|
+
*
|
|
438
|
+
* Notably, the list of fixed fee quantity transitions passed will overwrite the
|
|
439
|
+
* existing fixed fee quantity transitions on the price interval, so the entire
|
|
440
|
+
* list of transitions must be specified to add additional transitions. The
|
|
441
|
+
* existing list of transitions can be retrieved using the
|
|
442
|
+
* `fixed_fee_quantity_transitions` property on a subscription’s serialized price
|
|
443
|
+
* intervals.
|
|
444
|
+
*/
|
|
445
|
+
priceIntervals(subscriptionId, body, options) {
|
|
120
446
|
return this._client.post(`/subscriptions/${subscriptionId}/price_intervals`, { body, ...options });
|
|
121
447
|
}
|
|
122
448
|
/**
|
|
123
|
-
* This endpoint can be used to change
|
|
124
|
-
*
|
|
449
|
+
* This endpoint can be used to change an existing subscription's plan. It returns
|
|
450
|
+
* the serialized updated subscription object.
|
|
125
451
|
*
|
|
126
|
-
* The body parameter `change_option` determines
|
|
452
|
+
* The body parameter `change_option` determines when the plan change occurrs. Orb
|
|
127
453
|
* supports three options:
|
|
128
454
|
*
|
|
129
455
|
* - `end_of_subscription_term`: changes the plan at the end of the existing plan's
|
|
130
456
|
* term.
|
|
131
457
|
* - Issuing this plan change request for a monthly subscription will keep the
|
|
132
|
-
* existing plan active until the start of the subsequent month
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
458
|
+
* existing plan active until the start of the subsequent month. Issuing this
|
|
459
|
+
* plan change request for a yearly subscription will keep the existing plan
|
|
460
|
+
* active for the full year. Charges incurred in the remaining period will be
|
|
461
|
+
* invoiced as normal.
|
|
462
|
+
* - Example: The plan is billed monthly on the 1st of the month, the request is
|
|
463
|
+
* made on January 15th, so the plan will be changed on February 1st, and
|
|
464
|
+
* invoice will be issued on February 1st for the last month of the original
|
|
465
|
+
* plan.
|
|
466
|
+
* - `immediate`: changes the plan immediately.
|
|
467
|
+
* - Subscriptions that have their plan changed with this option will move to the
|
|
468
|
+
* new plan immediately, and be invoiced immediately.
|
|
469
|
+
* - This invoice will include any usage fees incurred in the billing period up
|
|
470
|
+
* to the change, along with any prorated recurring fees for the billing
|
|
471
|
+
* period, if applicable.
|
|
472
|
+
* - Example: The plan is billed monthly on the 1st of the month, the request is
|
|
473
|
+
* made on January 15th, so the plan will be changed on January 15th, and an
|
|
474
|
+
* invoice will be issued for the partial month, from January 1 to January 15,
|
|
475
|
+
* on the original plan.
|
|
476
|
+
* - `requested_date`: changes the plan on the requested date (`change_date`).
|
|
477
|
+
* - If no timezone is provided, the customer's timezone is used. The
|
|
478
|
+
* `change_date` body parameter is required if this option is chosen.
|
|
479
|
+
* - Example: The plan is billed monthly on the 1st of the month, the request is
|
|
480
|
+
* made on January 15th, with a requested `change_date` of February 15th, so
|
|
481
|
+
* the plan will be changed on February 15th, and invoices will be issued on
|
|
482
|
+
* February 1st and February 15th.
|
|
144
483
|
*
|
|
145
484
|
* Note that one of `plan_id` or `external_plan_id` is required in the request body
|
|
146
485
|
* for this operation.
|
|
147
486
|
*
|
|
148
|
-
* ##
|
|
487
|
+
* ## Customize your customer's subscriptions
|
|
488
|
+
*
|
|
489
|
+
* Prices and adjustments in a plan can be added, removed, or replaced on the
|
|
490
|
+
* subscription when you schedule the plan change. This is useful when a customer
|
|
491
|
+
* has prices that differ from the default prices for a specific plan.
|
|
492
|
+
*
|
|
493
|
+
* :::info This feature is only available for accounts that have migrated to
|
|
494
|
+
* Subscription Overrides Version 2. You can find your Subscription Overrides
|
|
495
|
+
* Version at the bottom of your [Plans page](https://app.withorb.com/plans) :::
|
|
496
|
+
*
|
|
497
|
+
* ### Adding Prices
|
|
498
|
+
*
|
|
499
|
+
* To add prices, provide a list of objects with the key `add_prices`. An object in
|
|
500
|
+
* the list must specify an existing add-on price with a `price_id` or
|
|
501
|
+
* `external_price_id` field, or create a new add-on price by including an object
|
|
502
|
+
* with the key `price`, identical to what would be used in the request body for
|
|
503
|
+
* the [create price endpoint](../reference/create-price). See the
|
|
504
|
+
* [Price resource](../reference/price) for the specification of different price
|
|
505
|
+
* model configurations possible in this object.
|
|
506
|
+
*
|
|
507
|
+
* If the plan has phases, each object in the list must include a number with
|
|
508
|
+
* `plan_phase_order` key to indicate which phase the price should be added to.
|
|
509
|
+
*
|
|
510
|
+
* An object in the list can specify an optional `start_date` and optional
|
|
511
|
+
* `end_date`. This is equivalent to creating a price interval with the
|
|
512
|
+
* [add/edit price intervals endpoint](../reference/add-edit-price-intervals). If
|
|
513
|
+
* unspecified, the start or end date of the phase or subscription will be used.
|
|
514
|
+
*
|
|
515
|
+
* An object in the list can specify an optional `minimum_amount`,
|
|
516
|
+
* `maximum_amount`, or `discounts`. This will create adjustments which apply only
|
|
517
|
+
* to this price.
|
|
518
|
+
*
|
|
519
|
+
* Additionally, an object in the list can specify an optional `reference_id`. This
|
|
520
|
+
* ID can be used to reference this price when
|
|
521
|
+
* [adding an adjustment](#adding-adjustments) in the same API call. However the ID
|
|
522
|
+
* is _transient_ and cannot be used to refer to the price in future API calls.
|
|
523
|
+
*
|
|
524
|
+
* ### Removing Prices
|
|
525
|
+
*
|
|
526
|
+
* To remove prices, provide a list of objects with the key `remove_prices`. An
|
|
527
|
+
* object in the list must specify a plan price with either a `price_id` or
|
|
528
|
+
* `external_price_id` field.
|
|
529
|
+
*
|
|
530
|
+
* ### Replacing Prices
|
|
531
|
+
*
|
|
532
|
+
* To replace prices, provide a list of objects with the key `replace_prices`. An
|
|
533
|
+
* object in the list must specify a plan price to replace with the
|
|
534
|
+
* `replaces_price_id` key, and it must specify a price to replace it with by
|
|
535
|
+
* either referencing an existing add-on price with a `price_id` or
|
|
536
|
+
* `external_price_id` field, or by creating a new add-on price by including an
|
|
537
|
+
* object with the key `price`, identical to what would be used in the request body
|
|
538
|
+
* for the [create price endpoint](../reference/create-price). See the
|
|
539
|
+
* [Price resource](../reference/price) for the specification of different price
|
|
540
|
+
* model configurations possible in this object.
|
|
541
|
+
*
|
|
542
|
+
* For fixed fees, an object in the list can supply a `fixed_price_quantity`
|
|
543
|
+
* instead of a `price`, `price_id`, or `external_price_id` field. This will update
|
|
544
|
+
* only the quantity for the price, similar to the
|
|
545
|
+
* [Update price quantity](../reference/update-fixed-fee-quantity) endpoint.
|
|
546
|
+
*
|
|
547
|
+
* The replacement price will have the same phase, if applicable, and the same
|
|
548
|
+
* start and end dates as the price it replaces.
|
|
549
|
+
*
|
|
550
|
+
* An object in the list can specify an optional `minimum_amount`,
|
|
551
|
+
* `maximum_amount`, or `discounts`. This will create adjustments which apply only
|
|
552
|
+
* to this price.
|
|
553
|
+
*
|
|
554
|
+
* Additionally, an object in the list can specify an optional `reference_id`. This
|
|
555
|
+
* ID can be used to reference the replacement price when
|
|
556
|
+
* [adding an adjustment](#adding-adjustments) in the same API call. However the ID
|
|
557
|
+
* is _transient_ and cannot be used to refer to the price in future API calls.
|
|
558
|
+
*
|
|
559
|
+
* ### Adding adjustments
|
|
560
|
+
*
|
|
561
|
+
* To add adjustments, provide a list of objects with the key `add_adjustments`. An
|
|
562
|
+
* object in the list must include an object with the key `adjustment`, identical
|
|
563
|
+
* to the adjustment object in the
|
|
564
|
+
* [add/edit price intervals endpoint](../reference/add-edit-price-intervals).
|
|
565
|
+
*
|
|
566
|
+
* If the plan has phases, each object in the list must include a number with
|
|
567
|
+
* `plan_phase_order` key to indicate which phase the adjustment should be added
|
|
568
|
+
* to.
|
|
569
|
+
*
|
|
570
|
+
* An object in the list can specify an optional `start_date` and optional
|
|
571
|
+
* `end_date`. If unspecified, the start or end date of the phase or subscription
|
|
572
|
+
* will be used.
|
|
573
|
+
*
|
|
574
|
+
* ### Removing adjustments
|
|
575
|
+
*
|
|
576
|
+
* To remove adjustments, provide a list of objects with the key
|
|
577
|
+
* `remove_adjustments`. An object in the list must include a key, `adjustment_id`,
|
|
578
|
+
* with the ID of the adjustment to be removed.
|
|
579
|
+
*
|
|
580
|
+
* ### Replacing adjustments
|
|
581
|
+
*
|
|
582
|
+
* To replace adjustments, provide a list of objects with the key
|
|
583
|
+
* `replace_adjustments`. An object in the list must specify a plan adjustment to
|
|
584
|
+
* replace with the `replaces_adjustment_id` key, and it must specify an adjustment
|
|
585
|
+
* to replace it with by including an object with the key `adjustment`, identical
|
|
586
|
+
* to the adjustment object in the
|
|
587
|
+
* [add/edit price intervals endpoint](../reference/add-edit-price-intervals).
|
|
588
|
+
*
|
|
589
|
+
* The replacement adjustment will have the same phase, if applicable, and the same
|
|
590
|
+
* start and end dates as the adjustment it replaces.
|
|
591
|
+
*
|
|
592
|
+
* ## Price overrides (DEPRECATED)
|
|
593
|
+
*
|
|
594
|
+
* :::info Price overrides are being phased out in favor adding/removing/replacing
|
|
595
|
+
* prices. (See
|
|
596
|
+
* [Customize your customer's subscriptions](../reference/schedule-plan-change#customize-your-customers-subscriptions))
|
|
597
|
+
* :::
|
|
598
|
+
*
|
|
599
|
+
* Price overrides are used to update some or all prices in a plan for the specific
|
|
600
|
+
* subscription being created. This is useful when a new customer has negotiated a
|
|
601
|
+
* rate that is unique to the customer.
|
|
602
|
+
*
|
|
603
|
+
* To override prices, provide a list of objects with the key `price_overrides`.
|
|
604
|
+
* The price object in the list of overrides is expected to contain the existing
|
|
605
|
+
* price id, the `model_type` and configuration. (See the
|
|
606
|
+
* [Price resource](../reference/price) for the specification of different price
|
|
607
|
+
* model configurations.) The numerical values can be updated, but the billable
|
|
608
|
+
* metric, cadence, type, and name of a price can not be overridden.
|
|
609
|
+
*
|
|
610
|
+
* ### Maximums, and minimums
|
|
149
611
|
*
|
|
150
612
|
* Price overrides are used to update some or all prices in the target plan.
|
|
151
613
|
* Minimums and maximums, much like price overrides, can be useful when a new
|
|
152
614
|
* customer has negotiated a new or different minimum or maximum spend cap than the
|
|
153
|
-
* default for the plan. The request format for
|
|
154
|
-
*
|
|
615
|
+
* default for the plan. The request format for maximums and minimums is the same
|
|
616
|
+
* as those in [subscription creation](create-subscription).
|
|
155
617
|
*
|
|
156
618
|
* ## Scheduling multiple plan changes
|
|
157
619
|
*
|
|
@@ -168,10 +630,11 @@ export class Subscriptions extends APIResource {
|
|
|
168
630
|
schedulePlanChange(subscriptionId, body, options) {
|
|
169
631
|
return this._client.post(`/subscriptions/${subscriptionId}/schedule_plan_change`, { body, ...options });
|
|
170
632
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
633
|
+
/**
|
|
634
|
+
* Manually trigger a phase, effective the given date (or the current time, if not
|
|
635
|
+
* specified).
|
|
636
|
+
*/
|
|
637
|
+
triggerPhase(subscriptionId, body, options) {
|
|
175
638
|
return this._client.post(`/subscriptions/${subscriptionId}/trigger_phase`, { body, ...options });
|
|
176
639
|
}
|
|
177
640
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.mjs","sourceRoot":"","sources":["../src/resources/subscriptions.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,EAAE,gBAAgB,EAAE;OAEpB,KAAK,gBAAgB;OAKrB,EAAE,IAAI,EAAmB;AAEhC,MAAM,OAAO,aAAc,SAAQ,WAAW;
|
|
1
|
+
{"version":3,"file":"subscriptions.mjs","sourceRoot":"","sources":["../src/resources/subscriptions.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,EAAE,gBAAgB,EAAE;OAEpB,KAAK,gBAAgB;OAKrB,EAAE,IAAI,EAAmB;AAEhC,MAAM,OAAO,aAAc,SAAQ,WA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;;;OAGG;IACH,4BAA4B,CAC1B,cAAsB,EACtB,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,cAAc,kCAAkC,EAAE,OAAO,CAAC,CAAC;IACxG,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,sBAAsB,CACpB,cAAsB,EACtB,IAA8C,EAC9C,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,cAAc,4BAA4B,EAAE;YACrF,IAAI;YACJ,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,WAAW,CACT,cAAsB,EACtB,IAAmC,EACnC,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,cAAc,eAAe,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClG,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,IAAkB;CAAG;AAE5D,MAAM,OAAO,sCAAuC,SAAQ,IAAuC;CAAG;AAkwctG,WAAiB,aAAa;IAGd,2BAAa,GAAG,gBAAgB,CAAC,aAAa,CAAC;IAG/C,+BAAiB,GAAG,gBAAgB,CAAC,iBAAiB,CAAC;IACvD,oDAAsC,GAAG,gBAAgB,CAAC,sCAAsC,CAAC;AAcjH,CAAC,EArBgB,aAAa,KAAb,aAAa,QAqB7B"}
|
package/src/core.ts
CHANGED
|
@@ -351,9 +351,13 @@ export abstract class APIClient {
|
|
|
351
351
|
delete reqHeaders['content-type'];
|
|
352
352
|
}
|
|
353
353
|
|
|
354
|
-
// Don't set the retry count header if it was already set or removed
|
|
355
|
-
// which can contain nulls, instead of `reqHeaders` to
|
|
356
|
-
|
|
354
|
+
// Don't set the retry count header if it was already set or removed through default headers or by the
|
|
355
|
+
// caller. We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to
|
|
356
|
+
// account for the removal case.
|
|
357
|
+
if (
|
|
358
|
+
getHeader(defaultHeaders, 'x-stainless-retry-count') === undefined &&
|
|
359
|
+
getHeader(headers, 'x-stainless-retry-count') === undefined
|
|
360
|
+
) {
|
|
357
361
|
reqHeaders['x-stainless-retry-count'] = String(retryCount);
|
|
358
362
|
}
|
|
359
363
|
|
|
@@ -42,18 +42,9 @@ export class Customers extends APIResource {
|
|
|
42
42
|
*/
|
|
43
43
|
update(
|
|
44
44
|
customerId: string,
|
|
45
|
-
body
|
|
46
|
-
options?: Core.RequestOptions,
|
|
47
|
-
): Core.APIPromise<Customer>;
|
|
48
|
-
update(customerId: string, options?: Core.RequestOptions): Core.APIPromise<Customer>;
|
|
49
|
-
update(
|
|
50
|
-
customerId: string,
|
|
51
|
-
body: CustomerUpdateParams | Core.RequestOptions = {},
|
|
45
|
+
body: CustomerUpdateParams,
|
|
52
46
|
options?: Core.RequestOptions,
|
|
53
47
|
): Core.APIPromise<Customer> {
|
|
54
|
-
if (isRequestOptions(body)) {
|
|
55
|
-
return this.update(customerId, {}, body);
|
|
56
|
-
}
|
|
57
48
|
return this._client.put(`/customers/${customerId}`, { body, ...options });
|
|
58
49
|
}
|
|
59
50
|
|
|
@@ -131,18 +122,9 @@ export class Customers extends APIResource {
|
|
|
131
122
|
*/
|
|
132
123
|
updateByExternalId(
|
|
133
124
|
id: string,
|
|
134
|
-
body
|
|
135
|
-
options?: Core.RequestOptions,
|
|
136
|
-
): Core.APIPromise<Customer>;
|
|
137
|
-
updateByExternalId(id: string, options?: Core.RequestOptions): Core.APIPromise<Customer>;
|
|
138
|
-
updateByExternalId(
|
|
139
|
-
id: string,
|
|
140
|
-
body: CustomerUpdateByExternalIDParams | Core.RequestOptions = {},
|
|
125
|
+
body: CustomerUpdateByExternalIDParams,
|
|
141
126
|
options?: Core.RequestOptions,
|
|
142
127
|
): Core.APIPromise<Customer> {
|
|
143
|
-
if (isRequestOptions(body)) {
|
|
144
|
-
return this.updateByExternalId(id, {}, body);
|
|
145
|
-
}
|
|
146
128
|
return this._client.put(`/customers/external_customer_id/${id}`, { body, ...options });
|
|
147
129
|
}
|
|
148
130
|
}
|