lago-javascript-client 1.33.1 → 1.33.4

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
  }[];
@@ -3210,1169 +3195,1541 @@ export interface CustomerCreateInput {
3210
3195
  export interface Customer {
3211
3196
  customer: CustomerObjectExtended;
3212
3197
  }
3213
- /** Details about the pricing unit used for charge usage. */
3214
- export interface UsagePricingUnitDetailsObject {
3198
+ export interface InvoiceBaseObject {
3215
3199
  /**
3216
- * The amount in cents in the pricing unit.
3217
- * @example 200
3200
+ * Unique identifier assigned to the fee within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the fee's record within the Lago system.
3201
+ * @format uuid
3202
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3218
3203
  */
3219
- amount_cents: number;
3204
+ lago_id: string;
3220
3205
  /**
3221
- * The short name of the pricing unit.
3222
- * @example "CR"
3206
+ * The unique code of the billing entity associated with the invoice
3207
+ * @example "acme_corp"
3223
3208
  */
3224
- short_name: string;
3209
+ billing_entity_code: string | null;
3225
3210
  /**
3226
- * The conversion rate from pricing units to the plan's currency.
3227
- * @example "0.5"
3211
+ * This ID helps in uniquely identifying and organizing the invoices associated with a specific customer. It provides a sequential numbering system specific to the customer, allowing for easy tracking and management of invoices within the customer's context.
3212
+ * @example 2
3228
3213
  */
3229
- conversion_rate: string;
3230
- }
3231
- /** Array of filter object, representing multiple dimensions for a charge item. */
3232
- export type CustomerChargeFiltersUsageObject = {
3214
+ sequential_id?: number;
3233
3215
  /**
3234
- * The number of units consumed for a specific charge filter related to a charge item.
3235
- * @pattern ^[0-9]+.?[0-9]*$
3236
- * @example "0.9"
3216
+ * The unique number assigned to the invoice. This number serves as a distinct identifier for the invoice and helps in differentiating it from other invoices in the system.
3217
+ * @example "LAG-1234-001-002"
3237
3218
  */
3238
- units?: string;
3219
+ number: string;
3239
3220
  /**
3240
- * The amount in cents, tax excluded, consumed for a specific charge filter related to a charge item.
3241
- * @example 1000
3221
+ * The date when the invoice was issued. It is provided in the ISO 8601 date format.
3222
+ * @format date
3223
+ * @example "2022-04-30"
3242
3224
  */
3243
- amount_cents?: number;
3225
+ issuing_date: string;
3244
3226
  /**
3245
- * The quantity of usage events that have been recorded for a particular charge filter during the specified time period. These events may also be referred to as the number of transactions in some contexts.
3246
- * @example 10
3227
+ * The date when the payment dispute was lost. It is expressed in Coordinated Universal Time (UTC).
3228
+ * @format date-time
3229
+ * @example "2022-09-14T16:35:31Z"
3247
3230
  */
3248
- events_count?: number;
3231
+ payment_dispute_lost_at?: string;
3249
3232
  /**
3250
- * Specifies the name that will be displayed on an invoice.
3251
- * @example "AWS eu-east-1"
3233
+ * The payment due date for the invoice, specified in the ISO 8601 date format.
3234
+ * @format date
3235
+ * @example "2022-04-30"
3252
3236
  */
3253
- invoice_display_name?: string;
3254
- /** Details about the pricing unit used for charge usage. */
3255
- pricing_unit_details?: UsagePricingUnitDetailsObject;
3237
+ payment_due_date?: string;
3256
3238
  /**
3257
- * List of filter values applied to the usage.
3258
- * @example {"region":["us-east-1"]}
3239
+ * Specifies if the payment is considered as overdue.
3240
+ * @example true
3259
3241
  */
3260
- values?: Record<string, string[]>;
3261
- }[];
3262
- /** Array of aggregated fees, grouped by the event properties defined in a `standard` charge model. */
3263
- export type CustomerChargeGroupedUsageObject = {
3242
+ payment_overdue?: boolean;
3264
3243
  /**
3265
- * The amount in cents, tax excluded, consumed for a specific group related to a charge item.
3266
- * @example 1000
3244
+ * The net payment term, expressed in days, specifies the duration within which a customer is expected to remit payment after the invoice is finalized.
3245
+ * @example 30
3267
3246
  */
3268
- amount_cents?: number;
3247
+ net_payment_term?: number;
3269
3248
  /**
3270
- * The quantity of usage events that have been recorded for a particular charge during the specified time period. These events may also be referred to as the number of transactions in some contexts.
3271
- * @example 10
3249
+ * The type of invoice issued. Possible values are `subscription`, `one-off`, `credit` or `progressive_billing`.
3250
+ * @example "subscription"
3272
3251
  */
3273
- events_count?: number;
3252
+ invoice_type: "subscription" | "add_on" | "credit" | "one_off" | "progressive_billing";
3274
3253
  /**
3275
- * The number of units consumed for a specific group related to a charge item.
3276
- * @pattern ^[0-9]+.?[0-9]*$
3277
- * @example "0.9"
3254
+ * The status of the invoice. It indicates the current state of the invoice and can have following values:
3255
+ * - `draft`: the invoice is in the draft state, waiting for the end of the grace period to be finalized. During this period, events can still be ingested and added to the invoice.
3256
+ * - `finalized`: the invoice has been issued and finalized. In this state, events cannot be ingested or added to the invoice anymore.
3257
+ * - `voided`: the invoice has been issued and subsequently voided. In this state, events cannot be ingested or added to the invoice anymore.
3258
+ * - `pending`: the invoice remains pending until the taxes are fetched from the external provider.
3259
+ * - `failed`: during an attempt of finalization of the invoice, an error happened. This invoice will have an array of error_details, explaining, in which part of the system an error happened and how it's possible to fix it. This invoice can't be edited or updated, only retried. This action will discard current error_details and will create new ones if the finalization failed again.
3260
+ * @example "finalized"
3278
3261
  */
3279
- units?: string;
3280
- /** Details about the pricing unit used for charge usage. */
3281
- pricing_unit_details?: UsagePricingUnitDetailsObject;
3282
- /** Key value list of event properties aggregated by the charge model */
3283
- grouped_by?: Record<string, string>;
3284
- /** Array of filter object, representing multiple dimensions for a charge item. */
3285
- filters?: CustomerChargeFiltersUsageObject;
3286
- }[];
3287
- export interface CustomerChargeUsageObject {
3262
+ status: "draft" | "finalized" | "voided" | "failed" | "pending";
3288
3263
  /**
3289
- * The number of units consumed by the customer for a specific charge item.
3290
- * @pattern ^[0-9]+.?[0-9]*$
3291
- * @example "1.0"
3264
+ * The status of the payment associated with the invoice. It can have one of the following values:
3265
+ * - `pending`: the payment is pending, waiting for payment processing in Stripe or when the invoice is emitted but users have not updated the payment status through the endpoint.
3266
+ * - `succeeded`: the payment of the invoice has been successfully processed.
3267
+ * - `failed`: the payment of the invoice has failed or encountered an error during processing.
3268
+ * @example "succeeded"
3292
3269
  */
3293
- units: string;
3270
+ payment_status: "pending" | "succeeded" | "failed";
3294
3271
  /**
3295
- * The quantity of usage events that have been recorded for a particular charge during the specified time period. These events may also be referred to as the number of transactions in some contexts.
3296
- * @example 10
3272
+ * The currency of the invoice issued.
3273
+ * @example "EUR"
3297
3274
  */
3298
- events_count: number;
3275
+ currency: Currency;
3299
3276
  /**
3300
- * The amount in cents, tax excluded, consumed by the customer for a specific charge item.
3301
- * @example 123
3277
+ * The total sum of fees amount in cents. It calculates the cumulative amount of all the fees associated with the invoice, providing a consolidated value.
3278
+ * @example 100
3302
3279
  */
3303
- amount_cents: number;
3280
+ fees_amount_cents: number;
3304
3281
  /**
3305
- * The currency of a usage item consumed by the customer.
3306
- * @example "EUR"
3282
+ * The total sum of all coupons discounted on the invoice. It calculates the cumulative discount amount applied by coupons, expressed in cents.
3283
+ * @example 10
3307
3284
  */
3308
- amount_currency: Currency;
3309
- /** Details about the pricing unit used for charge usage. */
3310
- pricing_unit_details?: UsagePricingUnitDetailsObject;
3311
- /** Object listing all the properties for a specific charge item. */
3312
- charge: {
3313
- /**
3314
- * Unique identifier assigned to the charge within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the charge's record within the Lago system.
3315
- * @format uuid
3316
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3317
- */
3318
- lago_id: string;
3319
- /**
3320
- * The pricing model applied to this charge. Possible values are standard, `graduated`, `percentage`, `package` or `volume`.
3321
- * @example "graduated"
3322
- */
3323
- charge_model: "standard" | "graduated" | "package" | "percentage" | "volume";
3324
- /**
3325
- * 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.
3326
- * @example "Setup"
3327
- */
3328
- invoice_display_name?: string;
3329
- };
3330
- /** The related billable metric object. */
3331
- billable_metric: {
3332
- /**
3333
- * Unique identifier assigned to the billable metric within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the billable metric's record within the Lago system.
3334
- * @format uuid
3335
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3336
- */
3337
- lago_id: string;
3338
- /**
3339
- * The name of the billable metric used for this charge.
3340
- * @example "Storage"
3341
- */
3342
- name: string;
3343
- /**
3344
- * The code of the billable metric used for this charge.
3345
- * @example "storage"
3346
- */
3347
- code: string;
3348
- /**
3349
- * The aggregation type of the billable metric used for this charge. Possible values are `count_agg`, `sum_agg`, `max_agg` or `unique_count_agg`.
3350
- * @example "sum_agg"
3351
- */
3352
- aggregation_type: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg" | "weighted_sum_agg" | "latest_agg";
3353
- };
3354
- /** Array of filter object, representing multiple dimensions for a charge item. */
3355
- filters?: CustomerChargeFiltersUsageObject;
3356
- /** Array of aggregated fees, grouped by the event properties defined in a `standard` charge model. */
3357
- grouped_usage?: CustomerChargeGroupedUsageObject;
3358
- }
3359
- export interface CustomerUsageObject {
3285
+ coupons_amount_cents: number;
3360
3286
  /**
3361
- * The lower bound of the billing period, expressed in the ISO 8601 datetime format in Coordinated Universal Time (UTC).
3362
- * @format date-time
3363
- * @example "2022-07-01T00:00:00Z"
3287
+ * The total sum of all credit notes discounted on the invoice. It calculates the cumulative discount amount applied by credit notes, expressed in cents.
3288
+ * @example 10
3364
3289
  */
3365
- from_datetime: string;
3290
+ credit_notes_amount_cents: number;
3366
3291
  /**
3367
- * The upper bound of the billing period, expressed in the ISO 8601 datetime format in Coordinated Universal Time (UTC).
3368
- * @format date-time
3369
- * @example "2022-07-31T23:59:59Z"
3292
+ * Subtotal amount, excluding taxes, expressed in cents.
3293
+ * This field depends on the version number. Here are the definitions based on the version:
3294
+ * - Version 1: is equal to the sum of `fees_amount_cents`, minus `coupons_amount_cents`, and minus `prepaid_credit_amount_cents`.
3295
+ * - Version 2: is equal to the `fees_amount_cents`.
3296
+ * - Version 3 & 4: is equal to the `fees_amount_cents`, minus `coupons_amount_cents`
3297
+ * @example 100
3370
3298
  */
3371
- to_datetime: string;
3299
+ sub_total_excluding_taxes_amount_cents: number;
3372
3300
  /**
3373
- * The date of creation of the invoice.
3374
- * @format date
3375
- * @example "2022-08-01"
3301
+ * The sum of tax amount associated with the invoice, expressed in cents.
3302
+ * @example 20
3376
3303
  */
3377
- issuing_date: string;
3304
+ taxes_amount_cents: number;
3378
3305
  /**
3379
- * A unique identifier associated with the invoice related to this particular usage record.
3380
- * @format uuid
3381
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3306
+ * Subtotal amount, including taxes, expressed in cents.
3307
+ * This field depends on the version number. Here are the definitions based on the version:
3308
+ * - Version 1: is equal to the `total_amount_cents`.
3309
+ * - Version 2: is equal to the sum of `fees_amount_cents` and `taxes_amount_cents`.
3310
+ * - Version 3 & 4: is equal to the sum `sub_total_excluding_taxes_amount_cents` and `taxes_amount_cents`
3311
+ * @example 120
3382
3312
  */
3383
- lago_invoice_id?: string | null;
3313
+ sub_total_including_taxes_amount_cents: number;
3384
3314
  /**
3385
- * The currency of the customer's current usage.
3386
- * @example "EUR"
3315
+ * The total sum of all prepaid credits discounted on the invoice. It calculates the cumulative discount amount applied by prepaid credits, expressed in cents.
3316
+ * @example 0
3387
3317
  */
3388
- currency?: Currency;
3318
+ prepaid_credit_amount_cents: number;
3389
3319
  /**
3390
- * The amount in cents, tax excluded.
3391
- * @example 123
3320
+ * The usage already billed in previous invoices. Only apply to `progressive_billing` and `subscription` invoices.
3321
+ * @example 0
3392
3322
  */
3393
- amount_cents: number;
3323
+ progressive_billing_credit_amount_cents: number;
3394
3324
  /**
3395
- * The tax amount in cents.
3396
- * @example 200
3325
+ * The sum of the amount and taxes amount on the invoice, expressed in cents. It calculates the total financial value of the invoice, including both the original amount and any applicable taxes.
3326
+ * @example 100
3397
3327
  */
3398
- taxes_amount_cents: number;
3328
+ total_amount_cents: number;
3329
+ /** @example 3 */
3330
+ version_number: number;
3399
3331
  /**
3400
- * The total amount in cents, tax included.
3401
- * @example 123
3332
+ * Indicates if the invoice is self-billed. Self-billing is a process where an organization creates the invoice on behalf of the partner. This field specifies whether the invoice is self-billed or not.
3333
+ * @example false
3402
3334
  */
3403
- total_amount_cents: number;
3404
- /** Array of charges that comprise the current usage. It contains detailed information about individual charge items associated with the usage. */
3405
- charges_usage: CustomerChargeUsageObject[];
3406
- }
3407
- export interface CustomerUsage {
3408
- customer_usage: CustomerUsageObject;
3409
- }
3410
- export interface CustomerProjectedUsageObject {
3335
+ self_billed?: boolean;
3411
3336
  /**
3412
- * The lower bound of the billing period, expressed in the ISO 8601 datetime format in Coordinated Universal Time (UTC).
3413
- * @format date-time
3414
- * @example "2022-07-01T00:00:00Z"
3337
+ * Contains the URL that provides direct access to the invoice PDF file. You can use this URL to download or view the PDF document of the invoice
3338
+ * @format uri
3339
+ * @example "https://getlago.com/invoice/file"
3415
3340
  */
3416
- from_datetime: string;
3341
+ file_url?: string;
3417
3342
  /**
3418
- * The upper bound of the billing period, expressed in the ISO 8601 datetime format in Coordinated Universal Time (UTC).
3343
+ * The date of the invoice creation, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC). The creation_date provides a standardized and internationally recognized timestamp for when the invoice object was created
3419
3344
  * @format date-time
3420
- * @example "2022-07-31T23:59:59Z"
3345
+ * @example "2022-04-29T08:59:51Z"
3421
3346
  */
3422
- to_datetime: string;
3347
+ created_at: string;
3423
3348
  /**
3424
- * The date of creation of the invoice.
3425
- * @format date
3426
- * @example "2022-08-01"
3349
+ * The date of the invoice update, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC). The update_date provides a standardized and internationally recognized timestamp for when the invoice object was updated
3350
+ * @format date-time
3351
+ * @example "2022-04-29T08:59:51Z"
3427
3352
  */
3428
- issuing_date: string;
3353
+ updated_at: string;
3354
+ }
3355
+ export interface BillingPeriodObject {
3429
3356
  /**
3430
- * A unique identifier associated with the invoice related to this particular usage record.
3357
+ * Unique identifier assigned to the subscription, created by Lago.
3431
3358
  * @format uuid
3432
3359
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3433
3360
  */
3434
- lago_invoice_id?: string | null;
3361
+ lago_subscription_id: string;
3435
3362
  /**
3436
- * The currency of the customer's current usage.
3437
- * @example "EUR"
3363
+ * Unique identifier assigned to the subscription in your application.
3364
+ * @example "external_id"
3438
3365
  */
3439
- currency?: Currency;
3366
+ external_subscription_id: string;
3440
3367
  /**
3441
- * The amount in cents, tax excluded.
3442
- * @example 123
3368
+ * Unique identifier assigned to the plan, created by Lago.
3369
+ * @format uuid
3370
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3443
3371
  */
3444
- amount_cents: number;
3372
+ lago_plan_id: string;
3445
3373
  /**
3446
- * The projected amount in cents, tax excluded.
3447
- * @example 256
3374
+ * The beginning date of the subscription billing period. This field indicates the start date of the billing period associated with the subscription fee.
3375
+ * @format date-time
3376
+ * @example "2022-04-29T08:59:51Z"
3448
3377
  */
3449
- projected_amount_cents: number;
3378
+ subscription_from_datetime: string;
3450
3379
  /**
3451
- * The tax amount in cents.
3452
- * @example 200
3380
+ * The ending date of the subscription billing period. This field indicates the end date of the billing period associated with the subscription fee.
3381
+ * @format date-time
3382
+ * @example "2022-05-29T08:59:51Z"
3453
3383
  */
3454
- taxes_amount_cents: number;
3384
+ subscription_to_datetime: string;
3455
3385
  /**
3456
- * The total amount in cents, tax included.
3457
- * @example 123
3386
+ * The beginning date of the period that covers the charge fees. It is applicable only to the `charge` fees attached to the subscription. This field indicates the start date of the billing period or subscription period associated with the fees.
3387
+ * @format date-time
3388
+ * @example "2022-04-29T08:59:51Z"
3458
3389
  */
3459
- total_amount_cents: number;
3460
- /** Array of charges that comprise the current usage. It contains detailed information about individual charge items associated with the usage. */
3461
- charges_usage: CustomerChargeUsageObject[];
3462
- }
3463
- export interface CustomerProjectedUsage {
3464
- customer_projected_usage: CustomerProjectedUsageObject;
3465
- }
3466
- export interface CustomerPastUsage {
3467
- usage_periods: CustomerUsage[];
3468
- meta: PaginationMeta;
3469
- }
3470
- /** . */
3471
- export interface CustomerCheckoutUrl {
3472
- customer?: {
3473
- /**
3474
- * Unique identifier assigned to the customer within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the customer's record within the Lago system
3475
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3476
- */
3477
- lago_customer_id: string;
3478
- /**
3479
- * The customer external unique identifier (provided by your own application)
3480
- * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
3481
- */
3482
- external_customer_id: string;
3483
- /**
3484
- * The Payment Provider name linked to the Customer.
3485
- * @example "stripe"
3486
- */
3487
- payment_provider: string;
3488
- /**
3489
- * Code of the payment provider
3490
- * @example "Stripe Prod"
3491
- */
3492
- payment_provider_code?: string;
3493
- /**
3494
- * The new generated Payment Provider Checkout URL for the Customer.
3495
- * @example "https://foo.bar"
3496
- */
3497
- checkout_url?: string;
3498
- };
3499
- }
3500
- export interface EventObject {
3390
+ charges_from_datetime: string;
3501
3391
  /**
3502
- * Unique identifier assigned to the event within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the event's record within the Lago system
3503
- * @format uuid
3504
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3392
+ * The ending date of the period that covers the charge fees. It is applicable only to the `charge` fees attached to the subscription. This field indicates the end date of the billing period or subscription period associated with the fees.
3393
+ * @format date-time
3394
+ * @example "2022-05-29T08:59:51Z"
3505
3395
  */
3506
- lago_id: string;
3396
+ charges_to_datetime: string;
3507
3397
  /**
3508
- * This field represents a unique identifier for the event. It is crucial for ensuring idempotency, meaning that each event can be uniquely identified and processed without causing any unintended side effects.
3509
- * @example "transaction_1234567890"
3398
+ * The reason explaining why this subscription appears on the invoice.
3399
+ * @example "subscription_starting"
3510
3400
  */
3511
- transaction_id: string;
3401
+ invoicing_reason: "subscription_starting" | "subscription_periodic" | "subscription_terminating" | "in_advance_charge" | "in_advance_charge_periodic" | "progressive_billing";
3402
+ }
3403
+ export interface InvoiceMetadataObject {
3512
3404
  /**
3513
- * Unique identifier assigned to the customer within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the customer's record within the Lago system
3405
+ * Unique identifier assigned to the invoice metadata within the Lago application.
3514
3406
  * @format uuid
3515
3407
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3516
3408
  */
3517
- lago_customer_id: string | null;
3409
+ lago_id?: string;
3518
3410
  /**
3519
- * The code that identifies a targeted billable metric. It is essential that this code matches the `code` property of one of your active billable metrics. If the provided code does not correspond to any active billable metric, it will be ignored during the process.
3520
- * @example "storage"
3411
+ * Represents the key of the metadata's key-value pair.
3412
+ * @example "digital_ref_id"
3521
3413
  */
3522
- code: string;
3414
+ key?: string;
3523
3415
  /**
3524
- * This field captures the Unix timestamp in seconds indicating the occurrence of the event in Coordinated Universal Time (UTC). If this timestamp is not provided, the API will automatically set it to the time of event reception.
3416
+ * Represents the value of the metadata's key-value pair.
3417
+ * @example "INV-0123456-98765"
3418
+ */
3419
+ value?: string;
3420
+ /**
3421
+ * The date and time when the metadata object was created. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
3525
3422
  * @format date-time
3526
- * @example "2022-04-29T08:59:51.123Z"
3423
+ * @example "2022-04-29T08:59:51Z"
3527
3424
  */
3528
- timestamp: string;
3425
+ created_at?: string;
3426
+ }
3427
+ export type InvoiceAppliedTaxObject = BaseAppliedTax & {
3529
3428
  /**
3530
- * The precise total amount that was sent in the event payload. This filed is used by the `dynamic` pricing model.
3531
- * @example "1234.56"
3429
+ * Unique identifier of the invoice, created by Lago.
3430
+ * @format uuid
3431
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3532
3432
  */
3533
- precise_total_amount_cents?: string | null;
3433
+ lago_invoice_id?: string;
3534
3434
  /**
3535
- * This field represents additional properties associated with the event, which are utilized in the calculation of the final fee. This object becomes mandatory when the targeted billable metric employs a `sum_agg`, `max_agg`, or `unique_count_agg` aggregation method. However, when using a simple `count_agg`, this object is not required.
3536
- * @example {"gb":10}
3435
+ * Fees total amount on which the tax is applied
3436
+ * @example 20000
3537
3437
  */
3538
- properties?: {
3539
- /** The `operation_type` field is only necessary when adding or removing a specific unit when the targeted billable metric adopts a `unique_count_agg` aggregation method. In other cases, the `operation_type` field is not required. The valid values for the `operation_type` field are `add` or `remove`, which indicate whether the unit is being added or removed from the unique count aggregation, respectively. */
3540
- operation_type?: "add" | "remove";
3541
- [key: string]: any;
3542
- };
3438
+ fees_amount_cents?: number;
3439
+ };
3440
+ export interface UsageThresholdObject {
3543
3441
  /**
3544
- * Unique identifier assigned to the subscription within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the subscription's record within the Lago system
3442
+ * Unique identifier of the usage threshold created by Lago.
3545
3443
  * @format uuid
3546
3444
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3547
3445
  */
3548
- lago_subscription_id: string | null;
3446
+ lago_id: string;
3549
3447
  /**
3550
- * The unique identifier of the subscription within your application. It is a mandatory field when the customer possesses multiple subscriptions or when the `external_customer_id` is not provided.
3551
- * @example "sub_1234567890"
3448
+ * The display name of the usage threshold.
3449
+ * @example "Threshold 1"
3552
3450
  */
3553
- external_subscription_id: string;
3451
+ threshold_display_name: string | null;
3554
3452
  /**
3555
- * The creation date of the event's record in the Lago application, presented in the ISO 8601 datetime format, specifically in Coordinated Universal Time (UTC). It provides the precise timestamp of when the event's record was created within the Lago application
3556
- * @format date-time
3557
- * @example "2022-04-29T08:59:51Z"
3453
+ * The amount to reach to trigger a `progressive_billing` invoice.
3454
+ * @example 10000
3558
3455
  */
3559
- created_at: string;
3560
- }
3561
- export interface EventsPaginated {
3562
- events: EventObject[];
3563
- meta: PaginationMeta;
3564
- }
3565
- export interface EventInputObject {
3456
+ amount_cents: number;
3566
3457
  /**
3567
- * This field represents a unique identifier for the event.
3568
- * It is crucial for ensuring idempotency, meaning that each event can be uniquely identified and processed without causing any unintended side effects.
3569
- *
3570
- * WARNING: If the Lago organization is configured to use the new Clickhouse-based event pipeline (designed for high-volume processing), the idempotency logic is handled differently.
3571
- * Event uniqueness is maintained with both `transaction_id` and `timestamp` fields.
3572
- * If a new event arrives with identical values for these two fields as an existing event, the new one will overwrite the previous event rather than being rejected.
3573
- * @example "transaction_1234567890"
3458
+ * 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.
3459
+ * @example true
3574
3460
  */
3575
- transaction_id: string;
3461
+ recurring: boolean;
3576
3462
  /**
3577
- * The unique identifier of the subscription in your application. This field is mandatory in order to link events to the correct customer subscription.
3578
- * @example "sub_1234567890"
3463
+ * The date and time when the usage threshold was created. It is expressed in UTC format according to the ISO 8601 datetime standard.
3464
+ * @format date-time
3465
+ * @example "2023-06-27T19:43:42Z"
3579
3466
  */
3580
- external_subscription_id: string;
3467
+ created_at: string;
3581
3468
  /**
3582
- * The code that identifies a targeted billable metric. It is essential that this code matches the `code` property of one of your active billable metrics. If the provided code does not correspond to any active billable metric, it will be ignored during the process.
3583
- * @example "storage"
3469
+ * The date and time when the usage threshold was last updated. It is expressed in UTC format according to the ISO 8601 datetime standard.
3470
+ * @format date-time
3471
+ * @example "2023-06-27T19:43:42Z"
3584
3472
  */
3585
- code: string;
3586
- /**
3587
- * This field captures the Unix timestamp in seconds indicating the occurrence of the event in Coordinated Universal Time (UTC).
3588
- * If this timestamp is not provided, the API will automatically set it to the time of event reception.
3589
- * You can also provide miliseconds precision by appending decimals to the timestamp.
3590
- * @example "1651240791.123"
3591
- */
3592
- timestamp?: number | string;
3473
+ updated_at: string;
3474
+ }
3475
+ export interface AppliedUsageThresholdObject {
3593
3476
  /**
3594
- * The precise total amount in cents with precision used by the `dynamic` pricing model to compute the usage amount.
3595
- * @example "1234.56"
3477
+ * The amount of usage in cents that has been accumulated over the lifetime of the subscription.
3478
+ * @example 2000
3596
3479
  */
3597
- precise_total_amount_cents?: string | null;
3480
+ lifetime_usage_amount_cents: number;
3598
3481
  /**
3599
- * This field represents additional properties associated with the event, which are utilized in the calculation of the final fee. This object becomes mandatory when the targeted billable metric employs a `sum_agg`, `max_agg`, or `unique_count_agg` aggregation method. However, when using a simple `count_agg`, this object is not required.
3600
- * @example {"gb":10}
3482
+ * The date and time when the lifetime usage was computed. It is expressed in UTC format according to the ISO 8601 datetime standard.
3483
+ * @format date-time
3484
+ * @example "2025-03-31T12:31:44Z"
3601
3485
  */
3602
- properties?: object | null;
3603
- }
3604
- export interface EventInput {
3605
- event: EventInputObject;
3606
- }
3607
- export interface EventCreated {
3608
- event: EventObject & {
3609
- /**
3610
- * The value will always be null in this response as the event processing is done asynchronously
3611
- * @example null
3612
- */
3613
- lago_customer_id?: null;
3614
- };
3615
- }
3616
- export interface EventBatchInput {
3617
- events: EventInputObject[];
3618
- }
3619
- export interface EventsCreated {
3620
- events: (EventObject & {
3621
- /**
3622
- * The value will always be null in this response as the event processing is done asynchronously
3623
- * @example null
3624
- */
3625
- lago_customer_id?: null;
3626
- })[];
3627
- }
3628
- export interface EventEstimateFeesInput {
3629
- event: {
3630
- /**
3631
- * The code that identifies a targeted billable metric. It is essential that this code matches the `code` property of one of your active billable metrics. If the provided code does not correspond to any active billable metric, it will be ignored during the process.
3632
- * @example "storage"
3633
- */
3634
- code: string;
3635
- /**
3636
- * The unique identifier of the subscription within your application.
3637
- * @example "sub_1234567890"
3638
- */
3639
- external_subscription_id: string;
3640
- /** This field represents additional properties associated with the event, which are utilized in the calculation of the final fee. This object becomes mandatory when the targeted billable metric employs a `sum_agg`, `max_agg`, or `unique_count_agg` aggregation method. However, when using a simple `count_agg`, this object is not required. */
3641
- properties?: object;
3642
- };
3643
- }
3644
- export interface Fees {
3645
- fees: FeeObject[];
3486
+ created_at: string;
3487
+ usage_threshold: UsageThresholdObject;
3646
3488
  }
3647
- export interface EventEstimateInstantFeesInput {
3648
- event: {
3649
- /**
3650
- * The code that identifies a targeted billable metric. It is essential that this code matches the `code` property of one of your active billable metrics. If the provided code does not correspond to any active billable metric, it will be ignored during the process.
3651
- * @example "storage"
3652
- */
3653
- code: string;
3654
- /**
3655
- * The unique identifier of the subscription within your application.
3656
- * @example "sub_1234567890"
3657
- */
3658
- external_subscription_id: string;
3659
- /** This field represents additional properties associated with the event, which are utilized in the calculation of the final fee. This object becomes mandatory when the targeted billable metric employs a `sum_agg`, `max_agg`, or `unique_count_agg` aggregation method. However, when using a simple `count_agg`, this object is not required. */
3660
- properties?: object;
3661
- /**
3662
- * This field represents a unique identifier for the event.
3663
- * @example "transaction_1234567890"
3664
- */
3665
- transaction_id?: string | null;
3666
- };
3489
+ export type InvoiceObject = InvoiceBaseObject & {
3490
+ /** The customer on which the invoice applies. It refers to the customer account or entity associated with the invoice. */
3491
+ customer?: CustomerObject;
3492
+ billing_periods?: BillingPeriodObject[];
3493
+ metadata?: InvoiceMetadataObject[];
3494
+ applied_taxes?: InvoiceAppliedTaxObject[];
3495
+ applied_usage_thresholds?: AppliedUsageThresholdObject[];
3496
+ };
3497
+ export interface InvoicesPaginated {
3498
+ invoices: InvoiceObject[];
3499
+ meta: PaginationMeta;
3667
3500
  }
3668
- export interface FeeEstimateObject {
3669
- lago_id?: null;
3501
+ export interface PaymentObject {
3670
3502
  /**
3671
- * Unique identifier assigned to the charge that the fee belongs to
3503
+ * The unique identifier of the payment, created by Lago.
3672
3504
  * @format uuid
3673
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3505
+ * @example "4cf085a7-c196-4f07-a543-97c50ec6e8b2"
3674
3506
  */
3675
- lago_charge_id?: string;
3507
+ lago_id: string;
3676
3508
  /**
3677
- * Unique identifier assigned to the charge filter that the fee belongs to
3509
+ * Unique identifier of the customer, created by Lago.
3678
3510
  * @format uuid
3679
3511
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3680
3512
  */
3681
- lago_charge_filter_id?: string | null;
3682
- lago_invoice_id?: null;
3683
- lago_true_up_fee_id?: null;
3684
- lago_true_up_parent_fee_id?: null;
3513
+ lago_customer_id: string;
3685
3514
  /**
3686
- * Unique identifier assigned to the subscription, created by Lago. This field is specifically displayed when the fee type is charge or subscription.
3687
- * @format uuid
3688
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3515
+ * The customer external unique identifier (provided by your own application)
3516
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
3689
3517
  */
3690
- lago_subscription_id?: string;
3518
+ external_customer_id: string;
3519
+ /** List of invoice IDs associated with the payment. */
3520
+ invoice_ids: string[];
3691
3521
  /**
3692
- * Unique identifier assigned to the customer, created by Lago. This field is specifically displayed when the fee type is charge or subscription.
3522
+ * The unique identifier of the paid resource, created by Lago.
3693
3523
  * @format uuid
3694
3524
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3695
3525
  */
3696
- lago_customer_id?: string;
3526
+ lago_payable_id: string;
3697
3527
  /**
3698
- * Unique identifier assigned to the customer in your application. This field is specifically displayed when the fee type is charge or subscription.
3699
- * @example "external_id"
3528
+ * The type of the paid resource, associated with the `lago_payable_id`.
3529
+ * @example "Invoice"
3700
3530
  */
3701
- external_customer_id?: string;
3531
+ payable_type: "Invoice" | "PaymentRequest";
3702
3532
  /**
3703
- * Unique identifier assigned to the subscription in your application. This field is specifically displayed when the fee type is charge or subscription.
3704
- * @example "external_id"
3533
+ * The amount of the payment in cents.
3534
+ * @example 1099
3705
3535
  */
3706
- external_subscription_id?: string;
3536
+ amount_cents: number;
3707
3537
  /**
3708
- * The cost of this specific fee, excluding any applicable taxes.
3709
- * @example 100
3538
+ * The currency of the payment amount.
3539
+ * @example "USD"
3710
3540
  */
3711
- amount_cents: number;
3541
+ amount_currency: Currency;
3712
3542
  /**
3713
- * The cost of this specific fee, excluding any applicable taxes, with precision.
3714
- * @example 1.0001
3543
+ * The status of the payment within the payment provider. This can be very different from a payment provider to another.
3544
+ * @example "Completed"
3715
3545
  */
3716
- precise_amount?: number;
3546
+ status: string;
3717
3547
  /**
3718
- * The cost of this specific fee, including any applicable taxes, with precision.
3719
- * @example 1.0212
3548
+ * The normalized payment status by Lago.
3549
+ * @example "succeeded"
3720
3550
  */
3721
- precise_total_amount?: number;
3551
+ payment_status: "succeeded" | "failed" | "pending" | "processing";
3722
3552
  /**
3723
- * The currency of this specific fee. It indicates the monetary unit in which the fee's cost is expressed.
3724
- * @example "EUR"
3553
+ * The type of payment.
3554
+ * @example "manual"
3725
3555
  */
3726
- amount_currency: Currency;
3556
+ type: "manual" | "provider";
3727
3557
  /**
3728
- * The cost of the tax associated with this specific fee.
3729
- * @example 0
3558
+ * Reference for the payment.
3559
+ * @example "ref1"
3730
3560
  */
3731
- taxes_amount_cents: number;
3561
+ reference: string;
3732
3562
  /**
3733
- * The cost of the tax associated with this specific fee, with precision.
3734
- * @example 0
3563
+ * Code of the payment provider
3564
+ * @example "stripe_prod"
3735
3565
  */
3736
- taxes_precise_amount?: number;
3566
+ payment_provider_code: string;
3737
3567
  /**
3738
- * The tax rate associated with this specific fee.
3739
- * @example 20
3568
+ * The type of payment provider
3569
+ * @example "stripe"
3740
3570
  */
3741
- taxes_rate: number;
3571
+ payment_provider_type: "adyen" | "cashfree" | "gocardless" | "stripe" | "flutterwave" | "moneyhash";
3572
+ /** DEPRECATED: use provider_payment_id */
3573
+ external_payment_id: string | null;
3742
3574
  /**
3743
- * The number of units used to charge the customer. This field indicates the quantity or count of units consumed or utilized in the context of the charge. It helps in determining the basis for calculating the fee or cost associated with the usage of the service or product provided to the customer.
3744
- * @example "0.32"
3575
+ * Unique identifier of the payment within the payment provider (if applicable).
3576
+ * @example "pi_5eb0285741bc6ba"
3745
3577
  */
3746
- units: string;
3747
- description?: null;
3578
+ provider_payment_id: string | null;
3748
3579
  /**
3749
- * The unit amount of the fee per unit, with precision.
3750
- * @example 312.5
3580
+ * Unique identifier of the customer within the payment provider
3581
+ * @example "cus_5eb0285bcf941bc6ba"
3751
3582
  */
3752
- precise_unit_amount: number;
3583
+ provider_customer_id: string;
3753
3584
  /**
3754
- * The coupon amount applied to the estimated instant fee. It will always returns 0
3755
- * @example "0.0"
3585
+ * The next action to be taken by the customer to complete the payment. Should usually be empty, except when receiving the `payment.requires_action` webhook.
3586
+ * @example {"type":"redirect_to_url","redirect_to_url":{"url":"https://hooks.stripe.com/3d_secure_2/hosted?merchant=acct_AAA&payment_intent=pi_BBB&payment_intent_client_secret=pi_BBB&publishable_key=pk_test_CCC","return_url":"https://app.example.com"}}
3756
3587
  */
3757
- precise_coupons_amount_cents?: string;
3588
+ next_action: Record<string, any>;
3758
3589
  /**
3759
- * The cost of this specific fee, including any applicable taxes.
3760
- * @example 120
3590
+ * Timestamp when the payment was created in Lago's database, not on the payment provider.
3591
+ * @format date-time
3592
+ * @example "2025-01-21T00:10:29Z"
3761
3593
  */
3762
- total_amount_cents: number;
3594
+ created_at: string;
3595
+ }
3596
+ export interface PaymentsPaginated {
3597
+ payments: PaymentObject[];
3598
+ meta: PaginationMeta;
3599
+ }
3600
+ export interface PaymentRequestObject {
3763
3601
  /**
3764
- * The currency of this specific fee, including any applicable taxes.
3765
- * @example "EUR"
3602
+ * Unique identifier of the payment request, created by Lago.
3603
+ * @format uuid
3604
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3766
3605
  */
3767
- total_amount_currency: Currency;
3606
+ lago_id: string;
3768
3607
  /**
3769
- * The number of events that have been sent and used to charge the customer. This field indicates the count or quantity of events that have been processed and considered in the charging process.
3770
- * @example 1
3608
+ * The customer's email address used for sending dunning notifications
3609
+ * @format email
3610
+ * @example "dinesh@piedpiper.test"
3771
3611
  */
3772
- events_count?: number;
3612
+ email: string;
3773
3613
  /**
3774
- * Flag that indicates whether the fee was paid in advance. It serves as a boolean value, where `true` represents that the fee was paid in advance (straightaway), and `false` indicates that the fee was not paid in arrears (at the end of the period).
3775
- * @example true
3614
+ * The sum of the total amounts of all the invoices included in the payment request, expressed in cents.
3615
+ * @example 100
3776
3616
  */
3777
- pay_in_advance: boolean;
3617
+ amount_cents: number;
3778
3618
  /**
3779
- * Flag that indicates whether the fee was included on the invoice. It serves as a boolean value, where `true` represents that the fee was included on the invoice, and `false` indicates that the fee was not included on the invoice.
3780
- * @example true
3619
+ * The currency of the payment request.
3620
+ * @example "EUR"
3781
3621
  */
3782
- invoiceable: boolean;
3622
+ amount_currency: Currency;
3783
3623
  /**
3784
- * Indicates the payment status of the fee. It represents the current status of the payment associated with the fee. The value will always `pending`.
3785
- * @example "pending"
3624
+ * The status of the payment associated with the payment request. It can have one of the following values:
3625
+ * - `pending`: the payment is pending, waiting for payment processing in the payment provider or when the invoice is emitted but users have not updated the payment status through the endpoint.
3626
+ * - `succeeded`: the payment of the payment request has been successfully processed.
3627
+ * - `failed`: the payment of the payment request has failed or encountered an error during processing.
3628
+ * @example "succeeded"
3786
3629
  */
3787
- payment_status: "pending";
3788
- created_at?: null;
3789
- succeeded_at?: null;
3790
- failed_at?: null;
3791
- refunded_at?: null;
3630
+ payment_status: "pending" | "succeeded" | "failed";
3792
3631
  /**
3793
- * Unique identifier assigned to the transaction. This field is specifically displayed when the fee type is `charge` and the payment for the fee is made in advance (`pay_in_advance` is set to `true`).
3794
- * @example "transaction_1234567890"
3632
+ * The date and time when the payment request was created. It is expressed in UTC format according to the ISO 8601 datetime standard. This field provides the timestamp for the exact moment when the payment request was initially created.
3633
+ * @format date-time
3634
+ * @example "2022-04-29T08:59:51Z"
3795
3635
  */
3796
- event_transaction_id?: string;
3797
- amount_details?: null;
3798
- /** Item attached to the fee */
3799
- item: {
3800
- /**
3801
- * The fee type. The value will be `charge`.
3802
- * @example "charge"
3803
- */
3804
- type: "charge";
3805
- /**
3806
- * The code of the fee item. It will be the code of the `billable_metric`.
3807
- * @example "startup"
3808
- */
3809
- code: string;
3810
- /**
3811
- * The name of the fee item. It will be the name of the `billable_metric`.
3812
- * @example "Startup"
3813
- */
3814
- name: string;
3815
- /**
3816
- * The description of the fee item. It will be the name of the `billable_metric`.
3817
- * @example "Startup description"
3818
- */
3819
- description?: string;
3820
- /**
3821
- * 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.
3822
- * @example "Setup Fee (SF1)"
3823
- */
3824
- invoice_display_name?: string;
3825
- /**
3826
- * Specifies the name that will be displayed on an invoice. If no value is set for this field, the actual charge filter values will be used as the default display name.
3827
- * @example "AWS eu-east-1"
3828
- */
3829
- filter_invoice_display_name?: string | null;
3830
- /** Key value list of event properties */
3831
- filters?: object | null;
3832
- /**
3833
- * Unique identifier of the fee item, created by Lago. It will be the identifier of the `billable_metric`.
3834
- * @format uuid
3835
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3836
- */
3837
- lago_item_id: string;
3838
- /**
3839
- * The type of the fee item. Values is `BillableMetric`.
3840
- * @example "BillableMetric"
3841
- */
3842
- item_type: "BillableMetric";
3843
- /** Key value list of event properties aggregated by the charge model */
3844
- grouped_by?: Record<string, string>;
3845
- };
3846
- }
3847
- export interface FeesEstimate {
3848
- fees: FeeEstimateObject[];
3849
- }
3850
- export interface EventBatchEstimateInstantFeesInput {
3851
- events: EventEstimateInstantFeesInput[];
3852
- }
3853
- export interface Event {
3854
- event: EventObject;
3636
+ created_at: string;
3637
+ /** The customer on which the payment request applies. It refers to the customer account or entity associated with the payment request. */
3638
+ customer: CustomerBaseObject;
3639
+ invoices: InvoiceBaseObject[];
3855
3640
  }
3856
- export interface FeesPaginated {
3857
- fees: FeeObject[];
3641
+ export interface PaymentRequestsPaginated {
3642
+ payment_requests: PaymentRequestObject[];
3858
3643
  meta: PaginationMeta;
3859
3644
  }
3860
- export interface Fee {
3861
- fee: FeeObject;
3862
- }
3863
- export interface FeeUpdateInput {
3864
- fee: {
3865
- /**
3866
- * The payment status of the fee. Possible values are `pending`, `succeeded`, `failed` or `refunded`.
3867
- * @example "succeeded"
3868
- */
3869
- payment_status: "pending" | "succeeded" | "failed" | "refunded";
3870
- };
3871
- }
3872
- export interface InvoiceBaseObject {
3645
+ export interface SubscriptionObject {
3873
3646
  /**
3874
- * Unique identifier assigned to the fee within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the fee's record within the Lago system.
3647
+ * Unique identifier assigned to the subscription within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the subscription's record within the Lago system
3875
3648
  * @format uuid
3876
3649
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3877
3650
  */
3878
3651
  lago_id: string;
3879
3652
  /**
3880
- * The unique code of the billing entity associated with the invoice
3881
- * @example "acme_corp"
3653
+ * The subscription external unique identifier (provided by your own application).
3654
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
3882
3655
  */
3883
- billing_entity_code: string | null;
3656
+ external_id: string;
3884
3657
  /**
3885
- * This ID helps in uniquely identifying and organizing the invoices associated with a specific customer. It provides a sequential numbering system specific to the customer, allowing for easy tracking and management of invoices within the customer's context.
3886
- * @example 2
3658
+ * Unique identifier assigned to the customer within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the customer's record within the Lago system
3659
+ * @format uuid
3660
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3887
3661
  */
3888
- sequential_id?: number;
3662
+ lago_customer_id: string;
3889
3663
  /**
3890
- * The unique number assigned to the invoice. This number serves as a distinct identifier for the invoice and helps in differentiating it from other invoices in the system.
3891
- * @example "LAG-1234-001-002"
3664
+ * The customer external unique identifier (provided by your own application).
3665
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
3892
3666
  */
3893
- number: string;
3667
+ external_customer_id: string;
3894
3668
  /**
3895
- * The date when the invoice was issued. It is provided in the ISO 8601 date format.
3896
- * @format date
3897
- * @example "2022-04-30"
3669
+ * The billing time for the subscription, which can be set as either `anniversary` or `calendar`. If not explicitly provided, it will default to `calendar`. The billing time determines the timing of recurring billing cycles for the subscription. By specifying `anniversary`, the billing cycle will be based on the specific date the subscription started (billed fully), while `calendar` sets the billing cycle at the first day of the week/month/year (billed with proration).
3670
+ * @example "anniversary"
3898
3671
  */
3899
- issuing_date: string;
3672
+ billing_time: "calendar" | "anniversary";
3900
3673
  /**
3901
- * The date when the payment dispute was lost. It is expressed in Coordinated Universal Time (UTC).
3902
- * @format date-time
3903
- * @example "2022-09-14T16:35:31Z"
3674
+ * 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.
3675
+ * @example "Repository A"
3904
3676
  */
3905
- payment_dispute_lost_at?: string;
3677
+ name: string | null;
3906
3678
  /**
3907
- * The payment due date for the invoice, specified in the ISO 8601 date format.
3908
- * @format date
3909
- * @example "2022-04-30"
3679
+ * 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.
3680
+ * @example "premium"
3910
3681
  */
3911
- payment_due_date?: string;
3682
+ plan_code: string;
3912
3683
  /**
3913
- * Specifies if the payment is considered as overdue.
3914
- * @example true
3684
+ * The status of the subscription, which can have the following values:
3685
+ * - `active`: the subscription is currently active and applied to the customer.
3686
+ * - `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.
3687
+ * - `pending`: a previous subscription has been downgraded, and the current one is awaiting automatic activation at the end of the billing period.
3688
+ * - `terminated`: the subscription is no longer active.
3689
+ * @example "active"
3915
3690
  */
3916
- payment_overdue?: boolean;
3691
+ status: "active" | "canceled" | "pending" | "terminated";
3917
3692
  /**
3918
- * The net payment term, expressed in days, specifies the duration within which a customer is expected to remit payment after the invoice is finalized.
3919
- * @example 30
3693
+ * 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.
3694
+ * @format date-time
3695
+ * @example "2022-08-08T00:00:00Z"
3920
3696
  */
3921
- net_payment_term?: number;
3697
+ created_at: string;
3922
3698
  /**
3923
- * The type of invoice issued. Possible values are `subscription`, `one-off`, `credit` or `progressive_billing`.
3924
- * @example "subscription"
3699
+ * The cancellation date of the subscription. This field is not null when the subscription is `canceled`. This date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
3700
+ * @format date-time
3701
+ * @example "2022-09-14T16:35:31Z"
3925
3702
  */
3926
- invoice_type: "subscription" | "add_on" | "credit" | "one_off" | "progressive_billing";
3703
+ canceled_at: string | null;
3927
3704
  /**
3928
- * The status of the invoice. It indicates the current state of the invoice and can have following values:
3929
- * - `draft`: the invoice is in the draft state, waiting for the end of the grace period to be finalized. During this period, events can still be ingested and added to the invoice.
3930
- * - `finalized`: the invoice has been issued and finalized. In this state, events cannot be ingested or added to the invoice anymore.
3931
- * - `voided`: the invoice has been issued and subsequently voided. In this state, events cannot be ingested or added to the invoice anymore.
3932
- * - `pending`: the invoice remains pending until the taxes are fetched from the external provider.
3933
- * - `failed`: during an attempt of finalization of the invoice, an error happened. This invoice will have an array of error_details, explaining, in which part of the system an error happened and how it's possible to fix it. This invoice can't be edited or updated, only retried. This action will discard current error_details and will create new ones if the finalization failed again.
3934
- * @example "finalized"
3705
+ * 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).
3706
+ * @format date-time
3707
+ * @example "2022-08-08T00:00:00Z"
3935
3708
  */
3936
- status: "draft" | "finalized" | "voided" | "failed" | "pending";
3709
+ started_at: string | null;
3937
3710
  /**
3938
- * The status of the payment associated with the invoice. It can have one of the following values:
3939
- * - `pending`: the payment is pending, waiting for payment processing in Stripe or when the invoice is emitted but users have not updated the payment status through the endpoint.
3940
- * - `succeeded`: the payment of the invoice has been successfully processed.
3941
- * - `failed`: the payment of the invoice has failed or encountered an error during processing.
3942
- * @example "succeeded"
3711
+ * 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).
3712
+ * @format date-time
3713
+ * @example "2022-10-08T00:00:00Z"
3943
3714
  */
3944
- payment_status: "pending" | "succeeded" | "failed";
3715
+ ending_at: string | null;
3945
3716
  /**
3946
- * The currency of the invoice issued.
3947
- * @example "EUR"
3717
+ * 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).
3718
+ * @format date-time
3719
+ * @example "2022-08-08T00:00:00Z"
3948
3720
  */
3949
- currency: Currency;
3721
+ subscription_at: string;
3950
3722
  /**
3951
- * The total sum of fees amount in cents. It calculates the cumulative amount of all the fees associated with the invoice, providing a consolidated value.
3952
- * @example 100
3723
+ * The termination date of the subscription. This field is not null when the subscription is `terminated`. This date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC)
3724
+ * @format date-time
3725
+ * @example "2022-09-14T16:35:31Z"
3953
3726
  */
3954
- fees_amount_cents: number;
3727
+ terminated_at: string | null;
3955
3728
  /**
3956
- * The total sum of all coupons discounted on the invoice. It calculates the cumulative discount amount applied by coupons, expressed in cents.
3957
- * @example 10
3729
+ * The code identifying the previous plan associated with this subscription.
3730
+ * @example null
3958
3731
  */
3959
- coupons_amount_cents: number;
3732
+ previous_plan_code: string | null;
3960
3733
  /**
3961
- * The total sum of all credit notes discounted on the invoice. It calculates the cumulative discount amount applied by credit notes, expressed in cents.
3962
- * @example 10
3734
+ * The code identifying the next plan in the case of a downgrade.
3735
+ * @example null
3963
3736
  */
3964
- credit_notes_amount_cents: number;
3737
+ next_plan_code: string | null;
3965
3738
  /**
3966
- * Subtotal amount, excluding taxes, expressed in cents.
3967
- * This field depends on the version number. Here are the definitions based on the version:
3968
- * - Version 1: is equal to the sum of `fees_amount_cents`, minus `coupons_amount_cents`, and minus `prepaid_credit_amount_cents`.
3969
- * - Version 2: is equal to the `fees_amount_cents`.
3970
- * - Version 3 & 4: is equal to the `fees_amount_cents`, minus `coupons_amount_cents`
3971
- * @example 100
3739
+ * The date when the plan will be downgraded, represented in ISO 8601 date format.
3740
+ * @format date
3741
+ * @example "2022-04-30"
3972
3742
  */
3973
- sub_total_excluding_taxes_amount_cents: number;
3743
+ downgrade_plan_date: string | null;
3974
3744
  /**
3975
- * The sum of tax amount associated with the invoice, expressed in cents.
3976
- * @example 20
3745
+ * The date when the free trial is ended, represented in ISO 8601 date format.
3746
+ * @format date-time
3747
+ * @example "2022-08-08T00:00:00Z"
3977
3748
  */
3978
- taxes_amount_cents: number;
3749
+ trial_ended_at: string | null;
3979
3750
  /**
3980
- * Subtotal amount, including taxes, expressed in cents.
3981
- * This field depends on the version number. Here are the definitions based on the version:
3982
- * - Version 1: is equal to the `total_amount_cents`.
3983
- * - Version 2: is equal to the sum of `fees_amount_cents` and `taxes_amount_cents`.
3984
- * - Version 3 & 4: is equal to the sum `sub_total_excluding_taxes_amount_cents` and `taxes_amount_cents`
3985
- * @example 120
3751
+ * The date and time when the current billing period started, represented in ISO 8601 date format.
3752
+ * @format date-time
3753
+ * @example "2022-08-08T00:00:00Z"
3986
3754
  */
3987
- sub_total_including_taxes_amount_cents: number;
3755
+ current_billing_period_started_at: string | null;
3988
3756
  /**
3989
- * The total sum of all prepaid credits discounted on the invoice. It calculates the cumulative discount amount applied by prepaid credits, expressed in cents.
3990
- * @example 0
3757
+ * The date and time when the current billing period ends, represented in ISO 8601 date format.
3758
+ * @format date-time
3759
+ * @example "2022-09-08T00:00:00Z"
3991
3760
  */
3992
- prepaid_credit_amount_cents: number;
3761
+ current_billing_period_ending_at: string | null;
3993
3762
  /**
3994
- * The usage already billed in previous invoices. Only apply to `progressive_billing` and `subscription` invoices.
3995
- * @example 0
3763
+ * 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.
3764
+ * This field allows you to control the behavior of the credit note generation:
3765
+ *
3766
+ * - `credit`: A credit note is generated for the unused subscription time. The unused amount is credited back to the customer.
3767
+ * - `refund`: A credit note is generated for the unused subscription time. If the invoice is paid or partially paid, the unused paid amount is refunded; any unpaid unused amount is credited back to the customer.
3768
+ * - `skip`: No credit note is generated for the unused subscription time.
3769
+ *
3770
+ * _Note: This field is only applicable to pay-in-advance plans and will be `null` for pay-in-arrears plans._
3771
+ * @example "credit"
3996
3772
  */
3997
- progressive_billing_credit_amount_cents: number;
3773
+ on_termination_credit_note: "credit" | "refund" | "skip";
3998
3774
  /**
3999
- * The sum of the amount and taxes amount on the invoice, expressed in cents. It calculates the total financial value of the invoice, including both the original amount and any applicable taxes.
4000
- * @example 100
3775
+ * When a subscription is terminated before the end of its billing period, we generate an invoice for the unbilled usage.
3776
+ * This field allows you to control the behavior of the invoice generation:
3777
+ *
3778
+ * - `generate`: An invoice is generated for the unbilled usage.
3779
+ * - `skip`: No invoice is generated for the unbilled usage.
3780
+ * @default "generate"
3781
+ * @example "generate"
4001
3782
  */
4002
- total_amount_cents: number;
4003
- /** @example 3 */
4004
- version_number: number;
3783
+ on_termination_invoice: "generate" | "skip";
3784
+ }
3785
+ export interface SubscriptionsPaginated {
3786
+ subscriptions: SubscriptionObject[];
3787
+ meta: PaginationMeta;
3788
+ }
3789
+ /** Object that represents rule for wallet recurring transactions. */
3790
+ export interface WalletRecurringTransactionRule {
4005
3791
  /**
4006
- * Indicates if the invoice is self-billed. Self-billing is a process where an organization creates the invoice on behalf of the partner. This field specifies whether the invoice is self-billed or not.
4007
- * @example false
3792
+ * A unique identifier for the recurring transaction rule in the Lago application. Can be used to update a recurring transaction rule.
3793
+ * @format uuid
3794
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4008
3795
  */
4009
- self_billed?: boolean;
3796
+ lago_id: string;
4010
3797
  /**
4011
- * Contains the URL that provides direct access to the invoice PDF file. You can use this URL to download or view the PDF document of the invoice
4012
- * @format uri
4013
- * @example "https://getlago.com/invoice/file"
3798
+ * The trigger. Possible values are `interval` or `threshold`.
3799
+ * @example "interval"
4014
3800
  */
4015
- file_url?: string;
3801
+ trigger: "interval" | "threshold";
4016
3802
  /**
4017
- * The date of the invoice creation, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC). The creation_date provides a standardized and internationally recognized timestamp for when the invoice object was created
4018
- * @format date-time
4019
- * @example "2022-04-29T08:59:51Z"
3803
+ * The method used for recurring top-up. Possible values are `fixed` or `target`.
3804
+ * @example "target"
4020
3805
  */
4021
- created_at: string;
3806
+ method: "fixed" | "target";
4022
3807
  /**
4023
- * The date of the invoice update, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC). The update_date provides a standardized and internationally recognized timestamp for when the invoice object was updated
4024
- * @format date-time
4025
- * @example "2022-04-29T08:59:51Z"
3808
+ * The interval used for recurring top-up. It represents the frequency at which automatic top-up occurs. The interval can be one of the following values: `weekly`, `monthly`, `quarterly`, `semiannual` or `yearly`. Required only if trigger is set to `interval`.
3809
+ * @example "monthly"
4026
3810
  */
4027
- updated_at: string;
4028
- }
4029
- export interface BillingPeriodObject {
3811
+ interval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
4030
3812
  /**
4031
- * Unique identifier assigned to the subscription, created by Lago.
4032
- * @format uuid
4033
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3813
+ * The status of the recurring transaction rule. Possible values are `active` or `terminated`.
3814
+ * @example "active"
4034
3815
  */
4035
- lago_subscription_id: string;
3816
+ status: "active" | "terminated";
4036
3817
  /**
4037
- * Unique identifier assigned to the subscription in your application.
4038
- * @example "external_id"
3818
+ * The threshold for recurring top-ups is the value at which an automatic top-up is triggered. For example, if this threshold is set at 10 credits, an automatic top-up will occur whenever the wallet balance falls to or below 10 credits. Required only when trigger is set to `threshold`.
3819
+ * @pattern ^[0-9]+.?[0-9]*$
3820
+ * @example "20.0"
4039
3821
  */
4040
- external_subscription_id: string;
3822
+ threshold_credits: string;
4041
3823
  /**
4042
- * Unique identifier assigned to the plan, created by Lago.
4043
- * @format uuid
4044
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3824
+ * The number of paid credits. Required only if there is no granted credits.
3825
+ * @pattern ^[0-9]+.?[0-9]*$
3826
+ * @example "20.0"
4045
3827
  */
4046
- lago_plan_id: string;
3828
+ paid_credits: string;
4047
3829
  /**
4048
- * The beginning date of the subscription billing period. This field indicates the start date of the billing period associated with the subscription fee.
4049
- * @format date-time
4050
- * @example "2022-04-29T08:59:51Z"
3830
+ * The number of free granted credits. Required only if there is no paid credits.
3831
+ * @pattern ^[0-9]+.?[0-9]*$
3832
+ * @example "10.0"
4051
3833
  */
4052
- subscription_from_datetime: string;
3834
+ granted_credits: string;
4053
3835
  /**
4054
- * The ending date of the subscription billing period. This field indicates the end date of the billing period associated with the subscription fee.
3836
+ * The effective start date for recurring top-ups. This date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
4055
3837
  * @format date-time
4056
- * @example "2022-05-29T08:59:51Z"
3838
+ * @example "2022-08-08T00:00:00Z"
4057
3839
  */
4058
- subscription_to_datetime: string;
3840
+ started_at: string | null;
4059
3841
  /**
4060
- * The beginning date of the period that covers the charge fees. It is applicable only to the `charge` fees attached to the subscription. This field indicates the start date of the billing period or subscription period associated with the fees.
3842
+ * The target ongoing balance is the value set for the ongoing balance to be reached by the automatic top-up. Required only when trigger is set to `target`.
3843
+ * @pattern ^[0-9]+.?[0-9]*$
3844
+ * @example "200.0"
3845
+ */
3846
+ target_ongoing_balance: string | null;
3847
+ /**
3848
+ * The date of the metadata object creation, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC). The creation_date provides a standardized and internationally recognized timestamp for when the metadata object was created
4061
3849
  * @format date-time
4062
3850
  * @example "2022-04-29T08:59:51Z"
4063
3851
  */
4064
- charges_from_datetime: string;
3852
+ created_at: string;
4065
3853
  /**
4066
- * The ending date of the period that covers the charge fees. It is applicable only to the `charge` fees attached to the subscription. This field indicates the end date of the billing period or subscription period associated with the fees.
3854
+ * The expiration date and time for this specific recurring transaction rule. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
4067
3855
  * @format date-time
4068
- * @example "2022-05-29T08:59:51Z"
3856
+ * @example "2023-09-30T23:59:59Z"
4069
3857
  */
4070
- charges_to_datetime: string;
3858
+ expiration_at: string | null;
4071
3859
  /**
4072
- * The reason explaining why this subscription appears on the invoice.
4073
- * @example "subscription_starting"
3860
+ * A boolean setting that, when set to true, delays issuing an invoice for a wallet top-up until a successful payment is made; if false, the invoice is issued immediately upon wallet top-up, regardless of the payment status. Default value of false.
3861
+ * @example false
4074
3862
  */
4075
- invoicing_reason: "subscription_starting" | "subscription_periodic" | "subscription_terminating" | "in_advance_charge" | "in_advance_charge_periodic" | "progressive_billing";
3863
+ invoice_requires_successful_payment: boolean;
3864
+ /**
3865
+ * This field allows you to store a list of key-value pairs containing additional information or custom attributes. These key-value pairs will populate the metadata of the wallet transactions triggered by this rule.
3866
+ * @example [{"key":"example_key","value":"example_value"},{"key":"another_key","value":"another_value"}]
3867
+ */
3868
+ transaction_metadata: {
3869
+ /** The unique identifier for the attribute. */
3870
+ key?: string;
3871
+ /** The value associated with the key. */
3872
+ value?: string;
3873
+ }[];
3874
+ /**
3875
+ * The name of the wallet transactions triggered by this rule. 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`.
3876
+ * @example "Tokens for models 'high-fidelity-boost'"
3877
+ */
3878
+ transaction_name: string | null;
4076
3879
  }
4077
- export interface InvoiceMetadataObject {
3880
+ export interface WalletObject {
4078
3881
  /**
4079
- * Unique identifier assigned to the invoice metadata within the Lago application.
3882
+ * Unique identifier assigned to the wallet within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the wallet's record within the Lago system.
4080
3883
  * @format uuid
4081
3884
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4082
3885
  */
4083
- lago_id?: string;
3886
+ lago_id: string;
4084
3887
  /**
4085
- * Represents the key of the metadata's key-value pair.
4086
- * @example "digital_ref_id"
3888
+ * Unique identifier assigned to the customer within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the customer's record within the Lago system.
3889
+ * @format uuid
3890
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4087
3891
  */
4088
- key?: string;
3892
+ lago_customer_id: string;
4089
3893
  /**
4090
- * Represents the value of the metadata's key-value pair.
4091
- * @example "INV-0123456-98765"
3894
+ * The customer external unique identifier (provided by your own application)
3895
+ * @example "hooli_1234"
4092
3896
  */
4093
- value?: string;
3897
+ external_customer_id: string;
4094
3898
  /**
4095
- * The date and time when the metadata object was created. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
4096
- * @format date-time
4097
- * @example "2022-04-29T08:59:51Z"
3899
+ * The status of the wallet. Possible values are `active` or `terminated`.
3900
+ * @example "active"
4098
3901
  */
4099
- created_at?: string;
4100
- }
4101
- export type InvoiceAppliedTaxObject = BaseAppliedTax & {
3902
+ status: "active" | "terminated";
4102
3903
  /**
4103
- * Unique identifier of the invoice, created by Lago.
4104
- * @format uuid
4105
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3904
+ * The currency of the wallet.
3905
+ * @example "USD"
4106
3906
  */
4107
- lago_invoice_id?: string;
3907
+ currency: Currency;
4108
3908
  /**
4109
- * Fees total amount on which the tax is applied
4110
- * @example 20000
3909
+ * The name of the wallet.
3910
+ * @example "Prepaid"
4111
3911
  */
4112
- fees_amount_cents?: number;
4113
- };
4114
- export interface UsageThresholdObject {
3912
+ name?: string | null;
4115
3913
  /**
4116
- * Unique identifier of the usage threshold created by Lago.
4117
- * @format uuid
4118
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3914
+ * The rate of conversion between credits and the amount in the specified currency. It indicates the ratio or factor used to convert credits into the corresponding monetary value in the currency of the transaction.
3915
+ * @pattern ^[0-9]+.?[0-9]*$
3916
+ * @example "1.5"
4119
3917
  */
4120
- lago_id: string;
3918
+ rate_amount: string;
4121
3919
  /**
4122
- * The display name of the usage threshold.
4123
- * @example "Threshold 1"
3920
+ * The current wallet balance expressed in credits. This reflects the available balance after all transactions are settled.
3921
+ * @pattern ^[0-9]+.?[0-9]*$
3922
+ * @example "28.0"
4124
3923
  */
4125
- threshold_display_name: string | null;
3924
+ credits_balance: string;
4126
3925
  /**
4127
- * The amount to reach to trigger a `progressive_billing` invoice.
4128
- * @example 10000
3926
+ * The current wallet balance expressed in cents. This reflects the available balance after all transactions are settled.
3927
+ * @example 1000
4129
3928
  */
4130
- amount_cents: number;
3929
+ balance_cents: number;
4131
3930
  /**
4132
- * 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.
4133
- * @example true
3931
+ * The number of consumed credits.
3932
+ * @pattern ^[0-9]+.?[0-9]*$
3933
+ * @example "2.0"
4134
3934
  */
4135
- recurring: boolean;
3935
+ consumed_credits: string;
4136
3936
  /**
4137
- * The date and time when the usage threshold was created. It is expressed in UTC format according to the ISO 8601 datetime standard.
3937
+ * The date of the wallet creation, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
4138
3938
  * @format date-time
4139
- * @example "2023-06-27T19:43:42Z"
3939
+ * @example "2022-04-29T08:59:51Z"
4140
3940
  */
4141
3941
  created_at: string;
4142
3942
  /**
4143
- * The date and time when the usage threshold was last updated. It is expressed in UTC format according to the ISO 8601 datetime standard.
3943
+ * The date and time that determines when the wallet will expire. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
4144
3944
  * @format date-time
4145
- * @example "2023-06-27T19:43:42Z"
3945
+ * @example null
4146
3946
  */
4147
- updated_at: string;
4148
- }
4149
- export interface AppliedUsageThresholdObject {
3947
+ expiration_at?: string | null;
4150
3948
  /**
4151
- * The amount of usage in cents that has been accumulated over the lifetime of the subscription.
4152
- * @example 2000
3949
+ * The date and time of the last balance top-up. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
3950
+ * @format date-time
3951
+ * @example "2022-04-29T08:59:51Z"
4153
3952
  */
4154
- lifetime_usage_amount_cents: number;
3953
+ last_balance_sync_at?: string | null;
4155
3954
  /**
4156
- * The date and time when the lifetime usage was computed. It is expressed in UTC format according to the ISO 8601 datetime standard.
3955
+ * The date and time of the last credits consumption. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
4157
3956
  * @format date-time
4158
- * @example "2025-03-31T12:31:44Z"
3957
+ * @example "2022-04-29T08:59:51Z"
4159
3958
  */
4160
- created_at: string;
4161
- usage_threshold: UsageThresholdObject;
4162
- }
4163
- export type InvoiceObject = InvoiceBaseObject & {
4164
- /** The customer on which the invoice applies. It refers to the customer account or entity associated with the invoice. */
4165
- customer?: CustomerObject;
4166
- billing_periods?: BillingPeriodObject[];
4167
- metadata?: InvoiceMetadataObject[];
4168
- applied_taxes?: InvoiceAppliedTaxObject[];
4169
- applied_usage_thresholds?: AppliedUsageThresholdObject[];
4170
- };
4171
- export interface InvoicesPaginated {
4172
- invoices: InvoiceObject[];
4173
- meta: PaginationMeta;
4174
- }
4175
- export interface InvoiceOneOffCreateInput {
4176
- invoice: {
3959
+ last_consumed_credit_at?: string | null;
3960
+ /**
3961
+ * The date of terminaison of the wallet. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
3962
+ * @format date-time
3963
+ * @example "2022-09-14T16:35:31Z"
3964
+ */
3965
+ terminated_at?: string | null;
3966
+ /**
3967
+ * A boolean setting that, when set to true, delays issuing an invoice for a wallet top-up until a successful payment is made; if false, the invoice is issued immediately upon wallet top-up, regardless of the payment status. Default value of false.
3968
+ * @example false
3969
+ */
3970
+ invoice_requires_successful_payment: boolean;
3971
+ /** Set wallet limitations to fee types. */
3972
+ applies_to?: {
4177
3973
  /**
4178
- * Unique identifier assigned to the customer in your application.
4179
- * @example "hooli_1234"
3974
+ * An array of fee types to which the wallet is applicable. By specifying the fee types in this field, you can restrict the wallet's usage to specific fee types only.
3975
+ * @example ["charge"]
4180
3976
  */
4181
- external_customer_id: string;
3977
+ fee_types?: ("charge" | "subscription" | "commitment")[];
4182
3978
  /**
4183
- * The currency of the invoice.
4184
- * @example "EUR"
3979
+ * An array of billable metric codes to which the wallet is applicable. By specifying the billable metric codes in this field, you can restrict the wallet's usage to specific metrics only.
3980
+ * @example ["bm1"]
4185
3981
  */
4186
- currency?: Currency;
4187
- fees: {
4188
- /**
4189
- * The code of the add-on used as invoice item.
4190
- * @example "setup_fee"
4191
- */
4192
- add_on_code: string;
4193
- /**
4194
- * 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.
4195
- * @example "Setup Fee (SF1)"
4196
- */
4197
- invoice_display_name?: string;
4198
- /**
4199
- * The amount of the fee per unit, expressed in cents. By default, the amount of the add-on is used.
4200
- * @example 12000
4201
- */
4202
- unit_amount_cents?: number | null;
4203
- /**
4204
- * The quantity of units associated with the fee. By default, only 1 unit is added to the invoice.
4205
- * @pattern ^[0-9]+.?[0-9]*$
4206
- * @example "2.5"
4207
- */
4208
- units?: string | null;
4209
- /**
4210
- * This is a description
4211
- * @example "The description of the fee line item in the invoice. By default, the description of the add-on is used."
4212
- */
4213
- description?: string | null;
4214
- /**
4215
- * The lower boundary of the invoice billing interval. The `from_datetime` should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
4216
- * @format date-time
4217
- * @example "2022-08-08T00:00:00Z"
4218
- */
4219
- from_datetime?: string;
4220
- /**
4221
- * The upper boundary of the invoice billing interval. The `to_datetime` should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
4222
- * @format date-time
4223
- * @example "2022-08-08T00:00:00Z"
4224
- */
4225
- to_datetime?: string;
4226
- /** List of unique code used to identify the taxes. */
4227
- tax_codes?: TaxCodes;
4228
- /**
4229
- * If true, the invoice will be created but not sent to the payment provider.
4230
- * @default false
4231
- * @example true
4232
- */
4233
- skip_psp?: boolean | null;
4234
- }[];
3982
+ billable_metric_codes?: string[];
4235
3983
  };
3984
+ /** List of recurring transaction rules. Currently, we only allow one recurring rule per wallet. */
3985
+ recurring_transaction_rules?: WalletRecurringTransactionRule[];
3986
+ /**
3987
+ * The ongoing wallet balance expressed in cents. This represents the `balance_cents` minus the `ongoing_usage_balance_cents`, showing the real time balance after accounting for current usage including taxes.
3988
+ * @example 800
3989
+ */
3990
+ ongoing_balance_cents: number;
3991
+ /**
3992
+ * The ongoing usage balance of the wallet, expressed in cents. This reflects all current usage and draft invoices including taxes.
3993
+ * @example 200
3994
+ */
3995
+ ongoing_usage_balance_cents: number;
3996
+ /**
3997
+ * The ongoing wallet balance expressed in credits. This represents the `credits_balance` minus the `credits_ongoing_usage_balance`, showing the real time balance after accounting for current usage including taxes.
3998
+ * @pattern ^[0-9]+.?[0-9]*$
3999
+ * @example "8.0"
4000
+ */
4001
+ credits_ongoing_balance: string;
4002
+ /**
4003
+ * The ongoing usage balance of the wallet, expressed in credits. This reflects all current usage and draft invoices including taxes.
4004
+ * @pattern ^[0-9]+.?[0-9]*$
4005
+ * @example "2.0"
4006
+ */
4007
+ credits_ongoing_usage_balance: string;
4008
+ }
4009
+ export interface WalletsPaginated {
4010
+ wallets: WalletObject[];
4011
+ meta: PaginationMeta;
4012
+ }
4013
+ /** Details about the pricing unit used for charge usage. */
4014
+ export interface UsagePricingUnitDetailsObject {
4015
+ /**
4016
+ * The amount in cents in the pricing unit.
4017
+ * @example 200
4018
+ */
4019
+ amount_cents: number;
4020
+ /**
4021
+ * The short name of the pricing unit.
4022
+ * @example "CR"
4023
+ */
4024
+ short_name: string;
4025
+ /**
4026
+ * The conversion rate from pricing units to the plan's currency.
4027
+ * @example "0.5"
4028
+ */
4029
+ conversion_rate: string;
4030
+ }
4031
+ /** Array of filter object, representing multiple dimensions for a charge item. */
4032
+ export type CustomerChargeFiltersUsageObject = {
4033
+ /**
4034
+ * The number of units consumed for a specific charge filter related to a charge item.
4035
+ * @pattern ^[0-9]+.?[0-9]*$
4036
+ * @example "0.9"
4037
+ */
4038
+ units?: string;
4039
+ /**
4040
+ * The amount in cents, tax excluded, consumed for a specific charge filter related to a charge item.
4041
+ * @example 1000
4042
+ */
4043
+ amount_cents?: number;
4044
+ /**
4045
+ * The quantity of usage events that have been recorded for a particular charge filter during the specified time period. These events may also be referred to as the number of transactions in some contexts.
4046
+ * @example 10
4047
+ */
4048
+ events_count?: number;
4049
+ /**
4050
+ * Specifies the name that will be displayed on an invoice.
4051
+ * @example "AWS eu-east-1"
4052
+ */
4053
+ invoice_display_name?: string;
4054
+ /** Details about the pricing unit used for charge usage. */
4055
+ pricing_unit_details?: UsagePricingUnitDetailsObject;
4056
+ /**
4057
+ * List of filter values applied to the usage.
4058
+ * @example {"region":["us-east-1"]}
4059
+ */
4060
+ values?: Record<string, string[]>;
4061
+ }[];
4062
+ /** Array of aggregated fees, grouped by the event properties defined in a `standard` charge model. */
4063
+ export type CustomerChargeGroupedUsageObject = {
4064
+ /**
4065
+ * The amount in cents, tax excluded, consumed for a specific group related to a charge item.
4066
+ * @example 1000
4067
+ */
4068
+ amount_cents?: number;
4069
+ /**
4070
+ * The quantity of usage events that have been recorded for a particular charge during the specified time period. These events may also be referred to as the number of transactions in some contexts.
4071
+ * @example 10
4072
+ */
4073
+ events_count?: number;
4074
+ /**
4075
+ * The number of units consumed for a specific group related to a charge item.
4076
+ * @pattern ^[0-9]+.?[0-9]*$
4077
+ * @example "0.9"
4078
+ */
4079
+ units?: string;
4080
+ /** Details about the pricing unit used for charge usage. */
4081
+ pricing_unit_details?: UsagePricingUnitDetailsObject;
4082
+ /** Key value list of event properties aggregated by the charge model */
4083
+ grouped_by?: Record<string, string>;
4084
+ /** Array of filter object, representing multiple dimensions for a charge item. */
4085
+ filters?: CustomerChargeFiltersUsageObject;
4086
+ }[];
4087
+ export interface CustomerChargeUsageObject {
4088
+ /**
4089
+ * The number of units consumed by the customer for a specific charge item.
4090
+ * @pattern ^[0-9]+.?[0-9]*$
4091
+ * @example "1.0"
4092
+ */
4093
+ units: string;
4094
+ /**
4095
+ * The quantity of usage events that have been recorded for a particular charge during the specified time period. These events may also be referred to as the number of transactions in some contexts.
4096
+ * @example 10
4097
+ */
4098
+ events_count: number;
4099
+ /**
4100
+ * The amount in cents, tax excluded, consumed by the customer for a specific charge item.
4101
+ * @example 123
4102
+ */
4103
+ amount_cents: number;
4104
+ /**
4105
+ * The currency of a usage item consumed by the customer.
4106
+ * @example "EUR"
4107
+ */
4108
+ amount_currency: Currency;
4109
+ /** Details about the pricing unit used for charge usage. */
4110
+ pricing_unit_details?: UsagePricingUnitDetailsObject;
4111
+ /** Object listing all the properties for a specific charge item. */
4112
+ charge: {
4113
+ /**
4114
+ * Unique identifier assigned to the charge within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the charge's record within the Lago system.
4115
+ * @format uuid
4116
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4117
+ */
4118
+ lago_id: string;
4119
+ /**
4120
+ * The pricing model applied to this charge. Possible values are standard, `graduated`, `percentage`, `package` or `volume`.
4121
+ * @example "graduated"
4122
+ */
4123
+ charge_model: "standard" | "graduated" | "package" | "percentage" | "volume";
4124
+ /**
4125
+ * 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.
4126
+ * @example "Setup"
4127
+ */
4128
+ invoice_display_name?: string;
4129
+ };
4130
+ /** The related billable metric object. */
4131
+ billable_metric: {
4132
+ /**
4133
+ * Unique identifier assigned to the billable metric within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the billable metric's record within the Lago system.
4134
+ * @format uuid
4135
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4136
+ */
4137
+ lago_id: string;
4138
+ /**
4139
+ * The name of the billable metric used for this charge.
4140
+ * @example "Storage"
4141
+ */
4142
+ name: string;
4143
+ /**
4144
+ * The code of the billable metric used for this charge.
4145
+ * @example "storage"
4146
+ */
4147
+ code: string;
4148
+ /**
4149
+ * The aggregation type of the billable metric used for this charge. Possible values are `count_agg`, `sum_agg`, `max_agg` or `unique_count_agg`.
4150
+ * @example "sum_agg"
4151
+ */
4152
+ aggregation_type: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg" | "weighted_sum_agg" | "latest_agg";
4153
+ };
4154
+ /** Array of filter object, representing multiple dimensions for a charge item. */
4155
+ filters?: CustomerChargeFiltersUsageObject;
4156
+ /** Array of aggregated fees, grouped by the event properties defined in a `standard` charge model. */
4157
+ grouped_usage?: CustomerChargeGroupedUsageObject;
4158
+ }
4159
+ export interface CustomerUsageObject {
4160
+ /**
4161
+ * The lower bound of the billing period, expressed in the ISO 8601 datetime format in Coordinated Universal Time (UTC).
4162
+ * @format date-time
4163
+ * @example "2022-07-01T00:00:00Z"
4164
+ */
4165
+ from_datetime: string;
4166
+ /**
4167
+ * The upper bound of the billing period, expressed in the ISO 8601 datetime format in Coordinated Universal Time (UTC).
4168
+ * @format date-time
4169
+ * @example "2022-07-31T23:59:59Z"
4170
+ */
4171
+ to_datetime: string;
4172
+ /**
4173
+ * The date of creation of the invoice.
4174
+ * @format date
4175
+ * @example "2022-08-01"
4176
+ */
4177
+ issuing_date: string;
4178
+ /**
4179
+ * A unique identifier associated with the invoice related to this particular usage record.
4180
+ * @format uuid
4181
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4182
+ */
4183
+ lago_invoice_id?: string | null;
4184
+ /**
4185
+ * The currency of the customer's current usage.
4186
+ * @example "EUR"
4187
+ */
4188
+ currency?: Currency;
4189
+ /**
4190
+ * The amount in cents, tax excluded.
4191
+ * @example 123
4192
+ */
4193
+ amount_cents: number;
4194
+ /**
4195
+ * The tax amount in cents.
4196
+ * @example 200
4197
+ */
4198
+ taxes_amount_cents: number;
4199
+ /**
4200
+ * The total amount in cents, tax included.
4201
+ * @example 123
4202
+ */
4203
+ total_amount_cents: number;
4204
+ /** Array of charges that comprise the current usage. It contains detailed information about individual charge items associated with the usage. */
4205
+ charges_usage: CustomerChargeUsageObject[];
4206
+ }
4207
+ export interface CustomerUsage {
4208
+ customer_usage: CustomerUsageObject;
4209
+ }
4210
+ export interface CustomerProjectedUsageObject {
4211
+ /**
4212
+ * The lower bound of the billing period, expressed in the ISO 8601 datetime format in Coordinated Universal Time (UTC).
4213
+ * @format date-time
4214
+ * @example "2022-07-01T00:00:00Z"
4215
+ */
4216
+ from_datetime: string;
4217
+ /**
4218
+ * The upper bound of the billing period, expressed in the ISO 8601 datetime format in Coordinated Universal Time (UTC).
4219
+ * @format date-time
4220
+ * @example "2022-07-31T23:59:59Z"
4221
+ */
4222
+ to_datetime: string;
4223
+ /**
4224
+ * The date of creation of the invoice.
4225
+ * @format date
4226
+ * @example "2022-08-01"
4227
+ */
4228
+ issuing_date: string;
4229
+ /**
4230
+ * A unique identifier associated with the invoice related to this particular usage record.
4231
+ * @format uuid
4232
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4233
+ */
4234
+ lago_invoice_id?: string | null;
4235
+ /**
4236
+ * The currency of the customer's current usage.
4237
+ * @example "EUR"
4238
+ */
4239
+ currency?: Currency;
4240
+ /**
4241
+ * The amount in cents, tax excluded.
4242
+ * @example 123
4243
+ */
4244
+ amount_cents: number;
4245
+ /**
4246
+ * The projected amount in cents, tax excluded.
4247
+ * @example 256
4248
+ */
4249
+ projected_amount_cents: number;
4250
+ /**
4251
+ * The tax amount in cents.
4252
+ * @example 200
4253
+ */
4254
+ taxes_amount_cents: number;
4255
+ /**
4256
+ * The total amount in cents, tax included.
4257
+ * @example 123
4258
+ */
4259
+ total_amount_cents: number;
4260
+ /** Array of charges that comprise the current usage. It contains detailed information about individual charge items associated with the usage. */
4261
+ charges_usage: CustomerChargeUsageObject[];
4262
+ }
4263
+ export interface CustomerProjectedUsage {
4264
+ customer_projected_usage: CustomerProjectedUsageObject;
4265
+ }
4266
+ export interface CustomerPastUsage {
4267
+ usage_periods: CustomerUsage[];
4268
+ meta: PaginationMeta;
4269
+ }
4270
+ /** . */
4271
+ export interface CustomerCheckoutUrl {
4272
+ customer?: {
4273
+ /**
4274
+ * Unique identifier assigned to the customer within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the customer's record within the Lago system
4275
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4276
+ */
4277
+ lago_customer_id: string;
4278
+ /**
4279
+ * The customer external unique identifier (provided by your own application)
4280
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4281
+ */
4282
+ external_customer_id: string;
4283
+ /**
4284
+ * The Payment Provider name linked to the Customer.
4285
+ * @example "stripe"
4286
+ */
4287
+ payment_provider: string;
4288
+ /**
4289
+ * Code of the payment provider
4290
+ * @example "Stripe Prod"
4291
+ */
4292
+ payment_provider_code?: string;
4293
+ /**
4294
+ * The new generated Payment Provider Checkout URL for the Customer.
4295
+ * @example "https://foo.bar"
4296
+ */
4297
+ checkout_url?: string;
4298
+ };
4299
+ }
4300
+ export interface EventObject {
4301
+ /**
4302
+ * Unique identifier assigned to the event within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the event's record within the Lago system
4303
+ * @format uuid
4304
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4305
+ */
4306
+ lago_id: string;
4307
+ /**
4308
+ * This field represents a unique identifier for the event. It is crucial for ensuring idempotency, meaning that each event can be uniquely identified and processed without causing any unintended side effects.
4309
+ * @example "transaction_1234567890"
4310
+ */
4311
+ transaction_id: string;
4312
+ /**
4313
+ * Unique identifier assigned to the customer within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the customer's record within the Lago system
4314
+ * @format uuid
4315
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4316
+ */
4317
+ lago_customer_id: string | null;
4318
+ /**
4319
+ * The code that identifies a targeted billable metric. It is essential that this code matches the `code` property of one of your active billable metrics. If the provided code does not correspond to any active billable metric, it will be ignored during the process.
4320
+ * @example "storage"
4321
+ */
4322
+ code: string;
4323
+ /**
4324
+ * This field captures the Unix timestamp in seconds indicating the occurrence of the event in Coordinated Universal Time (UTC). If this timestamp is not provided, the API will automatically set it to the time of event reception.
4325
+ * @format date-time
4326
+ * @example "2022-04-29T08:59:51.123Z"
4327
+ */
4328
+ timestamp: string;
4329
+ /**
4330
+ * The precise total amount that was sent in the event payload. This filed is used by the `dynamic` pricing model.
4331
+ * @example "1234.56"
4332
+ */
4333
+ precise_total_amount_cents?: string | null;
4334
+ /**
4335
+ * This field represents additional properties associated with the event, which are utilized in the calculation of the final fee. This object becomes mandatory when the targeted billable metric employs a `sum_agg`, `max_agg`, or `unique_count_agg` aggregation method. However, when using a simple `count_agg`, this object is not required.
4336
+ * @example {"gb":10}
4337
+ */
4338
+ properties?: {
4339
+ /** The `operation_type` field is only necessary when adding or removing a specific unit when the targeted billable metric adopts a `unique_count_agg` aggregation method. In other cases, the `operation_type` field is not required. The valid values for the `operation_type` field are `add` or `remove`, which indicate whether the unit is being added or removed from the unique count aggregation, respectively. */
4340
+ operation_type?: "add" | "remove";
4341
+ [key: string]: any;
4342
+ };
4343
+ /**
4344
+ * Unique identifier assigned to the subscription within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the subscription's record within the Lago system
4345
+ * @format uuid
4346
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4347
+ */
4348
+ lago_subscription_id: string | null;
4349
+ /**
4350
+ * The unique identifier of the subscription within your application. It is a mandatory field when the customer possesses multiple subscriptions or when the `external_customer_id` is not provided.
4351
+ * @example "sub_1234567890"
4352
+ */
4353
+ external_subscription_id: string;
4354
+ /**
4355
+ * The creation date of the event's record in the Lago application, presented in the ISO 8601 datetime format, specifically in Coordinated Universal Time (UTC). It provides the precise timestamp of when the event's record was created within the Lago application
4356
+ * @format date-time
4357
+ * @example "2022-04-29T08:59:51Z"
4358
+ */
4359
+ created_at: string;
4360
+ }
4361
+ export interface EventsPaginated {
4362
+ events: EventObject[];
4363
+ meta: PaginationMeta;
4364
+ }
4365
+ export interface EventInputObject {
4366
+ /**
4367
+ * This field represents a unique identifier for the event.
4368
+ * It is crucial for ensuring idempotency, meaning that each event can be uniquely identified and processed without causing any unintended side effects.
4369
+ *
4370
+ * WARNING: If the Lago organization is configured to use the new Clickhouse-based event pipeline (designed for high-volume processing), the idempotency logic is handled differently.
4371
+ * Event uniqueness is maintained with both `transaction_id` and `timestamp` fields.
4372
+ * If a new event arrives with identical values for these two fields as an existing event, the new one will overwrite the previous event rather than being rejected.
4373
+ * @example "transaction_1234567890"
4374
+ */
4375
+ transaction_id: string;
4376
+ /**
4377
+ * The unique identifier of the subscription in your application. This field is mandatory in order to link events to the correct customer subscription.
4378
+ * @example "sub_1234567890"
4379
+ */
4380
+ external_subscription_id: string;
4381
+ /**
4382
+ * The code that identifies a targeted billable metric. It is essential that this code matches the `code` property of one of your active billable metrics. If the provided code does not correspond to any active billable metric, it will be ignored during the process.
4383
+ * @example "storage"
4384
+ */
4385
+ code: string;
4386
+ /**
4387
+ * This field captures the Unix timestamp in seconds indicating the occurrence of the event in Coordinated Universal Time (UTC).
4388
+ * If this timestamp is not provided, the API will automatically set it to the time of event reception.
4389
+ * You can also provide miliseconds precision by appending decimals to the timestamp.
4390
+ * @example "1651240791.123"
4391
+ */
4392
+ timestamp?: number | string;
4393
+ /**
4394
+ * The precise total amount in cents with precision used by the `dynamic` pricing model to compute the usage amount.
4395
+ * @example "1234.56"
4396
+ */
4397
+ precise_total_amount_cents?: string | null;
4398
+ /**
4399
+ * This field represents additional properties associated with the event, which are utilized in the calculation of the final fee. This object becomes mandatory when the targeted billable metric employs a `sum_agg`, `max_agg`, or `unique_count_agg` aggregation method. However, when using a simple `count_agg`, this object is not required.
4400
+ * @example {"gb":10}
4401
+ */
4402
+ properties?: object | null;
4236
4403
  }
4237
- export interface SubscriptionObject {
4404
+ export interface EventInput {
4405
+ event: EventInputObject;
4406
+ }
4407
+ export interface EventCreated {
4408
+ event: EventObject & {
4409
+ /**
4410
+ * The value will always be null in this response as the event processing is done asynchronously
4411
+ * @example null
4412
+ */
4413
+ lago_customer_id?: null;
4414
+ };
4415
+ }
4416
+ export interface EventBatchInput {
4417
+ events: EventInputObject[];
4418
+ }
4419
+ export interface EventsCreated {
4420
+ events: (EventObject & {
4421
+ /**
4422
+ * The value will always be null in this response as the event processing is done asynchronously
4423
+ * @example null
4424
+ */
4425
+ lago_customer_id?: null;
4426
+ })[];
4427
+ }
4428
+ export interface EventEstimateFeesInput {
4429
+ event: {
4430
+ /**
4431
+ * The code that identifies a targeted billable metric. It is essential that this code matches the `code` property of one of your active billable metrics. If the provided code does not correspond to any active billable metric, it will be ignored during the process.
4432
+ * @example "storage"
4433
+ */
4434
+ code: string;
4435
+ /**
4436
+ * The unique identifier of the subscription within your application.
4437
+ * @example "sub_1234567890"
4438
+ */
4439
+ external_subscription_id: string;
4440
+ /** This field represents additional properties associated with the event, which are utilized in the calculation of the final fee. This object becomes mandatory when the targeted billable metric employs a `sum_agg`, `max_agg`, or `unique_count_agg` aggregation method. However, when using a simple `count_agg`, this object is not required. */
4441
+ properties?: object;
4442
+ };
4443
+ }
4444
+ export interface Fees {
4445
+ fees: FeeObject[];
4446
+ }
4447
+ export interface EventEstimateInstantFeesInput {
4448
+ event: {
4449
+ /**
4450
+ * The code that identifies a targeted billable metric. It is essential that this code matches the `code` property of one of your active billable metrics. If the provided code does not correspond to any active billable metric, it will be ignored during the process.
4451
+ * @example "storage"
4452
+ */
4453
+ code: string;
4454
+ /**
4455
+ * The unique identifier of the subscription within your application.
4456
+ * @example "sub_1234567890"
4457
+ */
4458
+ external_subscription_id: string;
4459
+ /** This field represents additional properties associated with the event, which are utilized in the calculation of the final fee. This object becomes mandatory when the targeted billable metric employs a `sum_agg`, `max_agg`, or `unique_count_agg` aggregation method. However, when using a simple `count_agg`, this object is not required. */
4460
+ properties?: object;
4461
+ /**
4462
+ * This field represents a unique identifier for the event.
4463
+ * @example "transaction_1234567890"
4464
+ */
4465
+ transaction_id?: string | null;
4466
+ };
4467
+ }
4468
+ export interface FeeEstimateObject {
4469
+ lago_id?: null;
4238
4470
  /**
4239
- * Unique identifier assigned to the subscription within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the subscription's record within the Lago system
4471
+ * Unique identifier assigned to the charge that the fee belongs to
4240
4472
  * @format uuid
4241
4473
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4242
4474
  */
4243
- lago_id: string;
4475
+ lago_charge_id?: string;
4244
4476
  /**
4245
- * The subscription external unique identifier (provided by your own application).
4246
- * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4477
+ * Unique identifier assigned to the charge filter that the fee belongs to
4478
+ * @format uuid
4479
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4247
4480
  */
4248
- external_id: string;
4481
+ lago_charge_filter_id?: string | null;
4482
+ lago_invoice_id?: null;
4483
+ lago_true_up_fee_id?: null;
4484
+ lago_true_up_parent_fee_id?: null;
4249
4485
  /**
4250
- * Unique identifier assigned to the customer within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the customer's record within the Lago system
4486
+ * Unique identifier assigned to the subscription, created by Lago. This field is specifically displayed when the fee type is charge or subscription.
4251
4487
  * @format uuid
4252
4488
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4253
4489
  */
4254
- lago_customer_id: string;
4490
+ lago_subscription_id?: string;
4255
4491
  /**
4256
- * The customer external unique identifier (provided by your own application).
4257
- * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4492
+ * Unique identifier assigned to the customer, created by Lago. This field is specifically displayed when the fee type is charge or subscription.
4493
+ * @format uuid
4494
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4258
4495
  */
4259
- external_customer_id: string;
4496
+ lago_customer_id?: string;
4260
4497
  /**
4261
- * The billing time for the subscription, which can be set as either `anniversary` or `calendar`. If not explicitly provided, it will default to `calendar`. The billing time determines the timing of recurring billing cycles for the subscription. By specifying `anniversary`, the billing cycle will be based on the specific date the subscription started (billed fully), while `calendar` sets the billing cycle at the first day of the week/month/year (billed with proration).
4262
- * @example "anniversary"
4498
+ * Unique identifier assigned to the customer in your application. This field is specifically displayed when the fee type is charge or subscription.
4499
+ * @example "external_id"
4263
4500
  */
4264
- billing_time: "calendar" | "anniversary";
4501
+ external_customer_id?: string;
4265
4502
  /**
4266
- * 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
- * @example "Repository A"
4503
+ * Unique identifier assigned to the subscription in your application. This field is specifically displayed when the fee type is charge or subscription.
4504
+ * @example "external_id"
4268
4505
  */
4269
- name?: string | null;
4506
+ external_subscription_id?: string;
4270
4507
  /**
4271
- * 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
- * @example "premium"
4508
+ * The cost of this specific fee, excluding any applicable taxes.
4509
+ * @example 100
4273
4510
  */
4274
- plan_code: string;
4511
+ amount_cents: number;
4275
4512
  /**
4276
- * 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
- * - `active`: the subscription is currently active and applied to the customer.
4279
- * - `terminated`: the subscription is no longer active.
4280
- * - `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.
4281
- * @example "active"
4513
+ * The cost of this specific fee, excluding any applicable taxes, with precision.
4514
+ * @example 1.0001
4282
4515
  */
4283
- status: "active" | "pending" | "terminated" | "canceled";
4516
+ precise_amount?: number;
4284
4517
  /**
4285
- * 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
- * @format date-time
4287
- * @example "2022-08-08T00:00:00Z"
4518
+ * The cost of this specific fee, including any applicable taxes, with precision.
4519
+ * @example 1.0212
4288
4520
  */
4289
- created_at: string;
4521
+ precise_total_amount?: number;
4290
4522
  /**
4291
- * The cancellation date of the subscription. This field is not null when the subscription is `canceled`. This date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
4292
- * @format date-time
4293
- * @example "2022-09-14T16:35:31Z"
4523
+ * The currency of this specific fee. It indicates the monetary unit in which the fee's cost is expressed.
4524
+ * @example "EUR"
4294
4525
  */
4295
- canceled_at?: string | null;
4526
+ amount_currency: Currency;
4296
4527
  /**
4297
- * 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
- * @format date-time
4299
- * @example "2022-08-08T00:00:00Z"
4528
+ * The cost of the tax associated with this specific fee.
4529
+ * @example 0
4300
4530
  */
4301
- started_at?: string | null;
4531
+ taxes_amount_cents: number;
4302
4532
  /**
4303
- * 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
- * @format date-time
4305
- * @example "2022-10-08T00:00:00Z"
4533
+ * The cost of the tax associated with this specific fee, with precision.
4534
+ * @example 0
4306
4535
  */
4307
- ending_at?: string | null;
4536
+ taxes_precise_amount?: number;
4308
4537
  /**
4309
- * 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
- * @format date-time
4311
- * @example "2022-08-08T00:00:00Z"
4538
+ * The tax rate associated with this specific fee.
4539
+ * @example 20
4312
4540
  */
4313
- subscription_at: string;
4541
+ taxes_rate: number;
4314
4542
  /**
4315
- * The termination date of the subscription. This field is not null when the subscription is `terminated`. This date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC)
4316
- * @format date-time
4317
- * @example "2022-09-14T16:35:31Z"
4543
+ * The number of units used to charge the customer. This field indicates the quantity or count of units consumed or utilized in the context of the charge. It helps in determining the basis for calculating the fee or cost associated with the usage of the service or product provided to the customer.
4544
+ * @example "0.32"
4318
4545
  */
4319
- terminated_at?: string | null;
4546
+ units: string;
4547
+ description?: null;
4320
4548
  /**
4321
- * The code identifying the previous plan associated with this subscription.
4322
- * @example null
4549
+ * The unit amount of the fee per unit, with precision.
4550
+ * @example 312.5
4323
4551
  */
4324
- previous_plan_code?: string | null;
4552
+ precise_unit_amount: number;
4325
4553
  /**
4326
- * The code identifying the next plan in the case of a downgrade.
4327
- * @example null
4554
+ * The coupon amount applied to the estimated instant fee. It will always returns 0
4555
+ * @example "0.0"
4328
4556
  */
4329
- next_plan_code?: string | null;
4557
+ precise_coupons_amount_cents?: string;
4330
4558
  /**
4331
- * The date when the plan will be downgraded, represented in ISO 8601 date format.
4332
- * @format date
4333
- * @example "2022-04-30"
4559
+ * The cost of this specific fee, including any applicable taxes.
4560
+ * @example 120
4334
4561
  */
4335
- downgrade_plan_date?: string | null;
4562
+ total_amount_cents: number;
4336
4563
  /**
4337
- * The date when the free trial is ended, represented in ISO 8601 date format.
4338
- * @format date-time
4339
- * @example "2022-08-08T00:00:00Z"
4564
+ * The currency of this specific fee, including any applicable taxes.
4565
+ * @example "EUR"
4340
4566
  */
4341
- trial_ended_at?: string | null;
4567
+ total_amount_currency: Currency;
4342
4568
  /**
4343
- * The date and time when the current billing period started, represented in ISO 8601 date format.
4344
- * @format date-time
4345
- * @example "2022-08-08T00:00:00Z"
4569
+ * The number of events that have been sent and used to charge the customer. This field indicates the count or quantity of events that have been processed and considered in the charging process.
4570
+ * @example 1
4346
4571
  */
4347
- current_billing_period_started_at?: string | null;
4572
+ events_count?: number;
4348
4573
  /**
4349
- * The date and time when the current billing period ends, represented in ISO 8601 date format.
4350
- * @format date-time
4351
- * @example "2022-09-08T00:00:00Z"
4574
+ * Flag that indicates whether the fee was paid in advance. It serves as a boolean value, where `true` represents that the fee was paid in advance (straightaway), and `false` indicates that the fee was not paid in arrears (at the end of the period).
4575
+ * @example true
4352
4576
  */
4353
- current_billing_period_ending_at?: string | null;
4577
+ pay_in_advance: boolean;
4354
4578
  /**
4355
- * 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
- * This field allows you to control the behavior of the credit note generation:
4357
- *
4358
- * - `credit`: A credit note is generated for the unused subscription time. The unused amount is credited back to the customer.
4359
- * - `refund`: A credit note is generated for the unused subscription time. If the invoice is paid or partially paid, the unused paid amount is refunded; any unpaid unused amount is credited back to the customer.
4360
- * - `skip`: No credit note is generated for the unused subscription time.
4361
- *
4362
- * _Note: This field is only applicable to pay-in-advance plans and will be `null` for pay-in-arrears plans._
4363
- * @example "credit"
4579
+ * Flag that indicates whether the fee was included on the invoice. It serves as a boolean value, where `true` represents that the fee was included on the invoice, and `false` indicates that the fee was not included on the invoice.
4580
+ * @example true
4364
4581
  */
4365
- on_termination_credit_note: "credit" | "refund" | "skip";
4582
+ invoiceable: boolean;
4366
4583
  /**
4367
- * When a subscription is terminated before the end of its billing period, we generate an invoice for the unbilled usage.
4368
- * This field allows you to control the behavior of the invoice generation:
4369
- *
4370
- * - `generate`: An invoice is generated for the unbilled usage.
4371
- * - `skip`: No invoice is generated for the unbilled usage.
4372
- * @default "generate"
4373
- * @example "generate"
4584
+ * Indicates the payment status of the fee. It represents the current status of the payment associated with the fee. The value will always `pending`.
4585
+ * @example "pending"
4374
4586
  */
4375
- on_termination_invoice: "generate" | "skip";
4587
+ payment_status: "pending";
4588
+ created_at?: null;
4589
+ succeeded_at?: null;
4590
+ failed_at?: null;
4591
+ refunded_at?: null;
4592
+ /**
4593
+ * Unique identifier assigned to the transaction. This field is specifically displayed when the fee type is `charge` and the payment for the fee is made in advance (`pay_in_advance` is set to `true`).
4594
+ * @example "transaction_1234567890"
4595
+ */
4596
+ event_transaction_id?: string;
4597
+ amount_details?: null;
4598
+ /** Item attached to the fee */
4599
+ item: {
4600
+ /**
4601
+ * The fee type. The value will be `charge`.
4602
+ * @example "charge"
4603
+ */
4604
+ type: "charge";
4605
+ /**
4606
+ * The code of the fee item. It will be the code of the `billable_metric`.
4607
+ * @example "startup"
4608
+ */
4609
+ code: string;
4610
+ /**
4611
+ * The name of the fee item. It will be the name of the `billable_metric`.
4612
+ * @example "Startup"
4613
+ */
4614
+ name: string;
4615
+ /**
4616
+ * The description of the fee item. It will be the name of the `billable_metric`.
4617
+ * @example "Startup description"
4618
+ */
4619
+ description?: string;
4620
+ /**
4621
+ * 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.
4622
+ * @example "Setup Fee (SF1)"
4623
+ */
4624
+ invoice_display_name?: string;
4625
+ /**
4626
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the actual charge filter values will be used as the default display name.
4627
+ * @example "AWS eu-east-1"
4628
+ */
4629
+ filter_invoice_display_name?: string | null;
4630
+ /** Key value list of event properties */
4631
+ filters?: object | null;
4632
+ /**
4633
+ * Unique identifier of the fee item, created by Lago. It will be the identifier of the `billable_metric`.
4634
+ * @format uuid
4635
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4636
+ */
4637
+ lago_item_id: string;
4638
+ /**
4639
+ * The type of the fee item. Values is `BillableMetric`.
4640
+ * @example "BillableMetric"
4641
+ */
4642
+ item_type: "BillableMetric";
4643
+ /** Key value list of event properties aggregated by the charge model */
4644
+ grouped_by?: Record<string, string>;
4645
+ };
4646
+ }
4647
+ export interface FeesEstimate {
4648
+ fees: FeeEstimateObject[];
4649
+ }
4650
+ export interface EventBatchEstimateInstantFeesInput {
4651
+ events: EventEstimateInstantFeesInput[];
4652
+ }
4653
+ export interface Event {
4654
+ event: EventObject;
4655
+ }
4656
+ export interface FeesPaginated {
4657
+ fees: FeeObject[];
4658
+ meta: PaginationMeta;
4659
+ }
4660
+ export interface Fee {
4661
+ fee: FeeObject;
4662
+ }
4663
+ export interface FeeUpdateInput {
4664
+ fee: {
4665
+ /**
4666
+ * The payment status of the fee. Possible values are `pending`, `succeeded`, `failed` or `refunded`.
4667
+ * @example "succeeded"
4668
+ */
4669
+ payment_status: "pending" | "succeeded" | "failed" | "refunded";
4670
+ };
4671
+ }
4672
+ export interface InvoiceOneOffCreateInput {
4673
+ invoice: {
4674
+ /**
4675
+ * Unique identifier assigned to the customer in your application.
4676
+ * @example "hooli_1234"
4677
+ */
4678
+ external_customer_id: string;
4679
+ /**
4680
+ * The currency of the invoice.
4681
+ * @example "EUR"
4682
+ */
4683
+ currency?: Currency;
4684
+ fees: {
4685
+ /**
4686
+ * The code of the add-on used as invoice item.
4687
+ * @example "setup_fee"
4688
+ */
4689
+ add_on_code: string;
4690
+ /**
4691
+ * 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.
4692
+ * @example "Setup Fee (SF1)"
4693
+ */
4694
+ invoice_display_name?: string;
4695
+ /**
4696
+ * The amount of the fee per unit, expressed in cents. By default, the amount of the add-on is used.
4697
+ * @example 12000
4698
+ */
4699
+ unit_amount_cents?: number | null;
4700
+ /**
4701
+ * The quantity of units associated with the fee. By default, only 1 unit is added to the invoice.
4702
+ * @pattern ^[0-9]+.?[0-9]*$
4703
+ * @example "2.5"
4704
+ */
4705
+ units?: string | null;
4706
+ /**
4707
+ * This is a description
4708
+ * @example "The description of the fee line item in the invoice. By default, the description of the add-on is used."
4709
+ */
4710
+ description?: string | null;
4711
+ /**
4712
+ * The lower boundary of the invoice billing interval. The `from_datetime` should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
4713
+ * @format date-time
4714
+ * @example "2022-08-08T00:00:00Z"
4715
+ */
4716
+ from_datetime?: string;
4717
+ /**
4718
+ * The upper boundary of the invoice billing interval. The `to_datetime` should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
4719
+ * @format date-time
4720
+ * @example "2022-08-08T00:00:00Z"
4721
+ */
4722
+ to_datetime?: string;
4723
+ /** List of unique code used to identify the taxes. */
4724
+ tax_codes?: TaxCodes;
4725
+ /**
4726
+ * If true, the invoice will be created but not sent to the payment provider.
4727
+ * @default false
4728
+ * @example true
4729
+ */
4730
+ skip_psp?: boolean | null;
4731
+ }[];
4732
+ };
4376
4733
  }
4377
4734
  export interface ErrorDetailObject {
4378
4735
  /**
@@ -4861,67 +5218,6 @@ export interface OrganizationObject {
4861
5218
  export interface Organization {
4862
5219
  organization: OrganizationObject;
4863
5220
  }
4864
- export interface PaymentObject {
4865
- /**
4866
- * Unique identifier of the payment, created by Lago.
4867
- * @format uuid
4868
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4869
- */
4870
- lago_id: string;
4871
- /**
4872
- * The unique identifier of the paid resource, created by Lago.
4873
- * @format uuid
4874
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4875
- */
4876
- lago_payable_id: string;
4877
- /**
4878
- * Unique identifier of the customer, created by Lago.
4879
- * @format uuid
4880
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4881
- */
4882
- lago_customer_id: string;
4883
- /**
4884
- * The status of the payment within the payment provider
4885
- * @example "processing"
4886
- */
4887
- status: string;
4888
- /**
4889
- * The customer external unique identifier (provided by your own application)
4890
- * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4891
- */
4892
- external_id?: string;
4893
- /**
4894
- * Unique identifier of the customer within the payment provider
4895
- * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4896
- */
4897
- provider_customer_id: string;
4898
- /**
4899
- * Code of the payment provider
4900
- * @example "Stripe Prod"
4901
- */
4902
- payment_provider_code?: string;
4903
- /**
4904
- * The type of payment provider
4905
- * @example "stripe"
4906
- */
4907
- payment_provider_type: "adyen" | "cashfree" | "gocardless" | "stripe";
4908
- /**
4909
- * Unique identifier of the payment within the payment provider
4910
- * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4911
- */
4912
- provider_payment_id: string;
4913
- next_action: Record<string, any>;
4914
- /**
4915
- * The amount of the payment in cents
4916
- * @example 1000
4917
- */
4918
- amount_cents?: number;
4919
- /**
4920
- * The currency of the payment
4921
- * @example "EUR"
4922
- */
4923
- amount_currency?: string;
4924
- }
4925
5221
  export interface PaymentReceiptObject {
4926
5222
  /**
4927
5223
  * Unique identifier of the payment receipt, created by Lago.
@@ -4949,51 +5245,6 @@ export interface PaymentReceiptsPaginated {
4949
5245
  export interface PaymentReceipt {
4950
5246
  payment_receipt: PaymentReceiptObject;
4951
5247
  }
4952
- export interface PaymentRequestObject {
4953
- /**
4954
- * Unique identifier of the payment request, created by Lago.
4955
- * @format uuid
4956
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4957
- */
4958
- lago_id: string;
4959
- /**
4960
- * The customer's email address used for sending dunning notifications
4961
- * @format email
4962
- * @example "dinesh@piedpiper.test"
4963
- */
4964
- email: string;
4965
- /**
4966
- * The sum of the total amounts of all the invoices included in the payment request, expressed in cents.
4967
- * @example 100
4968
- */
4969
- amount_cents: number;
4970
- /**
4971
- * The currency of the payment request.
4972
- * @example "EUR"
4973
- */
4974
- amount_currency: Currency;
4975
- /**
4976
- * The status of the payment associated with the payment request. It can have one of the following values:
4977
- * - `pending`: the payment is pending, waiting for payment processing in the payment provider or when the invoice is emitted but users have not updated the payment status through the endpoint.
4978
- * - `succeeded`: the payment of the payment request has been successfully processed.
4979
- * - `failed`: the payment of the payment request has failed or encountered an error during processing.
4980
- * @example "succeeded"
4981
- */
4982
- payment_status: "pending" | "succeeded" | "failed";
4983
- /**
4984
- * The date and time when the payment request was created. It is expressed in UTC format according to the ISO 8601 datetime standard. This field provides the timestamp for the exact moment when the payment request was initially created.
4985
- * @format date-time
4986
- * @example "2022-04-29T08:59:51Z"
4987
- */
4988
- created_at: string;
4989
- /** The customer on which the payment request applies. It refers to the customer account or entity associated with the payment request. */
4990
- customer: CustomerBaseObject;
4991
- invoices: InvoiceBaseObject[];
4992
- }
4993
- export interface PaymentRequestsPaginated {
4994
- payment_requests: PaymentRequestObject[];
4995
- meta: PaginationMeta;
4996
- }
4997
5248
  export interface PaymentRequestCreateInput {
4998
5249
  payment_request: {
4999
5250
  /**
@@ -5011,59 +5262,9 @@ export interface PaymentRequestCreateInput {
5011
5262
  lago_invoice_ids: string[];
5012
5263
  };
5013
5264
  }
5014
- export interface PaymentRequest {
5015
- payment_request: PaymentRequestObject;
5016
- }
5017
- export interface PaymentManualObject {
5018
- /**
5019
- * The unique identifier of the payment, created by Lago.
5020
- * @format uuid
5021
- * @example "4cf085a7-c196-4f07-a543-97c50ec6e8b2"
5022
- */
5023
- lago_id?: string;
5024
- /** List of invoice IDs associated with the payment. */
5025
- invoice_ids?: string[];
5026
- /**
5027
- * The amount of the payment in cents.
5028
- * @example 100
5029
- */
5030
- amount_cents?: number;
5031
- /**
5032
- * The currency of the payment amount.
5033
- * @example "USD"
5034
- */
5035
- amount_currency?: string;
5036
- /**
5037
- * The current status of the payment.
5038
- * @example "succeeded"
5039
- */
5040
- payment_status?: string;
5041
- /**
5042
- * The type of payment.
5043
- * @example "manual"
5044
- */
5045
- type?: string;
5046
- /**
5047
- * Reference for the payment.
5048
- * @example "ref1"
5049
- */
5050
- reference?: string;
5051
- /**
5052
- * External identifier for the payment (if applicable).
5053
- * @example null
5054
- */
5055
- external_payment_id?: string | null;
5056
- /**
5057
- * Timestamp when the payment was created.
5058
- * @format date-time
5059
- * @example "2025-02-20T00:00:00Z"
5060
- */
5061
- created_at?: string;
5062
- }
5063
- export interface PaymentsPaginated {
5064
- payments: PaymentManualObject[];
5065
- meta: PaginationMeta;
5066
- }
5265
+ export interface PaymentRequest {
5266
+ payment_request: PaymentRequestObject;
5267
+ }
5067
5268
  export interface PaymentCreateInput {
5068
5269
  payment: {
5069
5270
  /**
@@ -5090,7 +5291,7 @@ export interface PaymentCreateInput {
5090
5291
  };
5091
5292
  }
5092
5293
  export interface Payment {
5093
- payment: PaymentManualObject;
5294
+ payment: PaymentObject;
5094
5295
  }
5095
5296
  export interface MinimumCommitmentObject {
5096
5297
  /**
@@ -5115,10 +5316,10 @@ export interface MinimumCommitmentObject {
5115
5316
  */
5116
5317
  invoice_display_name?: string;
5117
5318
  /**
5118
- * The interval used for recurring billing. It represents the frequency at which subscription billing occurs. The interval can be one of the following values: `yearly`, `quarterly`, `monthly` or `weekly`.
5319
+ * The interval used for recurring billing. It represents the frequency at which subscription billing occurs. The interval can be one of the following values: `yearly`, `semiannual`, `quarterly`, `monthly` or `weekly`.
5119
5320
  * @example "monthly"
5120
5321
  */
5121
- interval?: "weekly" | "monthly" | "quarterly" | "yearly";
5322
+ interval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
5122
5323
  /**
5123
5324
  * The date and time when the minimum commitment was created. It is expressed in UTC format according to the ISO 8601 datetime standard. This field provides the timestamp for the exact moment when the minimum commitment was initially created.
5124
5325
  * @format date-time
@@ -5134,6 +5335,17 @@ export interface MinimumCommitmentObject {
5134
5335
  /** All taxes applied to the minimum commitment. */
5135
5336
  taxes?: TaxObject[];
5136
5337
  }
5338
+ /**
5339
+ * Specifies the pricing model used for the calculation of the final fee. It can be any of the following values:
5340
+ * - [`dynamic`](https://docs.getlago.com/guide/plans/charges/charge-models/dynamic)
5341
+ * - [`graduated_percentage`](https://docs.getlago.com/guide/plans/charges/charge-models/graduated-percentage)
5342
+ * - [`graduated`](https://docs.getlago.com/guide/plans/charges/charge-models/graduated)
5343
+ * - [`package`](https://docs.getlago.com/guide/plans/charges/charge-models/package)
5344
+ * - [`percentage`](https://docs.getlago.com/guide/plans/charges/charge-models/percentage)
5345
+ * - [`standard`](https://docs.getlago.com/guide/plans/charges/charge-models/standard)
5346
+ * - [`volume`](https://docs.getlago.com/guide/plans/charges/charge-models/volume)
5347
+ */
5348
+ export type ChargeModelEnum = "dynamic" | "graduated" | "graduated_percentage" | "package" | "percentage" | "standard" | "volume";
5137
5349
  export interface ChargeProperties {
5138
5350
  /**
5139
5351
  * The list of event properties that are used to group the events on the invoice for a `standard` charge model.
@@ -5325,8 +5537,17 @@ export interface ChargeObject {
5325
5537
  * @example "2022-09-14T16:35:31Z"
5326
5538
  */
5327
5539
  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";
5540
+ /**
5541
+ * Specifies the pricing model used for the calculation of the final fee. It can be any of the following values:
5542
+ * - [`dynamic`](https://docs.getlago.com/guide/plans/charges/charge-models/dynamic)
5543
+ * - [`graduated_percentage`](https://docs.getlago.com/guide/plans/charges/charge-models/graduated-percentage)
5544
+ * - [`graduated`](https://docs.getlago.com/guide/plans/charges/charge-models/graduated)
5545
+ * - [`package`](https://docs.getlago.com/guide/plans/charges/charge-models/package)
5546
+ * - [`percentage`](https://docs.getlago.com/guide/plans/charges/charge-models/percentage)
5547
+ * - [`standard`](https://docs.getlago.com/guide/plans/charges/charge-models/standard)
5548
+ * - [`volume`](https://docs.getlago.com/guide/plans/charges/charge-models/volume)
5549
+ */
5550
+ charge_model: ChargeModelEnum;
5330
5551
  /**
5331
5552
  * 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
5553
  * @example true
@@ -5405,7 +5626,7 @@ export interface PlanEntitlementObject {
5405
5626
  description: string | null;
5406
5627
  /**
5407
5628
  * 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"]}}]
5629
+ * @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
5630
  */
5410
5631
  privileges: PlanEntitlementPrivilegeObject[];
5411
5632
  }
@@ -5441,10 +5662,10 @@ export interface PlanObject {
5441
5662
  */
5442
5663
  code: string;
5443
5664
  /**
5444
- * The interval used for recurring billing. It represents the frequency at which subscription billing occurs. The interval can be one of the following values: `yearly`, `quarterly`, `monthly` or `weekly`.
5665
+ * The interval used for recurring billing. It represents the frequency at which subscription billing occurs. The interval can be one of the following values: `yearly`, `semiannual`, `quarterly`, `monthly` or `weekly`.
5445
5666
  * @example "monthly"
5446
5667
  */
5447
- interval: "weekly" | "monthly" | "quarterly" | "yearly";
5668
+ interval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
5448
5669
  /**
5449
5670
  * The description on the plan.
5450
5671
  * @example ""
@@ -5471,7 +5692,7 @@ export interface PlanObject {
5471
5692
  */
5472
5693
  pay_in_advance?: boolean;
5473
5694
  /**
5474
- * This field, when set to `true`, enables to invoice usage-based charges on monthly basis, even if the cadence of the plan is yearly. This allows customers to pay charges overage on a monthly basis. This can be set to true only if the plan's interval is `yearly`.
5695
+ * This field, when set to `true`, enables to invoice usage-based charges on monthly basis, even if the cadence of the plan is yearly or semiannual. This allows customers to pay charges overage on a monthly basis. This can be set to true only if the plan's interval is `yearly` or `semiannual`.
5475
5696
  * @example null
5476
5697
  */
5477
5698
  bill_charges_monthly?: boolean | null;
@@ -5523,12 +5744,6 @@ export interface ChargeFilterInput {
5523
5744
  values: Record<string, string[]>;
5524
5745
  }
5525
5746
  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
5747
  /**
5533
5748
  * The display name of the usage threshold.
5534
5749
  * @example "Threshold 1"
@@ -5541,9 +5756,10 @@ export interface UsageThresholdInput {
5541
5756
  amount_cents: number;
5542
5757
  /**
5543
5758
  * 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.
5759
+ * @default false
5544
5760
  * @example true
5545
5761
  */
5546
- recurring: boolean;
5762
+ recurring?: boolean;
5547
5763
  }
5548
5764
  export interface PlanCreateInput {
5549
5765
  plan: {
@@ -5563,10 +5779,10 @@ export interface PlanCreateInput {
5563
5779
  */
5564
5780
  code?: string;
5565
5781
  /**
5566
- * The interval used for recurring billing. It represents the frequency at which subscription billing occurs. The interval can be one of the following values: `yearly`, `quarterly`, `monthly`, or `weekly`.
5782
+ * The interval used for recurring billing. It represents the frequency at which subscription billing occurs. The interval can be one of the following values: `yearly`, `semiannual`, `quarterly`, `monthly`, or `weekly`.
5567
5783
  * @example "monthly"
5568
5784
  */
5569
- interval?: "weekly" | "monthly" | "quarterly" | "yearly";
5785
+ interval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
5570
5786
  /**
5571
5787
  * The description on the plan.
5572
5788
  * @example "Plan for early stage startups."
@@ -5593,7 +5809,7 @@ export interface PlanCreateInput {
5593
5809
  */
5594
5810
  pay_in_advance?: boolean;
5595
5811
  /**
5596
- * This field, when set to `true`, enables to invoice usage-based charges on monthly basis, even if the cadence of the plan is yearly. This allows customers to pay charges overage on a monthly basis. This can be set to true only if the plan's interval is `yearly`.
5812
+ * This field, when set to `true`, enables to invoice usage-based charges on monthly basis, even if the cadence of the plan is `yearly` or `semiannual`. This allows customers to pay charges overage on a monthly basis. This can be set to true only if the plan's interval is `yearly` or `semiannual`.
5597
5813
  * @example null
5598
5814
  */
5599
5815
  bill_charges_monthly?: boolean | null;
@@ -5613,10 +5829,16 @@ export interface PlanCreateInput {
5613
5829
  */
5614
5830
  billable_metric_id?: string;
5615
5831
  /**
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"
5832
+ * Specifies the pricing model used for the calculation of the final fee. It can be any of the following values:
5833
+ * - [`dynamic`](https://docs.getlago.com/guide/plans/charges/charge-models/dynamic)
5834
+ * - [`graduated_percentage`](https://docs.getlago.com/guide/plans/charges/charge-models/graduated-percentage)
5835
+ * - [`graduated`](https://docs.getlago.com/guide/plans/charges/charge-models/graduated)
5836
+ * - [`package`](https://docs.getlago.com/guide/plans/charges/charge-models/package)
5837
+ * - [`percentage`](https://docs.getlago.com/guide/plans/charges/charge-models/percentage)
5838
+ * - [`standard`](https://docs.getlago.com/guide/plans/charges/charge-models/standard)
5839
+ * - [`volume`](https://docs.getlago.com/guide/plans/charges/charge-models/volume)
5618
5840
  */
5619
- charge_model?: "standard" | "graduated" | "graduated_percentage" | "package" | "percentage" | "volume" | "dynamic";
5841
+ charge_model?: ChargeModelEnum;
5620
5842
  /**
5621
5843
  * 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
5844
  * @example false
@@ -5702,10 +5924,10 @@ export interface PlanUpdateInput {
5702
5924
  */
5703
5925
  code?: string;
5704
5926
  /**
5705
- * The interval used for recurring billing. It represents the frequency at which subscription billing occurs. The interval can be one of the following values: `yearly`, `quarterly`, `monthly`, or `weekly`.
5927
+ * The interval used for recurring billing. It represents the frequency at which subscription billing occurs. The interval can be one of the following values: `yearly`, `semiannual`, `quarterly`, `monthly`, or `weekly`.
5706
5928
  * @example "monthly"
5707
5929
  */
5708
- interval?: "weekly" | "monthly" | "quarterly" | "yearly";
5930
+ interval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
5709
5931
  /**
5710
5932
  * The description on the plan.
5711
5933
  * @example "Plan for early stage startups."
@@ -5732,7 +5954,7 @@ export interface PlanUpdateInput {
5732
5954
  */
5733
5955
  pay_in_advance?: boolean;
5734
5956
  /**
5735
- * This field, when set to `true`, enables to invoice usage-based charges on monthly basis, even if the cadence of the plan is yearly. This allows customers to pay charges overage on a monthly basis. This can be set to true only if the plan's interval is `yearly`.
5957
+ * This field, when set to `true`, enables to invoice usage-based charges on monthly basis, even if the cadence of the plan is yearly or semiannual. This allows customers to pay charges overage on a monthly basis. This can be set to true only if the plan's interval is `yearly` or `semiannual`.
5736
5958
  * @example null
5737
5959
  */
5738
5960
  bill_charges_monthly?: boolean | null;
@@ -5758,10 +5980,16 @@ export interface PlanUpdateInput {
5758
5980
  */
5759
5981
  billable_metric_id?: string;
5760
5982
  /**
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"
5983
+ * Specifies the pricing model used for the calculation of the final fee. It can be any of the following values:
5984
+ * - [`dynamic`](https://docs.getlago.com/guide/plans/charges/charge-models/dynamic)
5985
+ * - [`graduated_percentage`](https://docs.getlago.com/guide/plans/charges/charge-models/graduated-percentage)
5986
+ * - [`graduated`](https://docs.getlago.com/guide/plans/charges/charge-models/graduated)
5987
+ * - [`package`](https://docs.getlago.com/guide/plans/charges/charge-models/package)
5988
+ * - [`percentage`](https://docs.getlago.com/guide/plans/charges/charge-models/percentage)
5989
+ * - [`standard`](https://docs.getlago.com/guide/plans/charges/charge-models/standard)
5990
+ * - [`volume`](https://docs.getlago.com/guide/plans/charges/charge-models/volume)
5763
5991
  */
5764
- charge_model?: "standard" | "graduated" | "graduated_percentage" | "package" | "percentage" | "volume" | "dynamic";
5992
+ charge_model?: ChargeModelEnum;
5765
5993
  /**
5766
5994
  * 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
5995
  * @example false
@@ -5829,14 +6057,12 @@ export interface PlanUpdateInput {
5829
6057
  export interface PlanEntitlements {
5830
6058
  entitlements: PlanEntitlementObject[];
5831
6059
  }
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>>;
5837
- export interface SubscriptionsPaginated {
5838
- subscriptions: SubscriptionObject[];
5839
- meta: PaginationMeta;
6060
+ export interface EntitlementUpdateInput {
6061
+ /**
6062
+ * 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.
6063
+ * @example {"seats":{"max":20,"max_admins":10,"root":false},"sso":{"provider":"okta"}}
6064
+ */
6065
+ entitlements: Record<string, Record<string, number | boolean | string>>;
5840
6066
  }
5841
6067
  /** Based plan overrides. */
5842
6068
  export interface PlanOverridesObject {
@@ -5872,7 +6098,8 @@ export interface PlanOverridesObject {
5872
6098
  * @example 5
5873
6099
  */
5874
6100
  trial_period?: number;
5875
- minimum_commitment?: MinimumCommitmentObject;
6101
+ /** Minimum commitment for this plan. */
6102
+ minimum_commitment?: MinimumCommitmentInput;
5876
6103
  /** Additional usage-based charges for this plan. */
5877
6104
  charges?: {
5878
6105
  /**
@@ -5887,6 +6114,17 @@ export interface PlanOverridesObject {
5887
6114
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
5888
6115
  */
5889
6116
  billable_metric_id?: string;
6117
+ /**
6118
+ * Specifies the pricing model used for the calculation of the final fee. It can be any of the following values:
6119
+ * - [`dynamic`](https://docs.getlago.com/guide/plans/charges/charge-models/dynamic)
6120
+ * - [`graduated_percentage`](https://docs.getlago.com/guide/plans/charges/charge-models/graduated-percentage)
6121
+ * - [`graduated`](https://docs.getlago.com/guide/plans/charges/charge-models/graduated)
6122
+ * - [`package`](https://docs.getlago.com/guide/plans/charges/charge-models/package)
6123
+ * - [`percentage`](https://docs.getlago.com/guide/plans/charges/charge-models/percentage)
6124
+ * - [`standard`](https://docs.getlago.com/guide/plans/charges/charge-models/standard)
6125
+ * - [`volume`](https://docs.getlago.com/guide/plans/charges/charge-models/volume)
6126
+ */
6127
+ charge_model?: ChargeModelEnum;
5890
6128
  /**
5891
6129
  * 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
6130
  * @example "Setup"
@@ -5915,10 +6153,36 @@ export interface PlanOverridesObject {
5915
6153
  };
5916
6154
  }[];
5917
6155
  /** List of usage thresholds applied to the subscription. */
5918
- usage_thresholds?: UsageThresholdObject[];
6156
+ usage_thresholds?: UsageThresholdInput[];
5919
6157
  }
5920
6158
  export interface SubscriptionCreateInput {
5921
6159
  subscription: {
6160
+ /**
6161
+ * 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.
6162
+ *
6163
+ * Important notes:
6164
+ * - The final amount due for the subscription is not known at the time of creation; it is determined only after the invoice is finalized.
6165
+ * - The payment intent generated for pre-authorization cannot be reused, as the final invoice amount may exceed the authorized amount.
6166
+ * - The payment intent is canceled immediately after creation, but this cancellation occurs asynchronously.
6167
+ * - 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.
6168
+ */
6169
+ authorization?: {
6170
+ /**
6171
+ * The amount of the authorization in cents.
6172
+ * @example 1000
6173
+ */
6174
+ amount_cents: number;
6175
+ /**
6176
+ * The currency of the authorization.
6177
+ * @example "USD"
6178
+ */
6179
+ amount_currency: string;
6180
+ };
6181
+ /**
6182
+ * The code of the billing entity to be used for the subscription. If not provided, the default billing entity will be used.
6183
+ * @example "default"
6184
+ */
6185
+ billing_entity_code?: string;
5922
6186
  /**
5923
6187
  * The customer external unique identifier (provided by your own application)
5924
6188
  * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
@@ -6050,7 +6314,7 @@ export interface LifetimeUsageObject {
6050
6314
  * @format date-time
6051
6315
  * @example "2024-01-01T00:00:00Z"
6052
6316
  */
6053
- from_datetime: string;
6317
+ from_datetime: string | null;
6054
6318
  /**
6055
6319
  * The recording end date and time of the subscription lifetime usage. The date and time must be in ISO 8601 format.
6056
6320
  * @format date-time
@@ -6238,9 +6502,11 @@ export interface SubscriptionEntitlementObject {
6238
6502
  description: string | null;
6239
6503
  /**
6240
6504
  * 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"]}}]
6505
+ * @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
6506
  */
6243
6507
  privileges: SubscriptionEntitlementPrivilegeObject[];
6508
+ /** @example {"max":15,"provider":"okta"} */
6509
+ overrides: Record<string, any>;
6244
6510
  }
6245
6511
  export interface SubscriptionEntitlements {
6246
6512
  entitlements: SubscriptionEntitlementObject[];
@@ -6287,227 +6553,8 @@ export interface TaxCreateInput {
6287
6553
  export interface Tax {
6288
6554
  tax: TaxObject;
6289
6555
  }
6290
- export interface TaxUpdateInput {
6291
- tax: TaxBaseInput;
6292
- }
6293
- /** Object that represents rule for wallet recurring transactions. */
6294
- export interface WalletRecurringTransactionRule {
6295
- /**
6296
- * A unique identifier for the recurring transaction rule in the Lago application. Can be used to update a recurring transaction rule.
6297
- * @format uuid
6298
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
6299
- */
6300
- lago_id: string;
6301
- /**
6302
- * The trigger. Possible values are `interval` or `threshold`.
6303
- * @example "interval"
6304
- */
6305
- trigger: "interval" | "threshold";
6306
- /**
6307
- * The method used for recurring top-up. Possible values are `fixed` or `target`.
6308
- * @example "target"
6309
- */
6310
- method: "fixed" | "target";
6311
- /**
6312
- * The interval used for recurring top-up. It represents the frequency at which automatic top-up occurs. The interval can be one of the following values: `weekly`, `monthly`, `quarterly` or `yearly`. Required only if trigger is set to `interval`.
6313
- * @example "monthly"
6314
- */
6315
- interval: "weekly" | "monthly" | "quarterly" | "yearly";
6316
- /**
6317
- * The status of the recurring transaction rule. Possible values are `active` or `terminated`.
6318
- * @example "active"
6319
- */
6320
- status?: "active" | "terminated";
6321
- /**
6322
- * The threshold for recurring top-ups is the value at which an automatic top-up is triggered. For example, if this threshold is set at 10 credits, an automatic top-up will occur whenever the wallet balance falls to or below 10 credits. Required only when trigger is set to `threshold`.
6323
- * @pattern ^[0-9]+.?[0-9]*$
6324
- * @example "20.0"
6325
- */
6326
- threshold_credits: string;
6327
- /**
6328
- * The number of paid credits. Required only if there is no granted credits.
6329
- * @pattern ^[0-9]+.?[0-9]*$
6330
- * @example "20.0"
6331
- */
6332
- paid_credits: string;
6333
- /**
6334
- * The number of free granted credits. Required only if there is no paid credits.
6335
- * @pattern ^[0-9]+.?[0-9]*$
6336
- * @example "10.0"
6337
- */
6338
- granted_credits: string;
6339
- /**
6340
- * The effective start date for recurring top-ups. This date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
6341
- * @format date-time
6342
- * @example "2022-08-08T00:00:00Z"
6343
- */
6344
- started_at?: string | null;
6345
- /**
6346
- * The target ongoing balance is the value set for the ongoing balance to be reached by the automatic top-up. Required only when trigger is set to `target`.
6347
- * @pattern ^[0-9]+.?[0-9]*$
6348
- * @example "200.0"
6349
- */
6350
- target_ongoing_balance: string | null;
6351
- /**
6352
- * The date of the metadata object creation, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC). The creation_date provides a standardized and internationally recognized timestamp for when the metadata object was created
6353
- * @format date-time
6354
- * @example "2022-04-29T08:59:51Z"
6355
- */
6356
- created_at: string;
6357
- /**
6358
- * The expiration date and time for this specific recurring transaction rule. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
6359
- * @format date-time
6360
- * @example "2023-09-30T23:59:59Z"
6361
- */
6362
- expiration_at?: string | null;
6363
- /**
6364
- * A boolean setting that, when set to true, delays issuing an invoice for a wallet top-up until a successful payment is made; if false, the invoice is issued immediately upon wallet top-up, regardless of the payment status. Default value of false.
6365
- * @example false
6366
- */
6367
- invoice_requires_successful_payment?: boolean;
6368
- /**
6369
- * This field allows you to store a list of key-value pairs containing additional information or custom attributes. These key-value pairs will populate the metadata of the wallet transactions triggered by this rule.
6370
- * @example [{"key":"example_key","value":"example_value"},{"key":"another_key","value":"another_value"}]
6371
- */
6372
- transaction_metadata?: {
6373
- /** The unique identifier for the attribute. */
6374
- key?: string;
6375
- /** The value associated with the key. */
6376
- value?: string;
6377
- }[];
6378
- }
6379
- export interface WalletObject {
6380
- /**
6381
- * Unique identifier assigned to the wallet within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the wallet's record within the Lago system.
6382
- * @format uuid
6383
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
6384
- */
6385
- lago_id: string;
6386
- /**
6387
- * Unique identifier assigned to the customer within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the customer's record within the Lago system.
6388
- * @format uuid
6389
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
6390
- */
6391
- lago_customer_id: string;
6392
- /**
6393
- * The customer external unique identifier (provided by your own application)
6394
- * @example "hooli_1234"
6395
- */
6396
- external_customer_id: string;
6397
- /**
6398
- * The status of the wallet. Possible values are `active` or `terminated`.
6399
- * @example "active"
6400
- */
6401
- status: "active" | "terminated";
6402
- /**
6403
- * The currency of the wallet.
6404
- * @example "USD"
6405
- */
6406
- currency: Currency;
6407
- /**
6408
- * The name of the wallet.
6409
- * @example "Prepaid"
6410
- */
6411
- name?: string | null;
6412
- /**
6413
- * The rate of conversion between credits and the amount in the specified currency. It indicates the ratio or factor used to convert credits into the corresponding monetary value in the currency of the transaction.
6414
- * @pattern ^[0-9]+.?[0-9]*$
6415
- * @example "1.5"
6416
- */
6417
- rate_amount: string;
6418
- /**
6419
- * The current wallet balance expressed in credits. This reflects the available balance after all transactions are settled.
6420
- * @pattern ^[0-9]+.?[0-9]*$
6421
- * @example "28.0"
6422
- */
6423
- credits_balance: string;
6424
- /**
6425
- * The current wallet balance expressed in cents. This reflects the available balance after all transactions are settled.
6426
- * @example 1000
6427
- */
6428
- balance_cents: number;
6429
- /**
6430
- * The number of consumed credits.
6431
- * @pattern ^[0-9]+.?[0-9]*$
6432
- * @example "2.0"
6433
- */
6434
- consumed_credits: string;
6435
- /**
6436
- * The date of the wallet creation, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
6437
- * @format date-time
6438
- * @example "2022-04-29T08:59:51Z"
6439
- */
6440
- created_at: string;
6441
- /**
6442
- * The date and time that determines when the wallet will expire. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
6443
- * @format date-time
6444
- * @example null
6445
- */
6446
- expiration_at?: string | null;
6447
- /**
6448
- * The date and time of the last balance top-up. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
6449
- * @format date-time
6450
- * @example "2022-04-29T08:59:51Z"
6451
- */
6452
- last_balance_sync_at?: string | null;
6453
- /**
6454
- * The date and time of the last credits consumption. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
6455
- * @format date-time
6456
- * @example "2022-04-29T08:59:51Z"
6457
- */
6458
- last_consumed_credit_at?: string | null;
6459
- /**
6460
- * The date of terminaison of the wallet. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
6461
- * @format date-time
6462
- * @example "2022-09-14T16:35:31Z"
6463
- */
6464
- terminated_at?: string | null;
6465
- /**
6466
- * A boolean setting that, when set to true, delays issuing an invoice for a wallet top-up until a successful payment is made; if false, the invoice is issued immediately upon wallet top-up, regardless of the payment status. Default value of false.
6467
- * @example false
6468
- */
6469
- invoice_requires_successful_payment: boolean;
6470
- /** Set wallet limitations to fee types. */
6471
- applies_to?: {
6472
- /**
6473
- * An array of fee types to which the wallet is applicable. By specifying the fee types in this field, you can restrict the wallet's usage to specific fee types only.
6474
- * @example ["charge"]
6475
- */
6476
- fee_types?: ("charge" | "subscription" | "commitment")[];
6477
- /**
6478
- * An array of billable metric codes to which the wallet is applicable. By specifying the billable metric codes in this field, you can restrict the wallet's usage to specific metrics only.
6479
- * @example ["bm1"]
6480
- */
6481
- billable_metric_codes?: string[];
6482
- };
6483
- /** List of recurring transaction rules. Currently, we only allow one recurring rule per wallet. */
6484
- recurring_transaction_rules?: WalletRecurringTransactionRule[];
6485
- /**
6486
- * The ongoing wallet balance expressed in cents. This represents the `balance_cents` minus the `ongoing_usage_balance_cents`, showing the real time balance after accounting for current usage including taxes.
6487
- * @example 800
6488
- */
6489
- ongoing_balance_cents: number;
6490
- /**
6491
- * The ongoing usage balance of the wallet, expressed in cents. This reflects all current usage and draft invoices including taxes.
6492
- * @example 200
6493
- */
6494
- ongoing_usage_balance_cents: number;
6495
- /**
6496
- * The ongoing wallet balance expressed in credits. This represents the `credits_balance` minus the `credits_ongoing_usage_balance`, showing the real time balance after accounting for current usage including taxes.
6497
- * @pattern ^[0-9]+.?[0-9]*$
6498
- * @example "8.0"
6499
- */
6500
- credits_ongoing_balance: string;
6501
- /**
6502
- * The ongoing usage balance of the wallet, expressed in credits. This reflects all current usage and draft invoices including taxes.
6503
- * @pattern ^[0-9]+.?[0-9]*$
6504
- * @example "2.0"
6505
- */
6506
- credits_ongoing_usage_balance: string;
6507
- }
6508
- export interface WalletsPaginated {
6509
- wallets: WalletObject[];
6510
- meta: PaginationMeta;
6556
+ export interface TaxUpdateInput {
6557
+ tax: TaxBaseInput;
6511
6558
  }
6512
6559
  export interface WalletCreateInput {
6513
6560
  wallet?: {
@@ -6560,6 +6607,11 @@ export interface WalletCreateInput {
6560
6607
  * @example [{"key":"example_key","value":"example_value"},{"key":"another_key","value":"another_value"}]
6561
6608
  */
6562
6609
  transaction_metadata?: any[] | null;
6610
+ /**
6611
+ * The name of the wallet transactions triggered when creating the wallet. 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`.
6612
+ * @example "Tokens for models 'high-fidelity-boost'"
6613
+ */
6614
+ transaction_name?: string | null;
6563
6615
  /** Set wallet limitations to fee types. */
6564
6616
  applies_to?: {
6565
6617
  /**
@@ -6617,10 +6669,10 @@ export interface WalletUpdateInput {
6617
6669
  */
6618
6670
  method?: "fixed" | "target";
6619
6671
  /**
6620
- * The interval used for recurring top-up. It represents the frequency at which automatic top-up occurs. The interval can be one of the following values: `weekly`, `monthly`, `quarterly` or `yearly`. Required only when trigger is set to `interval`.
6672
+ * The interval used for recurring top-up. It represents the frequency at which automatic top-up occurs. The interval can be one of the following values: `weekly`, `monthly`, `quarterly`, `semiannual` or `yearly`. Required only when trigger is set to `interval`.
6621
6673
  * @example "monthly"
6622
6674
  */
6623
- interval?: "weekly" | "monthly" | "quarterly" | "yearly";
6675
+ interval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
6624
6676
  /**
6625
6677
  * The threshold for recurring top-ups is the value at which an automatic top-up is triggered. For example, if this threshold is set at 10 credits, an automatic top-up will occur whenever the wallet balance falls to or below 10 credits. Required only when trigger is set to `threshold`.
6626
6678
  * @pattern ^[0-9]+.?[0-9]*$
@@ -6672,6 +6724,11 @@ export interface WalletUpdateInput {
6672
6724
  /** The value associated with the key. */
6673
6725
  value?: string;
6674
6726
  }[];
6727
+ /**
6728
+ * The name of the wallet transactions triggered by this rule. 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`.
6729
+ * @example "Tokens for models 'high-fidelity-boost'"
6730
+ */
6731
+ transaction_name?: string | null;
6675
6732
  }[];
6676
6733
  /** Set wallet limitations to fee types. */
6677
6734
  applies_to?: {
@@ -6696,6 +6753,13 @@ export interface WalletTransactionCreateInput {
6696
6753
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
6697
6754
  */
6698
6755
  wallet_id: string;
6756
+ /**
6757
+ * 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`.
6758
+ *
6759
+ * Note that this name will apply to all transactions (`paid_credits`, `granted_credits` and `voided_credits`) created by this action.
6760
+ * @example "Tokens for models 'high-fidelity-boost'"
6761
+ */
6762
+ name?: string | null;
6699
6763
  /**
6700
6764
  * The number of paid credits.
6701
6765
  * @pattern ^[0-9]+.?[0-9]*$
@@ -6804,6 +6868,11 @@ export interface WalletTransactionObject {
6804
6868
  * @example "2022-04-29T08:59:51Z"
6805
6869
  */
6806
6870
  created_at: string;
6871
+ /**
6872
+ * 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`.
6873
+ * @example "Tokens for models 'high-fidelity-boost'"
6874
+ */
6875
+ name: string | null;
6807
6876
  }
6808
6877
  export interface WalletTransactions {
6809
6878
  wallet_transactions: WalletTransactionObject[];
@@ -7292,13 +7361,16 @@ export interface PaymentRequestPaymentFailureObject {
7292
7361
  provider_error?: string | Record<string, any>;
7293
7362
  }
7294
7363
  export type SubscriptionWithCustomerObject = SubscriptionObject & {
7295
- plan?: PlanObject;
7296
- customer?: CustomerObject;
7364
+ plan: PlanObject;
7365
+ customer: CustomerObject;
7297
7366
  };
7298
7367
  export type SubscriptionWithThresholdObject = SubscriptionObject & {
7299
- plan?: PlanObject;
7300
- customer?: CustomerObject;
7301
- usage_threshold?: UsageThresholdObject;
7368
+ plan: PlanObject;
7369
+ customer: CustomerObject;
7370
+ usage_threshold: UsageThresholdObject;
7371
+ };
7372
+ export type WalletTransactionObjectExtended = WalletTransactionObject & {
7373
+ wallet?: WalletObject;
7302
7374
  };
7303
7375
  export interface WalletTransactionPaymentFailureObject {
7304
7376
  /**
@@ -7336,7 +7408,6 @@ export interface WalletTransactionPaymentFailureObject {
7336
7408
  provider_error?: string | Record<string, any>;
7337
7409
  }
7338
7410
  export type CustomerPaymentProvidernErrorObject = CustomerPaymentProviderErrorObject;
7339
- export type PrivilegeObject = FeaturePrivilegeObject;
7340
7411
  export type QueryParamsType = Record<string | number, any>;
7341
7412
  export type ResponseFormat = keyof Omit<Body, "body" | "bodyUsed">;
7342
7413
  export interface FullRequestParams extends Omit<RequestInit, "body"> {
@@ -7397,7 +7468,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
7397
7468
  }
7398
7469
  /**
7399
7470
  * @title Lago API documentation
7400
- * @version 1.31.0
7471
+ * @version 1.33.3
7401
7472
  * @license AGPLv3
7402
7473
  * @baseUrl https://api.getlago.com/api/v1
7403
7474
  * @externalDocs https://github.com/getlago
@@ -7735,7 +7806,8 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
7735
7806
  *
7736
7807
  * - Revenue from `monthly` subscription invoices is included in the MRR for the month in which the invoice is issued.
7737
7808
  * - Revenue from `quarterly` subscription invoices is distributed evenly over three months. This distribution applies to fees paid in advance (allocated to the next remaining months depending on calendar or anniversary billing) as well as to fees paid in arrears (allocated to the preceding months depending on calendar or anniversary billing).
7738
- * - Revenue from `yearly` subscription invoices is distributed evenly over twelve months. This allocation is applicable for fees paid in advance (spread over the next remaining months depending on calendar or anniversary billing) and for fees paid in arrears (spread over the previous months depending on calendar or anniversary billing).
7809
+ * - Revenue from `yearly` subscription invoices is distributed evenly over twelve months. This allocation is applicable for fees paid in advance (spread over the next remaining months depending on calendar or anniversary billing) and for fees paid in arrears (spread over the previous months depending on calendar or anniversary billing).
7810
+ * - Revenue from `semiannual` subscription invoices is distributed evenly over six months. This allocation is applicable for fees paid in advance (spread over the next remaining months depending on calendar or anniversary billing) and for fees paid in arrears (spread over the previous months depending on calendar or anniversary billing).
7739
7811
  * - Revenue from `weekly` subscription invoices, the total revenue from all invoices issued within a month is summed up. This total is then divided by the number of invoices issued during that month, and the result is multiplied by 4.33, representing the average number of weeks in a month.
7740
7812
  */
7741
7813
  currency?: Currency;
@@ -8293,6 +8365,37 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
8293
8365
  * @secure
8294
8366
  */
8295
8367
  destroyCustomer: (externalCustomerId: string, params?: RequestParams) => Promise<HttpResponse<Customer, ApiErrorUnauthorized | ApiErrorNotFound>>;
8368
+ /**
8369
+ * @description This endpoint is used to list all applied coupons for a customer.
8370
+ *
8371
+ * @tags customers, coupons
8372
+ * @name FindAllCustomerAppliedCoupons
8373
+ * @summary List all customer's applied coupons
8374
+ * @request GET:/customers/{external_customer_id}/applied_coupons
8375
+ * @secure
8376
+ */
8377
+ findAllCustomerAppliedCoupons: (externalCustomerId: string, query?: {
8378
+ /**
8379
+ * Page number.
8380
+ * @example 1
8381
+ */
8382
+ page?: number;
8383
+ /**
8384
+ * Number of records per page.
8385
+ * @example 20
8386
+ */
8387
+ per_page?: number;
8388
+ /**
8389
+ * The status of the coupon. Can be either `active` or `terminated`.
8390
+ * @example "active"
8391
+ */
8392
+ status?: "active" | "terminated";
8393
+ /**
8394
+ * The code of the coupon applied to the customer. Use it to filter applied coupons by their code.
8395
+ * @example ["BLACK_FRIDAY_2024","CHRISTMAS_2024"]
8396
+ */
8397
+ "coupon_code[]"?: string[];
8398
+ }, params?: RequestParams) => Promise<HttpResponse<AppliedCouponsPaginated, ApiErrorUnauthorized | ApiErrorNotFound>>;
8296
8399
  /**
8297
8400
  * @description This endpoint is used to delete a specific coupon that has been applied to a customer.
8298
8401
  *
@@ -8303,6 +8406,197 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
8303
8406
  * @secure
8304
8407
  */
8305
8408
  deleteAppliedCoupon: (externalCustomerId: string, appliedCouponId: string, params?: RequestParams) => Promise<HttpResponse<AppliedCoupon, ApiErrorUnauthorized | ApiErrorNotFound>>;
8409
+ /**
8410
+ * @description This endpoint list all existing credit notes for a customer.
8411
+ *
8412
+ * @tags customers, credit_notes
8413
+ * @name FindAllCustomerCreditNotes
8414
+ * @summary List all customer's credit notes
8415
+ * @request GET:/customers/{external_customer_id}/credit_notes
8416
+ * @secure
8417
+ */
8418
+ findAllCustomerCreditNotes: (externalCustomerId: string, query?: {
8419
+ /**
8420
+ * Page number.
8421
+ * @example 1
8422
+ */
8423
+ page?: number;
8424
+ /**
8425
+ * Number of records per page.
8426
+ * @example 20
8427
+ */
8428
+ per_page?: number;
8429
+ /**
8430
+ * Filter credit notes starting from a specific date.
8431
+ * @format date
8432
+ * @example "2022-07-08"
8433
+ */
8434
+ issuing_date_from?: string;
8435
+ /**
8436
+ * Filter credit notes up to a specific date.
8437
+ * @format date
8438
+ * @example "2022-08-09"
8439
+ */
8440
+ issuing_date_to?: string;
8441
+ /**
8442
+ * Search credit notes by id, number, customer name, customer external_id or customer email.
8443
+ * @example "Jane"
8444
+ */
8445
+ search_term?: string;
8446
+ /** Filter credit notes by reasons. Possible values are `product_unsatisfactory`, `order_change`, `order_cancellation`, `fraudulent_charge`, `duplicated_charge` or `other`. */
8447
+ reason?: "product_unsatisfactory" | "order_change" | "order_cancellation" | "fraudulent_charge" | "duplicated_charge" | "other";
8448
+ /** Filter credit notes by credit status. Possible values are `available`, `consumed` or `voided`. */
8449
+ credit_status?: "available" | "consumed" | "voided";
8450
+ /** Filter credit notes by refund status. Possible values are `pending`, `succeeded` or `failed`. */
8451
+ refund_status?: "pending" | "succeeded" | "failed";
8452
+ /**
8453
+ * Filter credit notes by their related invoice number.
8454
+ * @example "INV-001-002"
8455
+ */
8456
+ invoice_number?: string;
8457
+ /**
8458
+ * Filter credit notes of at least a specific amount. This parameter must be defined in cents to ensure consistent handling for all currency types.
8459
+ * @example 9000
8460
+ */
8461
+ amount_from?: number;
8462
+ /**
8463
+ * Filter credit notes up to a specific amount. This parameter must be defined in cents to ensure consistent handling for all currency types.
8464
+ * @example 100000
8465
+ */
8466
+ amount_to?: number;
8467
+ /**
8468
+ * Filter credit notes belonging to a self billed invoice. Possible values are `true` or `false`.
8469
+ * @example true
8470
+ */
8471
+ self_billed?: boolean;
8472
+ }, params?: RequestParams) => Promise<HttpResponse<CreditNotesPaginated, ApiErrorUnauthorized | ApiErrorNotFound>>;
8473
+ /**
8474
+ * @description This endpoint is used for retrieving all invoices of a customer.
8475
+ *
8476
+ * @tags customers, invoices
8477
+ * @name FindAllCustomerInvoices
8478
+ * @summary List all customer's invoices
8479
+ * @request GET:/customers/{external_customer_id}/invoices
8480
+ * @secure
8481
+ */
8482
+ findAllCustomerInvoices: (externalCustomerId: string, query?: {
8483
+ /**
8484
+ * Page number.
8485
+ * @example 1
8486
+ */
8487
+ page?: number;
8488
+ /**
8489
+ * Number of records per page.
8490
+ * @example 20
8491
+ */
8492
+ per_page?: number;
8493
+ /**
8494
+ * Filter invoices of at least a specific amount. This parameter must be defined in cents to ensure consistent handling for all currency types.
8495
+ * @example 9000
8496
+ */
8497
+ amount_from?: number;
8498
+ /**
8499
+ * Filter invoices up to a specific amount. This parameter must be defined in cents to ensure consistent handling for all currency types.
8500
+ * @example 100000
8501
+ */
8502
+ amount_to?: number;
8503
+ /**
8504
+ * Filter invoices starting from a specific date.
8505
+ * @format date
8506
+ * @example "2022-07-08"
8507
+ */
8508
+ issuing_date_from?: string;
8509
+ /**
8510
+ * Filter invoices up to a specific date.
8511
+ * @format date
8512
+ * @example "2022-08-09"
8513
+ */
8514
+ issuing_date_to?: string;
8515
+ /** Filter invoices by status. Possible values are `draft` or `finalized`. */
8516
+ status?: "draft" | "finalized";
8517
+ /** Filter invoices by payment status. Possible values are `pending`, `failed` or `succeeded`. */
8518
+ payment_status?: "pending" | "failed" | "succeeded";
8519
+ /**
8520
+ * Filter invoices by payment_overdue. Possible values are `true` or `false`.
8521
+ * @example true
8522
+ */
8523
+ payment_overdue?: boolean;
8524
+ /**
8525
+ * Search invoices by id, number, customer name, customer external_id or customer email.
8526
+ * @example "Jane"
8527
+ */
8528
+ search_term?: string;
8529
+ /**
8530
+ * Filter invoices with a payment dispute lost. Possible values are `true` or `false`.
8531
+ * @example true
8532
+ */
8533
+ payment_dispute_lost?: boolean;
8534
+ /** Filter invoices by invoice type. Possible values are `subscription`, `add_on`, `credit`, `one_off`, `advance_charges` or `progressive_billing`. */
8535
+ invoice_type?: "subscription" | "add_on" | "credit" | "one_off" | "advance_charges" | "progressive_billing";
8536
+ /**
8537
+ * Filter invoices by self billed. Possible values are `true` or `false`.
8538
+ * @example true
8539
+ */
8540
+ self_billed?: boolean;
8541
+ /**
8542
+ * Filter invoices by metadata. Replace `key` with the actual metadata key you want to match, and provide the corresponding value. Providing empty value will search for invoice without given metadata key. For example, `metadata[color]=blue`.
8543
+ * @example "someValue"
8544
+ */
8545
+ "metadata[key]"?: string;
8546
+ }, params?: RequestParams) => Promise<HttpResponse<InvoicesPaginated, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
8547
+ /**
8548
+ * @description This endpoint is used to list all payments of a customer
8549
+ *
8550
+ * @tags customers, payments
8551
+ * @name FindAllCustomerPayments
8552
+ * @summary List all customer's payments
8553
+ * @request GET:/customers/{external_customer_id}/payments
8554
+ * @secure
8555
+ */
8556
+ findAllCustomerPayments: (externalCustomerId: string, query?: {
8557
+ /**
8558
+ * Page number.
8559
+ * @example 1
8560
+ */
8561
+ page?: number;
8562
+ /**
8563
+ * Number of records per page.
8564
+ * @example 20
8565
+ */
8566
+ per_page?: number;
8567
+ /**
8568
+ * Unique identifier assigned to the invoice within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the invoice's record within the Lago system.
8569
+ * @format uuid
8570
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
8571
+ */
8572
+ invoice_id?: string;
8573
+ }, params?: RequestParams) => Promise<HttpResponse<PaymentsPaginated, ApiErrorUnauthorized | ApiErrorNotFound>>;
8574
+ /**
8575
+ * @description This endpoint is used to list all existing payment requests of a customer.
8576
+ *
8577
+ * @tags customers, payment_requests
8578
+ * @name FindAllCustomerPaymentRequests
8579
+ * @summary List all customer's payment requests
8580
+ * @request GET:/customers/{external_customer_id}/payment_requests
8581
+ * @secure
8582
+ */
8583
+ findAllCustomerPaymentRequests: (externalCustomerId: string, query?: {
8584
+ /**
8585
+ * Page number.
8586
+ * @example 1
8587
+ */
8588
+ page?: number;
8589
+ /**
8590
+ * Number of records per page.
8591
+ * @example 20
8592
+ */
8593
+ per_page?: number;
8594
+ /**
8595
+ * Filter by payment status. Possible values are `pending`, `failed` or `succeeded`.
8596
+ * @example "pending"
8597
+ */
8598
+ payment_status?: "pending" | "failed" | "succeeded";
8599
+ }, params?: RequestParams) => Promise<HttpResponse<PaymentRequestsPaginated, ApiErrorUnauthorized | ApiErrorNotFound>>;
8306
8600
  /**
8307
8601
  * @description Retrieves an embeddable link for displaying a customer portal. This endpoint allows you to fetch the URL that can be embedded to provide customers access to a dedicated portal
8308
8602
  *
@@ -8321,6 +8615,58 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
8321
8615
  portal_url: string;
8322
8616
  };
8323
8617
  }, ApiErrorUnauthorized | ApiErrorNotFound>>;
8618
+ /**
8619
+ * @description This endpoint retrieves all active subscriptions for a customer.
8620
+ *
8621
+ * @tags customers, subscriptions
8622
+ * @name FindAllCustomerSubscriptions
8623
+ * @summary List all customer's subscriptions
8624
+ * @request GET:/customers/{external_customer_id}/subscriptions
8625
+ * @secure
8626
+ */
8627
+ findAllCustomerSubscriptions: (externalCustomerId: string, query?: {
8628
+ /**
8629
+ * Page number.
8630
+ * @example 1
8631
+ */
8632
+ page?: number;
8633
+ /**
8634
+ * Number of records per page.
8635
+ * @example 20
8636
+ */
8637
+ per_page?: number;
8638
+ /**
8639
+ * 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.
8640
+ * @example "premium"
8641
+ */
8642
+ plan_code?: string;
8643
+ /**
8644
+ * 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`.
8645
+ * @example ["active","pending"]
8646
+ */
8647
+ "status[]"?: ("pending" | "canceled" | "terminated" | "active")[];
8648
+ }, params?: RequestParams) => Promise<HttpResponse<SubscriptionsPaginated, ApiErrorUnauthorized | ApiErrorNotFound>>;
8649
+ /**
8650
+ * @description This endpoint is used to list all wallets with prepaid credits of a customer
8651
+ *
8652
+ * @tags customers, wallets
8653
+ * @name FindAllCustomerWallets
8654
+ * @summary List all customer's wallets
8655
+ * @request GET:/customers/{external_customer_id}/wallets
8656
+ * @secure
8657
+ */
8658
+ findAllCustomerWallets: (externalCustomerId: string, query?: {
8659
+ /**
8660
+ * Page number.
8661
+ * @example 1
8662
+ */
8663
+ page?: number;
8664
+ /**
8665
+ * Number of records per page.
8666
+ * @example 20
8667
+ */
8668
+ per_page?: number;
8669
+ }, params?: RequestParams) => Promise<HttpResponse<WalletsPaginated, ApiErrorUnauthorized | ApiErrorForbidden | ApiErrorNotFound>>;
8324
8670
  /**
8325
8671
  * @description This endpoint enables the retrieval of the usage-based billing data for a customer within the current period.
8326
8672
  *
@@ -8708,10 +9054,10 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
8708
9054
  * @example "2022-08-09"
8709
9055
  */
8710
9056
  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";
9057
+ /** Filter invoices by statuses. Possible values are `draft`, `failed`, `finalized`, `pending` and `voided`. */
9058
+ "statuses[]"?: ("draft" | "finalized" | "failed" | "pending" | "voided")[];
9059
+ /** Filter invoices by payment statuses. Possible values are `pending`, `failed` or `succeeded`. */
9060
+ "payment_statuses[]"?: ("pending" | "failed" | "succeeded")[];
8715
9061
  /**
8716
9062
  * Filter invoices by payment_overdue. Possible values are `true` or `false`.
8717
9063
  * @example true
@@ -9016,7 +9362,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
9016
9362
  * @request GET:/payments/{lago_id}
9017
9363
  * @secure
9018
9364
  */
9019
- findPayment: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<PaymentManualObject, ApiErrorUnauthorized | ApiErrorNotFound>>;
9365
+ findPayment: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<PaymentObject, ApiErrorUnauthorized | ApiErrorNotFound>>;
9020
9366
  };
9021
9367
  plans: {
9022
9368
  /**
@@ -9101,7 +9447,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
9101
9447
  */
9102
9448
  findAllEntitlements: (code: string, params?: RequestParams) => Promise<HttpResponse<PlanEntitlements, ApiErrorUnauthorized | ApiErrorNotFound>>;
9103
9449
  /**
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 features and privileges not part of the payload are ignored. To remove privileges or features, use the DELETE endpoints. All privileges must be valid for the feature.
9450
+ * @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
9451
  *
9106
9452
  * @tags entitlements
9107
9453
  * @name UpdateEntitlement
@@ -9186,8 +9532,8 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
9186
9532
  * 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
9533
  * @example ["active","pending"]
9188
9534
  */
9189
- "status[]"?: ("pending" | "canceled" | "terminated" | "active")[];
9190
- }, params?: RequestParams) => Promise<HttpResponse<SubscriptionsPaginated, ApiErrorUnauthorized | ApiErrorNotFound>>;
9535
+ "status[]"?: ("active" | "canceled" | "pending" | "terminated")[];
9536
+ }, params?: RequestParams) => Promise<HttpResponse<SubscriptionsPaginated, ApiErrorUnauthorized>>;
9191
9537
  /**
9192
9538
  * @description This endpoint retrieves a specific subscription.
9193
9539
  *
@@ -9202,6 +9548,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
9202
9548
  * 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
9549
  *
9204
9550
  * _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._
9551
+ * @default "active"
9205
9552
  * @example "active"
9206
9553
  */
9207
9554
  status?: "active" | "terminated" | "pending" | "canceled";
@@ -9215,7 +9562,14 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
9215
9562
  * @request PUT:/subscriptions/{external_id}
9216
9563
  * @secure
9217
9564
  */
9218
- updateSubscription: (externalId: string, data: SubscriptionUpdateInput, params?: RequestParams) => Promise<HttpResponse<Subscription, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorBadRequest | ApiErrorNotFound>>;
9565
+ updateSubscription: (externalId: string, data: SubscriptionUpdateInput, query?: {
9566
+ /**
9567
+ * By default, this endpoint only return `active` subscriptions. If you want to update a subscription with a different `status`, you can specify it here.
9568
+ * @default "active"
9569
+ * @example "active"
9570
+ */
9571
+ status?: "active" | "pending";
9572
+ }, params?: RequestParams) => Promise<HttpResponse<Subscription, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorBadRequest | ApiErrorNotFound>>;
9219
9573
  /**
9220
9574
  * @description This endpoint allows you to terminate a subscription.
9221
9575
  *
@@ -9252,7 +9606,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
9252
9606
  * @example "generate"
9253
9607
  */
9254
9608
  on_termination_invoice?: "generate" | "skip";
9255
- }, params?: RequestParams) => Promise<HttpResponse<Subscription, ApiErrorUnauthorized | ApiErrorNotFound | ApiErrorNotAllowed>>;
9609
+ }, params?: RequestParams) => Promise<HttpResponse<Subscription, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
9256
9610
  /**
9257
9611
  * @description This endpoint enables the retrieval of the lifetime usage of a subscription.
9258
9612
  *
@@ -9334,7 +9688,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
9334
9688
  */
9335
9689
  findAllSubscriptionEntitlements: (externalId: string, params?: RequestParams) => Promise<HttpResponse<SubscriptionEntitlements, ApiErrorUnauthorized | ApiErrorNotFound>>;
9336
9690
  /**
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.
9691
+ * @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
9692
  *
9339
9693
  * @tags entitlements
9340
9694
  * @name UpdateSubscriptionEntitlements