orb-billing 4.53.0 → 4.55.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 (43) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/core.d.ts.map +1 -1
  3. package/core.js +12 -6
  4. package/core.js.map +1 -1
  5. package/core.mjs +12 -6
  6. package/core.mjs.map +1 -1
  7. package/package.json +1 -1
  8. package/resources/customers/credits/ledger.d.ts +2 -2
  9. package/resources/customers/credits/ledger.d.ts.map +1 -1
  10. package/resources/events/backfills.d.ts +30 -0
  11. package/resources/events/backfills.d.ts.map +1 -1
  12. package/resources/events/backfills.js.map +1 -1
  13. package/resources/events/backfills.mjs.map +1 -1
  14. package/resources/invoice-line-items.d.ts +175 -2
  15. package/resources/invoice-line-items.d.ts.map +1 -1
  16. package/resources/invoices.d.ts +350 -4
  17. package/resources/invoices.d.ts.map +1 -1
  18. package/resources/invoices.js.map +1 -1
  19. package/resources/invoices.mjs.map +1 -1
  20. package/resources/plans/plans.d.ts +213 -25
  21. package/resources/plans/plans.d.ts.map +1 -1
  22. package/resources/plans/plans.js.map +1 -1
  23. package/resources/plans/plans.mjs.map +1 -1
  24. package/resources/prices/prices.d.ts +530 -61
  25. package/resources/prices/prices.d.ts.map +1 -1
  26. package/resources/prices/prices.js.map +1 -1
  27. package/resources/prices/prices.mjs.map +1 -1
  28. package/resources/subscriptions.d.ts +453 -269
  29. package/resources/subscriptions.d.ts.map +1 -1
  30. package/resources/subscriptions.js.map +1 -1
  31. package/resources/subscriptions.mjs.map +1 -1
  32. package/src/core.ts +14 -6
  33. package/src/resources/customers/credits/ledger.ts +2 -2
  34. package/src/resources/events/backfills.ts +35 -0
  35. package/src/resources/invoice-line-items.ts +221 -2
  36. package/src/resources/invoices.ts +442 -4
  37. package/src/resources/plans/plans.ts +259 -31
  38. package/src/resources/prices/prices.ts +752 -88
  39. package/src/resources/subscriptions.ts +569 -345
  40. package/src/version.ts +1 -1
  41. package/version.d.ts +1 -1
  42. package/version.js +1 -1
  43. package/version.mjs +1 -1
