lago-javascript-client 1.33.0 → 1.33.3

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.
@@ -1407,13 +1407,13 @@ export interface FeaturePrivilegeObject {
1407
1407
  * Display name for the privilege.
1408
1408
  * @example "Maximum"
1409
1409
  */
1410
- name?: string | null;
1410
+ name: string | null;
1411
1411
  /**
1412
1412
  * Data type of the privilege value. Default: string
1413
1413
  * @example "integer"
1414
1414
  */
1415
- value_type?: "integer" | "boolean" | "string" | "select";
1416
- config?: {
1415
+ value_type: "integer" | "boolean" | "string" | "select";
1416
+ config: {
1417
1417
  /**
1418
1418
  * Array of string, required only when value_type is `select`.
1419
1419
  * @example ["google","okta"]
@@ -1431,17 +1431,17 @@ export interface FeatureObject {
1431
1431
  * Name of the feature. Max 255 characters.
1432
1432
  * @example "Number of seats"
1433
1433
  */
1434
- name?: string | null;
1434
+ name: string | null;
1435
1435
  /**
1436
1436
  * Description of the feature. Max 600 characters.
1437
1437
  * @example "Number of users of the account"
1438
1438
  */
1439
- description?: string | null;
1439
+ description: string | null;
1440
1440
  /**
1441
1441
  * Privileges associated with this feature. Can be empty.
1442
- * @example [{"code":"max","name":"Maximum","value_type":"integer"},{"code":"max_admins","name":"Max Admins","value_type":"integer"},{"code":"root","name":"Allow root user","value_type":"boolean"},{"code":"provider","name":"SSO Provider","value_type":"select","config":{"select_options":["google","okta"]}}]
1442
+ * @example [{"code":"max","name":"Maximum","value_type":"integer","config":{}},{"code":"max_admins","name":"Max Admins","value_type":"integer","config":{}},{"code":"root","name":"Allow root user","value_type":"boolean","config":{}},{"code":"provider","name":"SSO Provider","value_type":"select","config":{"select_options":["google","okta"]}}]
1443
1443
  */
1444
- privileges?: FeaturePrivilegeObject[];
1444
+ privileges: FeaturePrivilegeObject[];
1445
1445
  /**
1446
1446
  * Creation date of the feature.
1447
1447
  * @format date-time
@@ -1453,12 +1453,7 @@ export interface FeaturesPaginated {
1453
1453
  features: FeatureObject[];
1454
1454
  meta: PaginationMeta;
1455
1455
  }
1456
- export interface FeatureCreateInput {
1457
- /**
1458
- * Unique code used to identify the feature.
1459
- * @example "seats"
1460
- */
1461
- code: string;
1456
+ export interface FeatureBaseInput {
1462
1457
  /**
1463
1458
  * Name of the feature.
1464
1459
  * @example "Number of seats"
@@ -1498,48 +1493,20 @@ export interface FeatureCreateInput {
1498
1493
  };
1499
1494
  }[];
1500
1495
  }
1496
+ export interface FeatureCreateInput {
1497
+ feature: FeatureBaseInput & {
1498
+ /**
1499
+ * Unique code used to identify the feature.
1500
+ * @example "seats"
1501
+ */
1502
+ code: string;
1503
+ };
1504
+ }
1501
1505
  export interface Feature {
1502
1506
  feature: FeatureObject;
1503
1507
  }
1504
1508
  export interface FeatureUpdateInput {
1505
- /**
1506
- * Name of the feature.
1507
- * @example "Number of seats"
1508
- */
1509
- name?: string | null;
1510
- /**
1511
- * Description of the feature.
1512
- * @example "Number of users of the account"
1513
- */
1514
- description?: string | null;
1515
- /**
1516
- * Existing privilege names can be updated or new privilege created.
1517
- * @example [{"code":"max","name":"Maximum"},{"code":"new_extra","name":"Extra","value_type":"string"},{"code":"providers","value_type":"select","config":{"select_options":["ms"]}}]
1518
- */
1519
- privileges?: {
1520
- /**
1521
- * Code of the privilege to update or create.
1522
- * @example "max"
1523
- */
1524
- code?: string;
1525
- /**
1526
- * Display name for the privilege.
1527
- * @example "Maximum"
1528
- */
1529
- name?: string;
1530
- /**
1531
- * Data type of the privilege value. Value_type cannot be modified for existing privilege but can be set for new privileges.
1532
- * @example "integer"
1533
- */
1534
- value_type?: "integer" | "boolean" | "string" | "select";
1535
- config?: {
1536
- /**
1537
- * Array of new string to add to existing options. Options cannot be deleted. Only used only when value_type is `select`.
1538
- * @example ["ms"]
1539
- */
1540
- select_options?: string[];
1541
- };
1542
- }[];
1509
+ feature: FeatureBaseInput;
1543
1510
  }
1544
1511
  export interface CouponObject {
1545
1512
  /**
@@ -2227,17 +2194,35 @@ export interface FeeObject {
2227
2194
  */
2228
2195
  code: string;
2229
2196
  /**
2230
- * The name of the fee item. It can be the name of the `add-on`, the `charge`, the `credit`, the `subscription` or the `commitment`.
2197
+ * The name of the fee item. The value depends on the type of the fee item:
2198
+ *
2199
+ * - If the fee item is a `charge`, it is the billable metric name.
2200
+ * - If the fee item is a `add-on`, it is the add-on name.
2201
+ * - If the fee item is a `credit`, it is the wallet transaction name if set, or `"credit"` if not.
2202
+ * - If the fee item is a `fixed_charge`, it is the fixed charge add-on name.
2203
+ * - For all the other fee items, it is the subscription plan name.
2231
2204
  * @example "Startup"
2232
2205
  */
2233
2206
  name: string;
2234
2207
  /**
2235
- * The description of the fee item. It can be the description of the `add-on`, the `charge`, the `credit`, the `subscription` or the `commitment`.
2208
+ * The description of the fee item. The value depends on the type of the fee item:
2209
+ *
2210
+ * - If the fee item is a `charge`, it is the billable metric description.
2211
+ * - If the fee item is a `add-on`, it is the add-on description.
2212
+ * - If the fee item is a `credit`, it is always `"credit"`.
2213
+ * - If the fee item is a `fixed_charge`, it is the fixed charge add-on description.
2214
+ * - For all the other fee items, it is the subscription plan description.
2236
2215
  * @example "Startup"
2237
2216
  */
2238
2217
  description?: string | null;
2239
2218
  /**
2240
- * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
2219
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, we'll fallback to a value that depends on the type of the fee items:
2220
+ *
2221
+ * - If the fee item is a `charge`, we'll fallback to the `invoice_display_name` of the `charge` or the billable metric name if no `invoice_display_name` is set.
2222
+ * - If the fee item is a `add-on`, we'll fallback to the `invoice_name` of the `add-on` or the `name` of the `add-on`.
2223
+ * - If the fee item is a `credit`, we'll fallback to the wallet transaction name if set, or `credit` if not.
2224
+ * - If the fee item is a `fixed_charge`, we'll fallback to the `invoice_display_name` of the `fixed_charge` or the `invoice_name` of the `fixed_charge_add_on` if no `invoice_display_name` is set.
2225
+ * - For all the other fee items, we'll fallback to the `invoice_display_name` of the subscription plan.
2241
2226
  * @example "Setup Fee (SF1)"
2242
2227
  */
2243
2228
  invoice_display_name?: string;
@@ -2476,18 +2461,18 @@ export interface CreditNoteCreateInput {
2476
2461
  */
2477
2462
  description?: string;
2478
2463
  /**
2479
- * The total amount to be credited on the customer balance.
2480
- * @example 10
2464
+ * The total amount to be credited to the customer balance for discounts on future invoices. For a total or partial refund or credit, the amount in cents must include both the item amount and the applicable tax. The refunded and credited amounts should always balance. The total, including taxes, cannot exceed the invoice’s total fees.”
2465
+ * @example 100
2481
2466
  */
2482
2467
  credit_amount_cents?: number | null;
2483
2468
  /**
2484
- * The total amount to be refunded to the customer.
2485
- * @example 5
2469
+ * The total amount to be refunded immediately to the payment method used by the customer. For a total or partial refund or credit, the amount in cents must include both the item amount and the applicable tax. The refunded and credited amounts should always balance. The total, including taxes, cannot exceed the invoice’s total fees.”
2470
+ * @example 500
2486
2471
  */
2487
2472
  refund_amount_cents?: number | null;
2488
2473
  /**
2489
2474
  * The list of credit note's items.
2490
- * @example [{"fee_id":"1a901a90-1a90-1a90-1a90-1a901a901a90","amount_cents":10},{"fee_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","amount_cents":5}]
2475
+ * @example [{"fee_id":"1a901a90-1a90-1a90-1a90-1a901a901a90","amount_cents":100},{"fee_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","amount_cents":500}]
2491
2476
  */
2492
2477
  items: {
2493
2478
  /**
@@ -2497,8 +2482,8 @@ export interface CreditNoteCreateInput {
2497
2482
  */
2498
2483
  fee_id: string;
2499
2484
  /**
2500
- * The amount of the credit note item, expressed in cents.
2501
- * @example 10
2485
+ * This is the amount of the credit note item excluding taxes, expressed in cents.
2486
+ * @example 100
2502
2487
  */
2503
2488
  amount_cents: number;
2504
2489
  }[];
@@ -4266,7 +4251,7 @@ export interface SubscriptionObject {
4266
4251
  * The display name of the subscription on an invoice. This field allows for customization of the subscription's name for billing purposes, especially useful when a single customer has multiple subscriptions using the same plan.
4267
4252
  * @example "Repository A"
4268
4253
  */
4269
- name?: string | null;
4254
+ name: string | null;
4270
4255
  /**
4271
4256
  * The unique code representing the plan to be attached to the customer. This code must correspond to the `code` property of one of the active plans.
4272
4257
  * @example "premium"
@@ -4274,13 +4259,13 @@ export interface SubscriptionObject {
4274
4259
  plan_code: string;
4275
4260
  /**
4276
4261
  * The status of the subscription, which can have the following values:
4277
- * - `pending`: a previous subscription has been downgraded, and the current one is awaiting automatic activation at the end of the billing period.
4278
4262
  * - `active`: the subscription is currently active and applied to the customer.
4279
- * - `terminated`: the subscription is no longer active.
4280
4263
  * - `canceled`: the subscription has been stopped before its activation. This can occur when two consecutive downgrades have been applied to a customer or when a subscription with a pending status is terminated.
4264
+ * - `pending`: a previous subscription has been downgraded, and the current one is awaiting automatic activation at the end of the billing period.
4265
+ * - `terminated`: the subscription is no longer active.
4281
4266
  * @example "active"
4282
4267
  */
4283
- status: "active" | "pending" | "terminated" | "canceled";
4268
+ status: "active" | "canceled" | "pending" | "terminated";
4284
4269
  /**
4285
4270
  * The creation date of the subscription, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC). This date provides a timestamp indicating when the subscription was initially created.
4286
4271
  * @format date-time
@@ -4292,19 +4277,19 @@ export interface SubscriptionObject {
4292
4277
  * @format date-time
4293
4278
  * @example "2022-09-14T16:35:31Z"
4294
4279
  */
4295
- canceled_at?: string | null;
4280
+ canceled_at: string | null;
4296
4281
  /**
4297
4282
  * The effective start date of the subscription. This field can be null if the subscription is `pending` or `canceled`. This date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
4298
4283
  * @format date-time
4299
4284
  * @example "2022-08-08T00:00:00Z"
4300
4285
  */
4301
- started_at?: string | null;
4286
+ started_at: string | null;
4302
4287
  /**
4303
4288
  * The effective end date of the subscription. If this field is set to null, the subscription will automatically renew. This date should be provided in ISO 8601 datetime format, and use Coordinated Universal Time (UTC).
4304
4289
  * @format date-time
4305
4290
  * @example "2022-10-08T00:00:00Z"
4306
4291
  */
4307
- ending_at?: string | null;
4292
+ ending_at: string | null;
4308
4293
  /**
4309
4294
  * The anniversary date and time of the initial subscription. This date serves as the basis for billing subscriptions with `anniversary` billing time. The `anniversary_date` should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
4310
4295
  * @format date-time
@@ -4316,41 +4301,41 @@ export interface SubscriptionObject {
4316
4301
  * @format date-time
4317
4302
  * @example "2022-09-14T16:35:31Z"
4318
4303
  */
4319
- terminated_at?: string | null;
4304
+ terminated_at: string | null;
4320
4305
  /**
4321
4306
  * The code identifying the previous plan associated with this subscription.
4322
4307
  * @example null
4323
4308
  */
4324
- previous_plan_code?: string | null;
4309
+ previous_plan_code: string | null;
4325
4310
  /**
4326
4311
  * The code identifying the next plan in the case of a downgrade.
4327
4312
  * @example null
4328
4313
  */
4329
- next_plan_code?: string | null;
4314
+ next_plan_code: string | null;
4330
4315
  /**
4331
4316
  * The date when the plan will be downgraded, represented in ISO 8601 date format.
4332
4317
  * @format date
4333
4318
  * @example "2022-04-30"
4334
4319
  */
4335
- downgrade_plan_date?: string | null;
4320
+ downgrade_plan_date: string | null;
4336
4321
  /**
4337
4322
  * The date when the free trial is ended, represented in ISO 8601 date format.
4338
4323
  * @format date-time
4339
4324
  * @example "2022-08-08T00:00:00Z"
4340
4325
  */
4341
- trial_ended_at?: string | null;
4326
+ trial_ended_at: string | null;
4342
4327
  /**
4343
4328
  * The date and time when the current billing period started, represented in ISO 8601 date format.
4344
4329
  * @format date-time
4345
4330
  * @example "2022-08-08T00:00:00Z"
4346
4331
  */
4347
- current_billing_period_started_at?: string | null;
4332
+ current_billing_period_started_at: string | null;
4348
4333
  /**
4349
4334
  * The date and time when the current billing period ends, represented in ISO 8601 date format.
4350
4335
  * @format date-time
4351
4336
  * @example "2022-09-08T00:00:00Z"
4352
4337
  */
4353
- current_billing_period_ending_at?: string | null;
4338
+ current_billing_period_ending_at: string | null;
4354
4339
  /**
4355
4340
  * When a pay-in-advance subscription is terminated before the end of its billing period, we generate a credit note for the unused subscription time by default.
4356
4341
  * This field allows you to control the behavior of the credit note generation:
@@ -5134,6 +5119,17 @@ export interface MinimumCommitmentObject {
5134
5119
  /** All taxes applied to the minimum commitment. */
5135
5120
  taxes?: TaxObject[];
5136
5121
  }
5122
+ /**
5123
+ * Specifies the pricing model used for the calculation of the final fee. It can be any of the following values:
5124
+ * - [`dynamic`](https://docs.getlago.com/guide/plans/charges/charge-models/dynamic)
5125
+ * - [`graduated_percentage`](https://docs.getlago.com/guide/plans/charges/charge-models/graduated-percentage)
5126
+ * - [`graduated`](https://docs.getlago.com/guide/plans/charges/charge-models/graduated)
5127
+ * - [`package`](https://docs.getlago.com/guide/plans/charges/charge-models/package)
5128
+ * - [`percentage`](https://docs.getlago.com/guide/plans/charges/charge-models/percentage)
5129
+ * - [`standard`](https://docs.getlago.com/guide/plans/charges/charge-models/standard)
5130
+ * - [`volume`](https://docs.getlago.com/guide/plans/charges/charge-models/volume)
5131
+ */
5132
+ export type ChargeModelEnum = "dynamic" | "graduated" | "graduated_percentage" | "package" | "percentage" | "standard" | "volume";
5137
5133
  export interface ChargeProperties {
5138
5134
  /**
5139
5135
  * The list of event properties that are used to group the events on the invoice for a `standard` charge model.
@@ -5325,8 +5321,17 @@ export interface ChargeObject {
5325
5321
  * @example "2022-09-14T16:35:31Z"
5326
5322
  */
5327
5323
  created_at: string;
5328
- /** Specifies the pricing model used for the calculation of the final fee. It can be `standard`, `graduated`, `graduated_percentage`, `package`, `percentage`, `volume` or `dynamic`. */
5329
- charge_model: "standard" | "graduated" | "graduated_percentage" | "package" | "percentage" | "volume" | "dynamic";
5324
+ /**
5325
+ * Specifies the pricing model used for the calculation of the final fee. It can be any of the following values:
5326
+ * - [`dynamic`](https://docs.getlago.com/guide/plans/charges/charge-models/dynamic)
5327
+ * - [`graduated_percentage`](https://docs.getlago.com/guide/plans/charges/charge-models/graduated-percentage)
5328
+ * - [`graduated`](https://docs.getlago.com/guide/plans/charges/charge-models/graduated)
5329
+ * - [`package`](https://docs.getlago.com/guide/plans/charges/charge-models/package)
5330
+ * - [`percentage`](https://docs.getlago.com/guide/plans/charges/charge-models/percentage)
5331
+ * - [`standard`](https://docs.getlago.com/guide/plans/charges/charge-models/standard)
5332
+ * - [`volume`](https://docs.getlago.com/guide/plans/charges/charge-models/volume)
5333
+ */
5334
+ charge_model: ChargeModelEnum;
5330
5335
  /**
5331
5336
  * This field determines the billing timing for this specific usage-based charge. When set to `true`, the charge is due and invoiced immediately. Conversely, when set to `false`, the charge is due and invoiced at the end of each billing period.
5332
5337
  * @example true
@@ -5405,7 +5410,7 @@ export interface PlanEntitlementObject {
5405
5410
  description: string | null;
5406
5411
  /**
5407
5412
  * Privileges associated with this feature. Each privilege must have a value assigned.
5408
- * @example [{"code":"max","name":"Maximum","value_type":"integer","value":10},{"code":"max_admins","name":"Max Admins","value_type":"integer","value":5},{"code":"root","name":"Allow root user","value_type":"boolean","value":true},{"code":"provider","name":"SSO Provider","value_type":"select","value":"google","config":{"select_options":["google","okta"]}}]
5413
+ * @example [{"code":"max","name":"Maximum","value_type":"integer","config":{},"value":10},{"code":"max_admins","name":"Max Admins","value_type":"integer","config":{},"value":5},{"code":"root","name":"Allow root user","value_type":"boolean","config":{},"value":true},{"code":"provider","name":"SSO Provider","value_type":"select","value":"google","config":{"select_options":["google","okta"]}}]
5409
5414
  */
5410
5415
  privileges: PlanEntitlementPrivilegeObject[];
5411
5416
  }
@@ -5523,12 +5528,6 @@ export interface ChargeFilterInput {
5523
5528
  values: Record<string, string[]>;
5524
5529
  }
5525
5530
  export interface UsageThresholdInput {
5526
- /**
5527
- * Unique identifier of the usage threshold created by Lago.
5528
- * @format uuid
5529
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
5530
- */
5531
- id?: string | null;
5532
5531
  /**
5533
5532
  * The display name of the usage threshold.
5534
5533
  * @example "Threshold 1"
@@ -5541,9 +5540,10 @@ export interface UsageThresholdInput {
5541
5540
  amount_cents: number;
5542
5541
  /**
5543
5542
  * This field when set to `true` indicates that a `progressive_billing` invoice will be created every time the lifetime usage increases by the specified amount.
5543
+ * @default false
5544
5544
  * @example true
5545
5545
  */
5546
- recurring: boolean;
5546
+ recurring?: boolean;
5547
5547
  }
5548
5548
  export interface PlanCreateInput {
5549
5549
  plan: {
@@ -5613,10 +5613,16 @@ export interface PlanCreateInput {
5613
5613
  */
5614
5614
  billable_metric_id?: string;
5615
5615
  /**
5616
- * Specifies the pricing model used for the calculation of the final fee. It can be `standard`, `graduated`, `graduated_percentage` `package`, `percentage`, `volume` or `dynamic`.
5617
- * @example "standard"
5616
+ * Specifies the pricing model used for the calculation of the final fee. It can be any of the following values:
5617
+ * - [`dynamic`](https://docs.getlago.com/guide/plans/charges/charge-models/dynamic)
5618
+ * - [`graduated_percentage`](https://docs.getlago.com/guide/plans/charges/charge-models/graduated-percentage)
5619
+ * - [`graduated`](https://docs.getlago.com/guide/plans/charges/charge-models/graduated)
5620
+ * - [`package`](https://docs.getlago.com/guide/plans/charges/charge-models/package)
5621
+ * - [`percentage`](https://docs.getlago.com/guide/plans/charges/charge-models/percentage)
5622
+ * - [`standard`](https://docs.getlago.com/guide/plans/charges/charge-models/standard)
5623
+ * - [`volume`](https://docs.getlago.com/guide/plans/charges/charge-models/volume)
5618
5624
  */
5619
- charge_model?: "standard" | "graduated" | "graduated_percentage" | "package" | "percentage" | "volume" | "dynamic";
5625
+ charge_model?: ChargeModelEnum;
5620
5626
  /**
5621
5627
  * This field determines the billing timing for this specific usage-based charge. When set to `true`, the charge is due and invoiced immediately. Conversely, when set to false, the charge is due and invoiced at the end of each billing period.
5622
5628
  * @example false
@@ -5758,10 +5764,16 @@ export interface PlanUpdateInput {
5758
5764
  */
5759
5765
  billable_metric_id?: string;
5760
5766
  /**
5761
- * Specifies the pricing model used for the calculation of the final fee. It can be `standard`, `graduated`, `graduated_percentage`, `package`, `percentage`, `volume` or `dynamic`.
5762
- * @example "standard"
5767
+ * Specifies the pricing model used for the calculation of the final fee. It can be any of the following values:
5768
+ * - [`dynamic`](https://docs.getlago.com/guide/plans/charges/charge-models/dynamic)
5769
+ * - [`graduated_percentage`](https://docs.getlago.com/guide/plans/charges/charge-models/graduated-percentage)
5770
+ * - [`graduated`](https://docs.getlago.com/guide/plans/charges/charge-models/graduated)
5771
+ * - [`package`](https://docs.getlago.com/guide/plans/charges/charge-models/package)
5772
+ * - [`percentage`](https://docs.getlago.com/guide/plans/charges/charge-models/percentage)
5773
+ * - [`standard`](https://docs.getlago.com/guide/plans/charges/charge-models/standard)
5774
+ * - [`volume`](https://docs.getlago.com/guide/plans/charges/charge-models/volume)
5763
5775
  */
5764
- charge_model?: "standard" | "graduated" | "graduated_percentage" | "package" | "percentage" | "volume" | "dynamic";
5776
+ charge_model?: ChargeModelEnum;
5765
5777
  /**
5766
5778
  * This field determines the billing timing for this specific usage-based charge. When set to `true`, the charge is due and invoiced immediately. Conversely, when set to false, the charge is due and invoiced at the end of each billing period.
5767
5779
  * @example false
@@ -5829,11 +5841,13 @@ export interface PlanUpdateInput {
5829
5841
  export interface PlanEntitlements {
5830
5842
  entitlements: PlanEntitlementObject[];
5831
5843
  }
5832
- /**
5833
- * Feature entitlements with their privilege values. Each key is a feature code, and the value is an object containing privilege codes with their associated values.
5834
- * @example {"seats":{"max":20,"max_admins":10,"root":false},"sso":{"provider":"okta"}}
5835
- */
5836
- export type EntitlementUpdateInput = Record<string, Record<string, number | boolean | string>>;
5844
+ export interface EntitlementUpdateInput {
5845
+ /**
5846
+ * Feature entitlements with their privilege values. Each key is a feature code, and the value is an object containing privilege codes with their associated values.
5847
+ * @example {"seats":{"max":20,"max_admins":10,"root":false},"sso":{"provider":"okta"}}
5848
+ */
5849
+ entitlements: Record<string, Record<string, number | boolean | string>>;
5850
+ }
5837
5851
  export interface SubscriptionsPaginated {
5838
5852
  subscriptions: SubscriptionObject[];
5839
5853
  meta: PaginationMeta;
@@ -5872,7 +5886,8 @@ export interface PlanOverridesObject {
5872
5886
  * @example 5
5873
5887
  */
5874
5888
  trial_period?: number;
5875
- minimum_commitment?: MinimumCommitmentObject;
5889
+ /** Minimum commitment for this plan. */
5890
+ minimum_commitment?: MinimumCommitmentInput;
5876
5891
  /** Additional usage-based charges for this plan. */
5877
5892
  charges?: {
5878
5893
  /**
@@ -5887,6 +5902,17 @@ export interface PlanOverridesObject {
5887
5902
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
5888
5903
  */
5889
5904
  billable_metric_id?: string;
5905
+ /**
5906
+ * Specifies the pricing model used for the calculation of the final fee. It can be any of the following values:
5907
+ * - [`dynamic`](https://docs.getlago.com/guide/plans/charges/charge-models/dynamic)
5908
+ * - [`graduated_percentage`](https://docs.getlago.com/guide/plans/charges/charge-models/graduated-percentage)
5909
+ * - [`graduated`](https://docs.getlago.com/guide/plans/charges/charge-models/graduated)
5910
+ * - [`package`](https://docs.getlago.com/guide/plans/charges/charge-models/package)
5911
+ * - [`percentage`](https://docs.getlago.com/guide/plans/charges/charge-models/percentage)
5912
+ * - [`standard`](https://docs.getlago.com/guide/plans/charges/charge-models/standard)
5913
+ * - [`volume`](https://docs.getlago.com/guide/plans/charges/charge-models/volume)
5914
+ */
5915
+ charge_model?: ChargeModelEnum;
5890
5916
  /**
5891
5917
  * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
5892
5918
  * @example "Setup"
@@ -5915,10 +5941,36 @@ export interface PlanOverridesObject {
5915
5941
  };
5916
5942
  }[];
5917
5943
  /** List of usage thresholds applied to the subscription. */
5918
- usage_thresholds?: UsageThresholdObject[];
5944
+ usage_thresholds?: UsageThresholdInput[];
5919
5945
  }
5920
5946
  export interface SubscriptionCreateInput {
5921
5947
  subscription: {
5948
+ /**
5949
+ * Optionally, you can create a pre-authorization on the customer's card before creating a subscription. This process places a temporary hold (capture) for a specified amount on the customer's account, but does not actually withdraw the funds.
5950
+ *
5951
+ * Important notes:
5952
+ * - The final amount due for the subscription is not known at the time of creation; it is determined only after the invoice is finalized.
5953
+ * - The payment intent generated for pre-authorization cannot be reused, as the final invoice amount may exceed the authorized amount.
5954
+ * - The payment intent is canceled immediately after creation, but this cancellation occurs asynchronously.
5955
+ * - For these reasons, it is recommended to use a small amount (such as $1) for pre-authorization. While this does not guarantee sufficient funds for the final payment, it helps reduce the likelihood of payment errors.
5956
+ */
5957
+ authorization?: {
5958
+ /**
5959
+ * The amount of the authorization in cents.
5960
+ * @example 1000
5961
+ */
5962
+ amount_cents: number;
5963
+ /**
5964
+ * The currency of the authorization.
5965
+ * @example "USD"
5966
+ */
5967
+ amount_currency: string;
5968
+ };
5969
+ /**
5970
+ * The code of the billing entity to be used for the subscription. If not provided, the default billing entity will be used.
5971
+ * @example "default"
5972
+ */
5973
+ billing_entity_code?: string;
5922
5974
  /**
5923
5975
  * The customer external unique identifier (provided by your own application)
5924
5976
  * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
@@ -6050,7 +6102,7 @@ export interface LifetimeUsageObject {
6050
6102
  * @format date-time
6051
6103
  * @example "2024-01-01T00:00:00Z"
6052
6104
  */
6053
- from_datetime: string;
6105
+ from_datetime: string | null;
6054
6106
  /**
6055
6107
  * The recording end date and time of the subscription lifetime usage. The date and time must be in ISO 8601 format.
6056
6108
  * @format date-time
@@ -6238,9 +6290,11 @@ export interface SubscriptionEntitlementObject {
6238
6290
  description: string | null;
6239
6291
  /**
6240
6292
  * Privileges associated with this feature. Each privilege shows the plan value and any subscription override.
6241
- * @example [{"code":"max","name":"Maximum","value_type":"integer","value":15,"plan_value":10,"override_value":15},{"code":"max_admins","name":"Max Admins","value_type":"integer","value":5,"plan_value":5,"override_value":null},{"code":"root","name":"Allow root user","value_type":"boolean","value":true,"plan_value":true,"override_value":null},{"code":"provider","name":"SSO Provider","value_type":"select","value":"okta","plan_value":"google","override_value":"okta","config":{"select_options":["google","okta"]}}]
6293
+ * @example [{"code":"max","name":"Maximum","value_type":"integer","config":{},"value":15,"plan_value":10,"override_value":15},{"code":"max_admins","name":"Max Admins","value_type":"integer","config":{},"value":5,"plan_value":5,"override_value":null},{"code":"root","name":"Allow root user","value_type":"boolean","config":{},"value":true,"plan_value":true,"override_value":null},{"code":"provider","name":"SSO Provider","value_type":"select","value":"okta","plan_value":"google","override_value":"okta","config":{"select_options":["google","okta"]}}]
6242
6294
  */
6243
6295
  privileges: SubscriptionEntitlementPrivilegeObject[];
6296
+ /** @example {"max":15,"provider":"okta"} */
6297
+ overrides: Record<string, any>;
6244
6298
  }
6245
6299
  export interface SubscriptionEntitlements {
6246
6300
  entitlements: SubscriptionEntitlementObject[];
@@ -6696,6 +6750,13 @@ export interface WalletTransactionCreateInput {
6696
6750
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
6697
6751
  */
6698
6752
  wallet_id: string;
6753
+ /**
6754
+ * The name of the wallet transaction. It will appear on the invoice as the label for the fee. If not set, the label on the invoice will fallback to either `Prepaid credits - {{wallet_name}}` if the wallet name is set, or `Prepaid credits`.
6755
+ *
6756
+ * Note that this name will apply to all transactions (`paid_credits`, `granted_credits` and `voided_credits`) created by this action.
6757
+ * @example "Tokens for models 'high-fidelity-boost'"
6758
+ */
6759
+ name?: string | null;
6699
6760
  /**
6700
6761
  * The number of paid credits.
6701
6762
  * @pattern ^[0-9]+.?[0-9]*$
@@ -6804,6 +6865,11 @@ export interface WalletTransactionObject {
6804
6865
  * @example "2022-04-29T08:59:51Z"
6805
6866
  */
6806
6867
  created_at: string;
6868
+ /**
6869
+ * The name of the wallet transaction. It will appear on the invoice as the label for the fee. If not set, the label on the invoice will fallback to either `Prepaid credits - {{wallet_name}}` if the wallet name is set, or `Prepaid credits`.
6870
+ * @example "Tokens for models 'high-fidelity-boost'"
6871
+ */
6872
+ name: string | null;
6807
6873
  }
6808
6874
  export interface WalletTransactions {
6809
6875
  wallet_transactions: WalletTransactionObject[];
@@ -7292,13 +7358,16 @@ export interface PaymentRequestPaymentFailureObject {
7292
7358
  provider_error?: string | Record<string, any>;
7293
7359
  }
7294
7360
  export type SubscriptionWithCustomerObject = SubscriptionObject & {
7295
- plan?: PlanObject;
7296
- customer?: CustomerObject;
7361
+ plan: PlanObject;
7362
+ customer: CustomerObject;
7297
7363
  };
7298
7364
  export type SubscriptionWithThresholdObject = SubscriptionObject & {
7299
- plan?: PlanObject;
7300
- customer?: CustomerObject;
7301
- usage_threshold?: UsageThresholdObject;
7365
+ plan: PlanObject;
7366
+ customer: CustomerObject;
7367
+ usage_threshold: UsageThresholdObject;
7368
+ };
7369
+ export type WalletTransactionObjectExtended = WalletTransactionObject & {
7370
+ wallet?: WalletObject;
7302
7371
  };
7303
7372
  export interface WalletTransactionPaymentFailureObject {
7304
7373
  /**
@@ -7336,7 +7405,6 @@ export interface WalletTransactionPaymentFailureObject {
7336
7405
  provider_error?: string | Record<string, any>;
7337
7406
  }
7338
7407
  export type CustomerPaymentProvidernErrorObject = CustomerPaymentProviderErrorObject;
7339
- export type PrivilegeObject = FeaturePrivilegeObject;
7340
7408
  export type QueryParamsType = Record<string | number, any>;
7341
7409
  export type ResponseFormat = keyof Omit<Body, "body" | "bodyUsed">;
7342
7410
  export interface FullRequestParams extends Omit<RequestInit, "body"> {
@@ -7397,7 +7465,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
7397
7465
  }
7398
7466
  /**
7399
7467
  * @title Lago API documentation
7400
- * @version 1.31.0
7468
+ * @version 1.33.3
7401
7469
  * @license AGPLv3
7402
7470
  * @baseUrl https://api.getlago.com/api/v1
7403
7471
  * @externalDocs https://github.com/getlago
@@ -8708,10 +8776,10 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
8708
8776
  * @example "2022-08-09"
8709
8777
  */
8710
8778
  issuing_date_to?: string;
8711
- /** Filter invoices by status. Possible values are `draft` or `finalized`. */
8712
- status?: "draft" | "finalized";
8713
- /** Filter invoices by payment status. Possible values are `pending`, `failed` or `succeeded`. */
8714
- payment_status?: "pending" | "failed" | "succeeded";
8779
+ /** Filter invoices by statuses. Possible values are `draft`, `failed`, `finalized`, `pending` and `voided`. */
8780
+ "statuses[]"?: ("draft" | "finalized" | "failed" | "pending" | "voided")[];
8781
+ /** Filter invoices by payment statuses. Possible values are `pending`, `failed` or `succeeded`. */
8782
+ "payment_statuses[]"?: ("pending" | "failed" | "succeeded")[];
8715
8783
  /**
8716
8784
  * Filter invoices by payment_overdue. Possible values are `true` or `false`.
8717
8785
  * @example true
@@ -9081,7 +9149,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
9081
9149
  */
9082
9150
  destroyPlan: (code: string, params?: RequestParams) => Promise<HttpResponse<Plan, ApiErrorUnauthorized | ApiErrorNotFound>>;
9083
9151
  /**
9084
- * @description This endpoint creates a new entitlement by adding a feature to a plan. The feature must exist and all privileges must be valid for the feature.
9152
+ * @description This endpoint creates new entitlements by adding features to a plan. Note that all existing entitlements will be deleted and replaced by the ones provided. To add a new entitlement without removing the existing ones, use PATCH. The feature must exist and all privileges must be valid for the feature.
9085
9153
  *
9086
9154
  * @tags entitlements
9087
9155
  * @name CreateEntitlement
@@ -9089,7 +9157,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
9089
9157
  * @request POST:/plans/{code}/entitlements
9090
9158
  * @secure
9091
9159
  */
9092
- createEntitlement: (code: string, data: EntitlementUpdateInput, params?: RequestParams) => Promise<HttpResponse<PlanEntitlement, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorBadRequest | ApiErrorNotFound>>;
9160
+ createEntitlement: (code: string, data: EntitlementUpdateInput, params?: RequestParams) => Promise<HttpResponse<PlanEntitlements, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorBadRequest | ApiErrorNotFound>>;
9093
9161
  /**
9094
9162
  * @description This endpoint retrieves all entitlements for a specific plan.
9095
9163
  *
@@ -9101,7 +9169,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
9101
9169
  */
9102
9170
  findAllEntitlements: (code: string, params?: RequestParams) => Promise<HttpResponse<PlanEntitlements, ApiErrorUnauthorized | ApiErrorNotFound>>;
9103
9171
  /**
9104
- * @description This endpoint updates an existing entitlement by modifying privilege values. Notice that the update is partial. All new privileges or features are added. If there is already a value, it's overridden. All feature and privileges not part of the payload are ignored. To remove privileges or feature, use the delete endpoints. All privileges must be valid for the feature.
9172
+ * @description This accepts a list of entitlements to update. If the feature isn't part of the plan yet, it's added with all the privileges from the payload. If the feature is already part of the plan, the privilege and values are updated or added. All privileges must be valid for the feature. All features and privileges not part of the payload are left untouched. To remove privileges or features, use the DELETE endpoints.
9105
9173
  *
9106
9174
  * @tags entitlements
9107
9175
  * @name UpdateEntitlement
@@ -9109,7 +9177,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
9109
9177
  * @request PATCH:/plans/{code}/entitlements
9110
9178
  * @secure
9111
9179
  */
9112
- updateEntitlement: (code: string, data: EntitlementUpdateInput, params?: RequestParams) => Promise<HttpResponse<PlanEntitlement, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorBadRequest | ApiErrorNotFound>>;
9180
+ updateEntitlement: (code: string, data: EntitlementUpdateInput, params?: RequestParams) => Promise<HttpResponse<PlanEntitlements, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorBadRequest | ApiErrorNotFound>>;
9113
9181
  /**
9114
9182
  * @description This endpoint retrieves a specific entitlement for a plan.
9115
9183
  *
@@ -9186,8 +9254,8 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
9186
9254
  * If the field is not defined, Lago will return only `active` subscriptions. However, if you wish to fetch subscriptions by different status you can define them in a status[] query param. Available filter values: `pending`, `canceled`, `terminated`, `active`.
9187
9255
  * @example ["active","pending"]
9188
9256
  */
9189
- "status[]"?: ("pending" | "canceled" | "terminated" | "active")[];
9190
- }, params?: RequestParams) => Promise<HttpResponse<SubscriptionsPaginated, ApiErrorUnauthorized | ApiErrorNotFound>>;
9257
+ "status[]"?: ("active" | "canceled" | "pending" | "terminated")[];
9258
+ }, params?: RequestParams) => Promise<HttpResponse<SubscriptionsPaginated, ApiErrorUnauthorized>>;
9191
9259
  /**
9192
9260
  * @description This endpoint retrieves a specific subscription.
9193
9261
  *
@@ -9202,6 +9270,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
9202
9270
  * By default, this endpoint only return `active` subscriptions. If you want to retrieve a subscription with a different `status`, you can specify it here.
9203
9271
  *
9204
9272
  * _Note: As there may exists multiple `canceled` or `terminated` subscribtions for the same `external_id`, it is recommended to use the "List all subscriptions" endpoint to retrieve those subscriptions._
9273
+ * @default "active"
9205
9274
  * @example "active"
9206
9275
  */
9207
9276
  status?: "active" | "terminated" | "pending" | "canceled";
@@ -9215,7 +9284,14 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
9215
9284
  * @request PUT:/subscriptions/{external_id}
9216
9285
  * @secure
9217
9286
  */
9218
- updateSubscription: (externalId: string, data: SubscriptionUpdateInput, params?: RequestParams) => Promise<HttpResponse<Subscription, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorBadRequest | ApiErrorNotFound>>;
9287
+ updateSubscription: (externalId: string, data: SubscriptionUpdateInput, query?: {
9288
+ /**
9289
+ * By default, this endpoint only return `active` subscriptions. If you want to update a subscription with a different `status`, you can specify it here.
9290
+ * @default "active"
9291
+ * @example "active"
9292
+ */
9293
+ status?: "active" | "pending";
9294
+ }, params?: RequestParams) => Promise<HttpResponse<Subscription, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorBadRequest | ApiErrorNotFound>>;
9219
9295
  /**
9220
9296
  * @description This endpoint allows you to terminate a subscription.
9221
9297
  *
@@ -9252,7 +9328,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
9252
9328
  * @example "generate"
9253
9329
  */
9254
9330
  on_termination_invoice?: "generate" | "skip";
9255
- }, params?: RequestParams) => Promise<HttpResponse<Subscription, ApiErrorUnauthorized | ApiErrorNotFound | ApiErrorNotAllowed>>;
9331
+ }, params?: RequestParams) => Promise<HttpResponse<Subscription, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
9256
9332
  /**
9257
9333
  * @description This endpoint enables the retrieval of the lifetime usage of a subscription.
9258
9334
  *
@@ -9334,7 +9410,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
9334
9410
  */
9335
9411
  findAllSubscriptionEntitlements: (externalId: string, params?: RequestParams) => Promise<HttpResponse<SubscriptionEntitlements, ApiErrorUnauthorized | ApiErrorNotFound>>;
9336
9412
  /**
9337
- * @description This endpoint allows partial updates to subscription entitlements. New entitlements are added, provided values are overridden, but entitlements not included in the payload are ignored.
9413
+ * @description This accepts a list of entitlements to update. If the feature isn't part of the subscription yet, it's added with all the privileges from the payload. If the feature is already part of the subscription (via plan or via override), the privilege and values are updated or added. All privileges must be valid for the feature. All features and privileges not part of the payload are left untouched. To remove privileges or features, use the DELETE endpoints.
9338
9414
  *
9339
9415
  * @tags entitlements
9340
9416
  * @name UpdateSubscriptionEntitlements