@@ -88,11 +88,11 @@ export interface Plan {
88
88
  * across all phases of the plan.
89
89
  */
90
90
  adjustments: Array<
91
- | Plan.AmountDiscountAdjustment
92
- | Plan.PercentageDiscountAdjustment
93
- | Plan.UsageDiscountAdjustment
94
- | Plan.MinimumAdjustment
95
- | Plan.MaximumAdjustment
91
+ | Plan.PlanPhaseUsageDiscountAdjustment
92
+ | Plan.PlanPhaseAmountDiscountAdjustment
93
+ | Plan.PlanPhasePercentageDiscountAdjustment
94
+ | Plan.PlanPhaseMinimumAdjustment
95
+ | Plan.PlanPhaseMaximumAdjustment
96
96
  >;
97
97
 
98
98
  base_plan: Plan.BasePlan | null;
@@ -179,16 +179,10 @@ export interface Plan {
179
179
  }
180
180
 
181
181
  export namespace Plan {
182
- export interface AmountDiscountAdjustment {
182
+ export interface PlanPhaseUsageDiscountAdjustment {
183
183
  id: string;
184
184
 
185
- adjustment_type: 'amount_discount';
186
-
187
- /**
188
- * The amount by which to discount the prices this adjustment applies to in a given
189
- * billing period.
190
- */
191
- amount_discount: string;
185
+ adjustment_type: 'usage_discount';
192
186
 
193
187
  /**
194
188
  * The price IDs that this adjustment applies to.
@@ -210,12 +204,24 @@ export namespace Plan {
210
204
  * The reason for the adjustment.
211
205
  */
212
206
  reason: string | null;
207
+
208
+ /**
209
+ * The number of usage units by which to discount the price this adjustment applies
210
+ * to in a given billing period.
211
+ */
212
+ usage_discount: number;
213
213
  }
214
214
 
215
- export interface PercentageDiscountAdjustment {
215
+ export interface PlanPhaseAmountDiscountAdjustment {
216
216
  id: string;
217
217
 
218
- adjustment_type: 'percentage_discount';
218
+ adjustment_type: 'amount_discount';
219
+
220
+ /**
221
+ * The amount by which to discount the prices this adjustment applies to in a given
222
+ * billing period.
223
+ */
224
+ amount_discount: string;
219
225
 
220
226
  /**
221
227
  * The price IDs that this adjustment applies to.
@@ -228,12 +234,6 @@ export namespace Plan {
228
234
  */
229
235
  is_invoice_level: boolean;
230
236
 
231
- /**
232
- * The percentage (as a value between 0 and 1) by which to discount the price
233
- * intervals this adjustment applies to in a given billing period.
234
- */
235
- percentage_discount: number;
236
-
237
237
  /**
238
238
  * The plan phase in which this adjustment is active.
239
239
  */
@@ -245,10 +245,10 @@ export namespace Plan {
245
245
  reason: string | null;
246
246
  }
247
247
 
248
- export interface UsageDiscountAdjustment {
248
+ export interface PlanPhasePercentageDiscountAdjustment {
249
249
  id: string;
250
250
 
251
- adjustment_type: 'usage_discount';
251
+ adjustment_type: 'percentage_discount';
252
252
 
253
253
  /**
254
254
  * The price IDs that this adjustment applies to.
@@ -261,6 +261,12 @@ export namespace Plan {
261
261
  */
262
262
  is_invoice_level: boolean;
263
263
 
264
+ /**
265
+ * The percentage (as a value between 0 and 1) by which to discount the price
266
+ * intervals this adjustment applies to in a given billing period.
267
+ */
268
+ percentage_discount: number;
269
+
264
270
  /**
265
271
  * The plan phase in which this adjustment is active.
266
272
  */
@@ -270,15 +276,9 @@ export namespace Plan {
270
276
  * The reason for the adjustment.
271
277
  */
272
278
  reason: string | null;
273
-
274
- /**
275
- * The number of usage units by which to discount the price this adjustment applies
276
- * to in a given billing period.
277
- */
278
- usage_discount: number;
279
279
  }
280
280
 
281
- export interface MinimumAdjustment {
281
+ export interface PlanPhaseMinimumAdjustment {
282
282
  id: string;
283
283
 
284
284
  adjustment_type: 'minimum';
@@ -316,7 +316,7 @@ export namespace Plan {
316
316
  reason: string | null;
317
317
  }
318
318
 
319
- export interface MaximumAdjustment {
319
+ export interface PlanPhaseMaximumAdjustment {
320
320
  id: string;
321
321
 
322
322
  adjustment_type: 'maximum';
@@ -498,6 +498,8 @@ export interface PlanCreateParams {
498
498
  | PlanCreateParams.NewPlanBulkWithProrationPrice
499
499
  | PlanCreateParams.NewPlanGroupedTieredPackagePrice
500
500
  | PlanCreateParams.NewPlanMaxGroupTieredPackagePrice
501
+ | PlanCreateParams.NewPlanScalableMatrixWithUnitPricingPrice
502
+ | PlanCreateParams.NewPlanScalableMatrixWithTieredPricingPrice
501
503
  >;
502
504
 
503
505
  /**
@@ -3185,6 +3187,232 @@ export namespace PlanCreateParams {
3185
3187
  duration_unit: 'day' | 'month';
3186
3188
  }
3187
3189
  }
3190
+
3191
+ export interface NewPlanScalableMatrixWithUnitPricingPrice {
3192
+ /**
3193
+ * The cadence to bill for this price on.
3194
+ */
3195
+ cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time' | 'custom';
3196
+
3197
+ /**
3198
+ * The id of the item the plan will be associated with.
3199
+ */
3200
+ item_id: string;
3201
+
3202
+ model_type: 'scalable_matrix_with_unit_pricing';
3203
+
3204
+ /**
3205
+ * The name of the price.
3206
+ */
3207
+ name: string;
3208
+
3209
+ scalable_matrix_with_unit_pricing_config: Record<string, unknown>;
3210
+
3211
+ /**
3212
+ * The id of the billable metric for the price. Only needed if the price is
3213
+ * usage-based.
3214
+ */
3215
+ billable_metric_id?: string | null;
3216
+
3217
+ /**
3218
+ * If the Price represents a fixed cost, the price will be billed in-advance if
3219
+ * this is true, and in-arrears if this is false.
3220
+ */
3221
+ billed_in_advance?: boolean | null;
3222
+
3223
+ /**
3224
+ * For custom cadence: specifies the duration of the billing period in days or
3225
+ * months.
3226
+ */
3227
+ billing_cycle_configuration?: NewPlanScalableMatrixWithUnitPricingPrice.BillingCycleConfiguration | null;
3228
+
3229
+ /**
3230
+ * The per unit conversion rate of the price currency to the invoicing currency.
3231
+ */
3232
+ conversion_rate?: number | null;
3233
+
3234
+ /**
3235
+ * An ISO 4217 currency string, or custom pricing unit identifier, in which this
3236
+ * price is billed.
3237
+ */
3238
+ currency?: string | null;
3239
+
3240
+ /**
3241
+ * An alias for the price.
3242
+ */
3243
+ external_price_id?: string | null;
3244
+
3245
+ /**
3246
+ * If the Price represents a fixed cost, this represents the quantity of units
3247
+ * applied.
3248
+ */
3249
+ fixed_price_quantity?: number | null;
3250
+
3251
+ /**
3252
+ * The property used to group this price on an invoice
3253
+ */
3254
+ invoice_grouping_key?: string | null;
3255
+
3256
+ /**
3257
+ * Within each billing cycle, specifies the cadence at which invoices are produced.
3258
+ * If unspecified, a single invoice is produced per billing cycle.
3259
+ */
3260
+ invoicing_cycle_configuration?: NewPlanScalableMatrixWithUnitPricingPrice.InvoicingCycleConfiguration | null;
3261
+
3262
+ /**
3263
+ * User-specified key/value pairs for the resource. Individual keys can be removed
3264
+ * by setting the value to `null`, and the entire metadata mapping can be cleared
3265
+ * by setting `metadata` to `null`.
3266
+ */
3267
+ metadata?: Record<string, string | null> | null;
3268
+ }
3269
+
3270
+ export namespace NewPlanScalableMatrixWithUnitPricingPrice {
3271
+ /**
3272
+ * For custom cadence: specifies the duration of the billing period in days or
3273
+ * months.
3274
+ */
3275
+ export interface BillingCycleConfiguration {
3276
+ /**
3277
+ * The duration of the billing period.
3278
+ */
3279
+ duration: number;
3280
+
3281
+ /**
3282
+ * The unit of billing period duration.
3283
+ */
3284
+ duration_unit: 'day' | 'month';
3285
+ }
3286
+
3287
+ /**
3288
+ * Within each billing cycle, specifies the cadence at which invoices are produced.
3289
+ * If unspecified, a single invoice is produced per billing cycle.
3290
+ */
3291
+ export interface InvoicingCycleConfiguration {
3292
+ /**
3293
+ * The duration of the billing period.
3294
+ */
3295
+ duration: number;
3296
+
3297
+ /**
3298
+ * The unit of billing period duration.
3299
+ */
3300
+ duration_unit: 'day' | 'month';
3301
+ }
3302
+ }
3303
+
3304
+ export interface NewPlanScalableMatrixWithTieredPricingPrice {
3305
+ /**
3306
+ * The cadence to bill for this price on.
3307
+ */
3308
+ cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time' | 'custom';
3309
+
3310
+ /**
3311
+ * The id of the item the plan will be associated with.
3312
+ */
3313
+ item_id: string;
3314
+
3315
+ model_type: 'scalable_matrix_with_tiered_pricing';
3316
+
3317
+ /**
3318
+ * The name of the price.
3319
+ */
3320
+ name: string;
3321
+
3322
+ scalable_matrix_with_tiered_pricing_config: Record<string, unknown>;
3323
+
3324
+ /**
3325
+ * The id of the billable metric for the price. Only needed if the price is
3326
+ * usage-based.
3327
+ */
3328
+ billable_metric_id?: string | null;
3329
+
3330
+ /**
3331
+ * If the Price represents a fixed cost, the price will be billed in-advance if
3332
+ * this is true, and in-arrears if this is false.
3333
+ */
3334
+ billed_in_advance?: boolean | null;
3335
+
3336
+ /**
3337
+ * For custom cadence: specifies the duration of the billing period in days or
3338
+ * months.
3339
+ */
3340
+ billing_cycle_configuration?: NewPlanScalableMatrixWithTieredPricingPrice.BillingCycleConfiguration | null;
3341
+
3342
+ /**
3343
+ * The per unit conversion rate of the price currency to the invoicing currency.
3344
+ */
3345
+ conversion_rate?: number | null;
3346
+
3347
+ /**
3348
+ * An ISO 4217 currency string, or custom pricing unit identifier, in which this
3349
+ * price is billed.
3350
+ */
3351
+ currency?: string | null;
3352
+
3353
+ /**
3354
+ * An alias for the price.
3355
+ */
3356
+ external_price_id?: string | null;
3357
+
3358
+ /**
3359
+ * If the Price represents a fixed cost, this represents the quantity of units
3360
+ * applied.
3361
+ */
3362
+ fixed_price_quantity?: number | null;
3363
+
3364
+ /**
3365
+ * The property used to group this price on an invoice
3366
+ */
3367
+ invoice_grouping_key?: string | null;
3368
+
3369
+ /**
3370
+ * Within each billing cycle, specifies the cadence at which invoices are produced.
3371
+ * If unspecified, a single invoice is produced per billing cycle.
3372
+ */
3373
+ invoicing_cycle_configuration?: NewPlanScalableMatrixWithTieredPricingPrice.InvoicingCycleConfiguration | null;
3374
+
3375
+ /**
3376
+ * User-specified key/value pairs for the resource. Individual keys can be removed
3377
+ * by setting the value to `null`, and the entire metadata mapping can be cleared
3378
+ * by setting `metadata` to `null`.
3379
+ */
3380
+ metadata?: Record<string, string | null> | null;
3381
+ }
3382
+
3383
+ export namespace NewPlanScalableMatrixWithTieredPricingPrice {
3384
+ /**
3385
+ * For custom cadence: specifies the duration of the billing period in days or
3386
+ * months.
3387
+ */
3388
+ export interface BillingCycleConfiguration {
3389
+ /**
3390
+ * The duration of the billing period.
3391
+ */
3392
+ duration: number;
3393
+
3394
+ /**
3395
+ * The unit of billing period duration.
3396
+ */
3397
+ duration_unit: 'day' | 'month';
3398
+ }
3399
+
3400
+ /**
3401
+ * Within each billing cycle, specifies the cadence at which invoices are produced.
3402
+ * If unspecified, a single invoice is produced per billing cycle.
3403
+ */
3404
+ export interface InvoicingCycleConfiguration {
3405
+ /**
3406
+ * The duration of the billing period.
3407
+ */
3408
+ duration: number;
3409
+
3410
+ /**
3411
+ * The unit of billing period duration.
3412
+ */
3413
+ duration_unit: 'day' | 'month';
3414
+ }
3415
+ }
3188
3416
  }
3189
3417
 
3190
3418
  export interface PlanUpdateParams {