lago-javascript-client 1.33.3 → 1.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2093,6 +2093,11 @@ export interface FeeObject {
2093
2093
  * @example "312.5"
2094
2094
  */
2095
2095
  precise_unit_amount: string;
2096
+ /**
2097
+ * The total number of units that have been aggregated for this specific fee.
2098
+ * @example "0.32"
2099
+ */
2100
+ total_aggregated_units: string;
2096
2101
  /**
2097
2102
  * The cost of this specific fee, including any applicable taxes.
2098
2103
  * @example 120
@@ -2240,7 +2245,7 @@ export interface FeeObject {
2240
2245
  */
2241
2246
  lago_item_id: string;
2242
2247
  /**
2243
- * The type of the fee item. Possible values are `AddOn`, `BillableMetric`, `WalletTransaction`, `Subscription` or `Commitment`.
2248
+ * The type of the fee item. Possible values are `AddOn`, `BillableMetric`, `WalletTransaction`, `Subscription`.
2244
2249
  * @example "Subscription"
2245
2250
  */
2246
2251
  item_type: "AddOn" | "BillableMetric" | "Subscription" | "WalletTransaction";
@@ -3195,1169 +3200,1574 @@ export interface CustomerCreateInput {
3195
3200
  export interface Customer {
3196
3201
  customer: CustomerObjectExtended;
3197
3202
  }
3198
- /** Details about the pricing unit used for charge usage. */
3199
- export interface UsagePricingUnitDetailsObject {
3203
+ export interface InvoiceBaseObject {
3200
3204
  /**
3201
- * The amount in cents in the pricing unit.
3202
- * @example 200
3205
+ * 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.
3206
+ * @format uuid
3207
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3203
3208
  */
3204
- amount_cents: number;
3209
+ lago_id: string;
3205
3210
  /**
3206
- * The short name of the pricing unit.
3207
- * @example "CR"
3211
+ * The unique code of the billing entity associated with the invoice
3212
+ * @example "acme_corp"
3208
3213
  */
3209
- short_name: string;
3214
+ billing_entity_code: string | null;
3210
3215
  /**
3211
- * The conversion rate from pricing units to the plan's currency.
3212
- * @example "0.5"
3216
+ * 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.
3217
+ * @example 2
3213
3218
  */
3214
- conversion_rate: string;
3215
- }
3216
- /** Array of filter object, representing multiple dimensions for a charge item. */
3217
- export type CustomerChargeFiltersUsageObject = {
3219
+ sequential_id?: number;
3218
3220
  /**
3219
- * The number of units consumed for a specific charge filter related to a charge item.
3220
- * @pattern ^[0-9]+.?[0-9]*$
3221
- * @example "0.9"
3221
+ * 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.
3222
+ * @example "LAG-1234-001-002"
3222
3223
  */
3223
- units?: string;
3224
+ number: string;
3224
3225
  /**
3225
- * The amount in cents, tax excluded, consumed for a specific charge filter related to a charge item.
3226
- * @example 1000
3226
+ * The date when the invoice was issued. It is provided in the ISO 8601 date format.
3227
+ * @format date
3228
+ * @example "2022-04-30"
3227
3229
  */
3228
- amount_cents?: number;
3230
+ issuing_date: string;
3229
3231
  /**
3230
- * 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.
3231
- * @example 10
3232
+ * The date when the payment dispute was lost. It is expressed in Coordinated Universal Time (UTC).
3233
+ * @format date-time
3234
+ * @example "2022-09-14T16:35:31Z"
3232
3235
  */
3233
- events_count?: number;
3236
+ payment_dispute_lost_at?: string;
3234
3237
  /**
3235
- * Specifies the name that will be displayed on an invoice.
3236
- * @example "AWS eu-east-1"
3238
+ * The payment due date for the invoice, specified in the ISO 8601 date format.
3239
+ * @format date
3240
+ * @example "2022-04-30"
3237
3241
  */
3238
- invoice_display_name?: string;
3239
- /** Details about the pricing unit used for charge usage. */
3240
- pricing_unit_details?: UsagePricingUnitDetailsObject;
3242
+ payment_due_date?: string;
3241
3243
  /**
3242
- * List of filter values applied to the usage.
3243
- * @example {"region":["us-east-1"]}
3244
+ * Specifies if the payment is considered as overdue.
3245
+ * @example true
3244
3246
  */
3245
- values?: Record<string, string[]>;
3246
- }[];
3247
- /** Array of aggregated fees, grouped by the event properties defined in a `standard` charge model. */
3248
- export type CustomerChargeGroupedUsageObject = {
3247
+ payment_overdue?: boolean;
3249
3248
  /**
3250
- * The amount in cents, tax excluded, consumed for a specific group related to a charge item.
3251
- * @example 1000
3249
+ * The net payment term, expressed in days, specifies the duration within which a customer is expected to remit payment after the invoice is finalized.
3250
+ * @example 30
3252
3251
  */
3253
- amount_cents?: number;
3252
+ net_payment_term?: number;
3254
3253
  /**
3255
- * 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.
3256
- * @example 10
3254
+ * The type of invoice issued. Possible values are `subscription`, `one-off`, `credit` or `progressive_billing`.
3255
+ * @example "subscription"
3257
3256
  */
3258
- events_count?: number;
3257
+ invoice_type: "subscription" | "add_on" | "credit" | "one_off" | "progressive_billing";
3259
3258
  /**
3260
- * The number of units consumed for a specific group related to a charge item.
3261
- * @pattern ^[0-9]+.?[0-9]*$
3262
- * @example "0.9"
3259
+ * The status of the invoice. It indicates the current state of the invoice and can have following values:
3260
+ * - `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.
3261
+ * - `finalized`: the invoice has been issued and finalized. In this state, events cannot be ingested or added to the invoice anymore.
3262
+ * - `voided`: the invoice has been issued and subsequently voided. In this state, events cannot be ingested or added to the invoice anymore.
3263
+ * - `pending`: the invoice remains pending until the taxes are fetched from the external provider.
3264
+ * - `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.
3265
+ * @example "finalized"
3263
3266
  */
3264
- units?: string;
3265
- /** Details about the pricing unit used for charge usage. */
3266
- pricing_unit_details?: UsagePricingUnitDetailsObject;
3267
- /** Key value list of event properties aggregated by the charge model */
3268
- grouped_by?: Record<string, string>;
3269
- /** Array of filter object, representing multiple dimensions for a charge item. */
3270
- filters?: CustomerChargeFiltersUsageObject;
3271
- }[];
3272
- export interface CustomerChargeUsageObject {
3267
+ status: "draft" | "finalized" | "voided" | "failed" | "pending";
3273
3268
  /**
3274
- * The number of units consumed by the customer for a specific charge item.
3275
- * @pattern ^[0-9]+.?[0-9]*$
3276
- * @example "1.0"
3269
+ * The status of the payment associated with the invoice. It can have one of the following values:
3270
+ * - `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.
3271
+ * - `succeeded`: the payment of the invoice has been successfully processed.
3272
+ * - `failed`: the payment of the invoice has failed or encountered an error during processing.
3273
+ * @example "succeeded"
3277
3274
  */
3278
- units: string;
3275
+ payment_status: "pending" | "succeeded" | "failed";
3279
3276
  /**
3280
- * 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.
3281
- * @example 10
3277
+ * The currency of the invoice issued.
3278
+ * @example "EUR"
3282
3279
  */
3283
- events_count: number;
3280
+ currency: Currency;
3284
3281
  /**
3285
- * The amount in cents, tax excluded, consumed by the customer for a specific charge item.
3286
- * @example 123
3282
+ * 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.
3283
+ * @example 100
3287
3284
  */
3288
- amount_cents: number;
3285
+ fees_amount_cents: number;
3289
3286
  /**
3290
- * The currency of a usage item consumed by the customer.
3291
- * @example "EUR"
3287
+ * The total sum of all coupons discounted on the invoice. It calculates the cumulative discount amount applied by coupons, expressed in cents.
3288
+ * @example 10
3292
3289
  */
3293
- amount_currency: Currency;
3294
- /** Details about the pricing unit used for charge usage. */
3295
- pricing_unit_details?: UsagePricingUnitDetailsObject;
3296
- /** Object listing all the properties for a specific charge item. */
3297
- charge: {
3298
- /**
3299
- * 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.
3300
- * @format uuid
3301
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3302
- */
3303
- lago_id: string;
3304
- /**
3305
- * The pricing model applied to this charge. Possible values are standard, `graduated`, `percentage`, `package` or `volume`.
3306
- * @example "graduated"
3307
- */
3308
- charge_model: "standard" | "graduated" | "package" | "percentage" | "volume";
3309
- /**
3310
- * 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.
3311
- * @example "Setup"
3312
- */
3313
- invoice_display_name?: string;
3314
- };
3315
- /** The related billable metric object. */
3316
- billable_metric: {
3317
- /**
3318
- * 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.
3319
- * @format uuid
3320
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3321
- */
3322
- lago_id: string;
3323
- /**
3324
- * The name of the billable metric used for this charge.
3325
- * @example "Storage"
3326
- */
3327
- name: string;
3328
- /**
3329
- * The code of the billable metric used for this charge.
3330
- * @example "storage"
3331
- */
3332
- code: string;
3333
- /**
3334
- * The aggregation type of the billable metric used for this charge. Possible values are `count_agg`, `sum_agg`, `max_agg` or `unique_count_agg`.
3335
- * @example "sum_agg"
3336
- */
3337
- aggregation_type: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg" | "weighted_sum_agg" | "latest_agg";
3338
- };
3339
- /** Array of filter object, representing multiple dimensions for a charge item. */
3340
- filters?: CustomerChargeFiltersUsageObject;
3341
- /** Array of aggregated fees, grouped by the event properties defined in a `standard` charge model. */
3342
- grouped_usage?: CustomerChargeGroupedUsageObject;
3343
- }
3344
- export interface CustomerUsageObject {
3290
+ coupons_amount_cents: number;
3345
3291
  /**
3346
- * The lower bound of the billing period, expressed in the ISO 8601 datetime format in Coordinated Universal Time (UTC).
3347
- * @format date-time
3348
- * @example "2022-07-01T00:00:00Z"
3292
+ * The total sum of all credit notes discounted on the invoice. It calculates the cumulative discount amount applied by credit notes, expressed in cents.
3293
+ * @example 10
3349
3294
  */
3350
- from_datetime: string;
3295
+ credit_notes_amount_cents: number;
3351
3296
  /**
3352
- * The upper bound of the billing period, expressed in the ISO 8601 datetime format in Coordinated Universal Time (UTC).
3353
- * @format date-time
3354
- * @example "2022-07-31T23:59:59Z"
3297
+ * Subtotal amount, excluding taxes, expressed in cents.
3298
+ * This field depends on the version number. Here are the definitions based on the version:
3299
+ * - Version 1: is equal to the sum of `fees_amount_cents`, minus `coupons_amount_cents`, and minus `prepaid_credit_amount_cents`.
3300
+ * - Version 2: is equal to the `fees_amount_cents`.
3301
+ * - Version 3 & 4: is equal to the `fees_amount_cents`, minus `coupons_amount_cents`
3302
+ * @example 100
3355
3303
  */
3356
- to_datetime: string;
3304
+ sub_total_excluding_taxes_amount_cents: number;
3357
3305
  /**
3358
- * The date of creation of the invoice.
3359
- * @format date
3360
- * @example "2022-08-01"
3306
+ * The sum of tax amount associated with the invoice, expressed in cents.
3307
+ * @example 20
3361
3308
  */
3362
- issuing_date: string;
3309
+ taxes_amount_cents: number;
3363
3310
  /**
3364
- * A unique identifier associated with the invoice related to this particular usage record.
3365
- * @format uuid
3366
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3311
+ * Subtotal amount, including taxes, expressed in cents.
3312
+ * This field depends on the version number. Here are the definitions based on the version:
3313
+ * - Version 1: is equal to the `total_amount_cents`.
3314
+ * - Version 2: is equal to the sum of `fees_amount_cents` and `taxes_amount_cents`.
3315
+ * - Version 3 & 4: is equal to the sum `sub_total_excluding_taxes_amount_cents` and `taxes_amount_cents`
3316
+ * @example 120
3367
3317
  */
3368
- lago_invoice_id?: string | null;
3318
+ sub_total_including_taxes_amount_cents: number;
3369
3319
  /**
3370
- * The currency of the customer's current usage.
3371
- * @example "EUR"
3320
+ * The total sum of all prepaid credits discounted on the invoice. It calculates the cumulative discount amount applied by prepaid credits, expressed in cents.
3321
+ * @example 0
3372
3322
  */
3373
- currency?: Currency;
3323
+ prepaid_credit_amount_cents: number;
3374
3324
  /**
3375
- * The amount in cents, tax excluded.
3376
- * @example 123
3325
+ * The usage already billed in previous invoices. Only apply to `progressive_billing` and `subscription` invoices.
3326
+ * @example 0
3377
3327
  */
3378
- amount_cents: number;
3328
+ progressive_billing_credit_amount_cents: number;
3379
3329
  /**
3380
- * The tax amount in cents.
3381
- * @example 200
3330
+ * 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.
3331
+ * @example 100
3382
3332
  */
3383
- taxes_amount_cents: number;
3333
+ total_amount_cents: number;
3334
+ /** @example 3 */
3335
+ version_number: number;
3384
3336
  /**
3385
- * The total amount in cents, tax included.
3386
- * @example 123
3337
+ * 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.
3338
+ * @example false
3387
3339
  */
3388
- total_amount_cents: number;
3389
- /** Array of charges that comprise the current usage. It contains detailed information about individual charge items associated with the usage. */
3390
- charges_usage: CustomerChargeUsageObject[];
3391
- }
3392
- export interface CustomerUsage {
3393
- customer_usage: CustomerUsageObject;
3394
- }
3395
- export interface CustomerProjectedUsageObject {
3340
+ self_billed?: boolean;
3396
3341
  /**
3397
- * The lower bound of the billing period, expressed in the ISO 8601 datetime format in Coordinated Universal Time (UTC).
3398
- * @format date-time
3399
- * @example "2022-07-01T00:00:00Z"
3342
+ * 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
3343
+ * @format uri
3344
+ * @example "https://getlago.com/invoice/file"
3400
3345
  */
3401
- from_datetime: string;
3346
+ file_url?: string;
3402
3347
  /**
3403
- * The upper bound of the billing period, expressed in the ISO 8601 datetime format in Coordinated Universal Time (UTC).
3348
+ * 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
3404
3349
  * @format date-time
3405
- * @example "2022-07-31T23:59:59Z"
3350
+ * @example "2022-04-29T08:59:51Z"
3406
3351
  */
3407
- to_datetime: string;
3352
+ created_at: string;
3408
3353
  /**
3409
- * The date of creation of the invoice.
3410
- * @format date
3411
- * @example "2022-08-01"
3354
+ * 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
3355
+ * @format date-time
3356
+ * @example "2022-04-29T08:59:51Z"
3412
3357
  */
3413
- issuing_date: string;
3358
+ updated_at: string;
3359
+ }
3360
+ export interface BillingPeriodObject {
3414
3361
  /**
3415
- * A unique identifier associated with the invoice related to this particular usage record.
3362
+ * Unique identifier assigned to the subscription, created by Lago.
3416
3363
  * @format uuid
3417
3364
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3418
3365
  */
3419
- lago_invoice_id?: string | null;
3366
+ lago_subscription_id: string;
3420
3367
  /**
3421
- * The currency of the customer's current usage.
3422
- * @example "EUR"
3368
+ * Unique identifier assigned to the subscription in your application.
3369
+ * @example "external_id"
3423
3370
  */
3424
- currency?: Currency;
3371
+ external_subscription_id: string;
3425
3372
  /**
3426
- * The amount in cents, tax excluded.
3427
- * @example 123
3373
+ * Unique identifier assigned to the plan, created by Lago.
3374
+ * @format uuid
3375
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3428
3376
  */
3429
- amount_cents: number;
3377
+ lago_plan_id: string;
3430
3378
  /**
3431
- * The projected amount in cents, tax excluded.
3432
- * @example 256
3379
+ * The beginning date of the subscription billing period. This field indicates the start date of the billing period associated with the subscription fee.
3380
+ * @format date-time
3381
+ * @example "2022-04-29T08:59:51Z"
3433
3382
  */
3434
- projected_amount_cents: number;
3383
+ subscription_from_datetime: string;
3435
3384
  /**
3436
- * The tax amount in cents.
3437
- * @example 200
3385
+ * The ending date of the subscription billing period. This field indicates the end date of the billing period associated with the subscription fee.
3386
+ * @format date-time
3387
+ * @example "2022-05-29T08:59:51Z"
3438
3388
  */
3439
- taxes_amount_cents: number;
3389
+ subscription_to_datetime: string;
3440
3390
  /**
3441
- * The total amount in cents, tax included.
3442
- * @example 123
3391
+ * 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.
3392
+ * @format date-time
3393
+ * @example "2022-04-29T08:59:51Z"
3443
3394
  */
3444
- total_amount_cents: number;
3445
- /** Array of charges that comprise the current usage. It contains detailed information about individual charge items associated with the usage. */
3446
- charges_usage: CustomerChargeUsageObject[];
3447
- }
3448
- export interface CustomerProjectedUsage {
3449
- customer_projected_usage: CustomerProjectedUsageObject;
3450
- }
3451
- export interface CustomerPastUsage {
3452
- usage_periods: CustomerUsage[];
3453
- meta: PaginationMeta;
3395
+ charges_from_datetime: string;
3396
+ /**
3397
+ * 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.
3398
+ * @format date-time
3399
+ * @example "2022-05-29T08:59:51Z"
3400
+ */
3401
+ charges_to_datetime: string;
3402
+ /**
3403
+ * The reason explaining why this subscription appears on the invoice.
3404
+ * @example "subscription_starting"
3405
+ */
3406
+ invoicing_reason: "subscription_starting" | "subscription_periodic" | "subscription_terminating" | "in_advance_charge" | "in_advance_charge_periodic" | "progressive_billing";
3454
3407
  }
3455
- /** . */
3456
- export interface CustomerCheckoutUrl {
3457
- customer?: {
3458
- /**
3459
- * 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
3460
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3461
- */
3462
- lago_customer_id: string;
3463
- /**
3464
- * The customer external unique identifier (provided by your own application)
3465
- * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
3466
- */
3467
- external_customer_id: string;
3468
- /**
3469
- * The Payment Provider name linked to the Customer.
3470
- * @example "stripe"
3471
- */
3472
- payment_provider: string;
3473
- /**
3474
- * Code of the payment provider
3475
- * @example "Stripe Prod"
3476
- */
3477
- payment_provider_code?: string;
3478
- /**
3479
- * The new generated Payment Provider Checkout URL for the Customer.
3480
- * @example "https://foo.bar"
3481
- */
3482
- checkout_url?: string;
3483
- };
3408
+ export interface InvoiceMetadataObject {
3409
+ /**
3410
+ * Unique identifier assigned to the invoice metadata within the Lago application.
3411
+ * @format uuid
3412
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3413
+ */
3414
+ lago_id?: string;
3415
+ /**
3416
+ * Represents the key of the metadata's key-value pair.
3417
+ * @example "digital_ref_id"
3418
+ */
3419
+ key?: string;
3420
+ /**
3421
+ * Represents the value of the metadata's key-value pair.
3422
+ * @example "INV-0123456-98765"
3423
+ */
3424
+ value?: string;
3425
+ /**
3426
+ * 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).
3427
+ * @format date-time
3428
+ * @example "2022-04-29T08:59:51Z"
3429
+ */
3430
+ created_at?: string;
3484
3431
  }
3485
- export interface EventObject {
3432
+ export type InvoiceAppliedTaxObject = BaseAppliedTax & {
3486
3433
  /**
3487
- * 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
3434
+ * Unique identifier of the invoice, created by Lago.
3488
3435
  * @format uuid
3489
3436
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3490
3437
  */
3491
- lago_id: string;
3438
+ lago_invoice_id?: string;
3492
3439
  /**
3493
- * 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.
3494
- * @example "transaction_1234567890"
3440
+ * Fees total amount on which the tax is applied
3441
+ * @example 20000
3495
3442
  */
3496
- transaction_id: string;
3443
+ fees_amount_cents?: number;
3444
+ };
3445
+ export interface UsageThresholdObject {
3497
3446
  /**
3498
- * 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
3447
+ * Unique identifier of the usage threshold created by Lago.
3499
3448
  * @format uuid
3500
3449
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3501
3450
  */
3502
- lago_customer_id: string | null;
3451
+ lago_id: string;
3503
3452
  /**
3504
- * 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.
3505
- * @example "storage"
3453
+ * The display name of the usage threshold.
3454
+ * @example "Threshold 1"
3506
3455
  */
3507
- code: string;
3456
+ threshold_display_name: string | null;
3508
3457
  /**
3509
- * 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.
3510
- * @format date-time
3511
- * @example "2022-04-29T08:59:51.123Z"
3458
+ * The amount to reach to trigger a `progressive_billing` invoice.
3459
+ * @example 10000
3512
3460
  */
3513
- timestamp: string;
3461
+ amount_cents: number;
3514
3462
  /**
3515
- * The precise total amount that was sent in the event payload. This filed is used by the `dynamic` pricing model.
3516
- * @example "1234.56"
3463
+ * 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.
3464
+ * @example true
3517
3465
  */
3518
- precise_total_amount_cents?: string | null;
3466
+ recurring: boolean;
3519
3467
  /**
3520
- * 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.
3521
- * @example {"gb":10}
3468
+ * The date and time when the usage threshold was created. It is expressed in UTC format according to the ISO 8601 datetime standard.
3469
+ * @format date-time
3470
+ * @example "2023-06-27T19:43:42Z"
3522
3471
  */
3523
- properties?: {
3524
- /** 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. */
3525
- operation_type?: "add" | "remove";
3526
- [key: string]: any;
3527
- };
3472
+ created_at: string;
3528
3473
  /**
3529
- * 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
3530
- * @format uuid
3531
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3474
+ * The date and time when the usage threshold was last updated. It is expressed in UTC format according to the ISO 8601 datetime standard.
3475
+ * @format date-time
3476
+ * @example "2023-06-27T19:43:42Z"
3532
3477
  */
3533
- lago_subscription_id: string | null;
3478
+ updated_at: string;
3479
+ }
3480
+ export interface AppliedUsageThresholdObject {
3534
3481
  /**
3535
- * 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.
3536
- * @example "sub_1234567890"
3482
+ * The amount of usage in cents that has been accumulated over the lifetime of the subscription.
3483
+ * @example 2000
3537
3484
  */
3538
- external_subscription_id: string;
3485
+ lifetime_usage_amount_cents: number;
3539
3486
  /**
3540
- * 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
3487
+ * The date and time when the lifetime usage was computed. It is expressed in UTC format according to the ISO 8601 datetime standard.
3541
3488
  * @format date-time
3542
- * @example "2022-04-29T08:59:51Z"
3489
+ * @example "2025-03-31T12:31:44Z"
3543
3490
  */
3544
3491
  created_at: string;
3492
+ usage_threshold: UsageThresholdObject;
3545
3493
  }
3546
- export interface EventsPaginated {
3547
- events: EventObject[];
3494
+ export type InvoiceObject = InvoiceBaseObject & {
3495
+ /** The customer on which the invoice applies. It refers to the customer account or entity associated with the invoice. */
3496
+ customer?: CustomerObject;
3497
+ billing_periods?: BillingPeriodObject[];
3498
+ metadata?: InvoiceMetadataObject[];
3499
+ applied_taxes?: InvoiceAppliedTaxObject[];
3500
+ applied_usage_thresholds?: AppliedUsageThresholdObject[];
3501
+ };
3502
+ export interface InvoicesPaginated {
3503
+ invoices: InvoiceObject[];
3548
3504
  meta: PaginationMeta;
3549
3505
  }
3550
- export interface EventInputObject {
3506
+ export interface PaymentObject {
3551
3507
  /**
3552
- * This field represents a unique identifier for the event.
3553
- * It is crucial for ensuring idempotency, meaning that each event can be uniquely identified and processed without causing any unintended side effects.
3554
- *
3555
- * 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.
3556
- * Event uniqueness is maintained with both `transaction_id` and `timestamp` fields.
3557
- * 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.
3558
- * @example "transaction_1234567890"
3508
+ * The unique identifier of the payment, created by Lago.
3509
+ * @format uuid
3510
+ * @example "4cf085a7-c196-4f07-a543-97c50ec6e8b2"
3559
3511
  */
3560
- transaction_id: string;
3512
+ lago_id: string;
3561
3513
  /**
3562
- * The unique identifier of the subscription in your application. This field is mandatory in order to link events to the correct customer subscription.
3563
- * @example "sub_1234567890"
3514
+ * Unique identifier of the customer, created by Lago.
3515
+ * @format uuid
3516
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3564
3517
  */
3565
- external_subscription_id: string;
3518
+ lago_customer_id: string;
3566
3519
  /**
3567
- * 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.
3568
- * @example "storage"
3520
+ * The customer external unique identifier (provided by your own application)
3521
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
3569
3522
  */
3570
- code: string;
3523
+ external_customer_id: string;
3524
+ /** List of invoice IDs associated with the payment. */
3525
+ invoice_ids: string[];
3571
3526
  /**
3572
- * This field captures the Unix timestamp in seconds indicating the occurrence of the event in Coordinated Universal Time (UTC).
3573
- * If this timestamp is not provided, the API will automatically set it to the time of event reception.
3574
- * You can also provide miliseconds precision by appending decimals to the timestamp.
3575
- * @example "1651240791.123"
3527
+ * The unique identifier of the paid resource, created by Lago.
3528
+ * @format uuid
3529
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3576
3530
  */
3577
- timestamp?: number | string;
3531
+ lago_payable_id: string;
3578
3532
  /**
3579
- * The precise total amount in cents with precision used by the `dynamic` pricing model to compute the usage amount.
3580
- * @example "1234.56"
3533
+ * The type of the paid resource, associated with the `lago_payable_id`.
3534
+ * @example "Invoice"
3581
3535
  */
3582
- precise_total_amount_cents?: string | null;
3536
+ payable_type: "Invoice" | "PaymentRequest";
3583
3537
  /**
3584
- * 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.
3585
- * @example {"gb":10}
3538
+ * The amount of the payment in cents.
3539
+ * @example 1099
3586
3540
  */
3587
- properties?: object | null;
3588
- }
3589
- export interface EventInput {
3590
- event: EventInputObject;
3591
- }
3592
- export interface EventCreated {
3593
- event: EventObject & {
3594
- /**
3595
- * The value will always be null in this response as the event processing is done asynchronously
3596
- * @example null
3597
- */
3598
- lago_customer_id?: null;
3599
- };
3541
+ amount_cents: number;
3542
+ /**
3543
+ * The currency of the payment amount.
3544
+ * @example "USD"
3545
+ */
3546
+ amount_currency: Currency;
3547
+ /**
3548
+ * The status of the payment within the payment provider. This can be very different from a payment provider to another.
3549
+ * @example "Completed"
3550
+ */
3551
+ status: string;
3552
+ /**
3553
+ * The normalized payment status by Lago.
3554
+ * @example "succeeded"
3555
+ */
3556
+ payment_status: "succeeded" | "failed" | "pending" | "processing";
3557
+ /**
3558
+ * The type of payment.
3559
+ * @example "manual"
3560
+ */
3561
+ type: "manual" | "provider";
3562
+ /**
3563
+ * Reference for the payment.
3564
+ * @example "ref1"
3565
+ */
3566
+ reference: string;
3567
+ /**
3568
+ * Code of the payment provider
3569
+ * @example "stripe_prod"
3570
+ */
3571
+ payment_provider_code: string;
3572
+ /**
3573
+ * The type of payment provider
3574
+ * @example "stripe"
3575
+ */
3576
+ payment_provider_type: "adyen" | "cashfree" | "gocardless" | "stripe" | "flutterwave" | "moneyhash";
3577
+ /** DEPRECATED: use provider_payment_id */
3578
+ external_payment_id: string | null;
3579
+ /**
3580
+ * Unique identifier of the payment within the payment provider (if applicable).
3581
+ * @example "pi_5eb0285741bc6ba"
3582
+ */
3583
+ provider_payment_id: string | null;
3584
+ /**
3585
+ * Unique identifier of the customer within the payment provider
3586
+ * @example "cus_5eb0285bcf941bc6ba"
3587
+ */
3588
+ provider_customer_id: string;
3589
+ /**
3590
+ * 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.
3591
+ * @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"}}
3592
+ */
3593
+ next_action: Record<string, any>;
3594
+ /**
3595
+ * Timestamp when the payment was created in Lago's database, not on the payment provider.
3596
+ * @format date-time
3597
+ * @example "2025-01-21T00:10:29Z"
3598
+ */
3599
+ created_at: string;
3600
3600
  }
3601
- export interface EventBatchInput {
3602
- events: EventInputObject[];
3601
+ export interface PaymentsPaginated {
3602
+ payments: PaymentObject[];
3603
+ meta: PaginationMeta;
3603
3604
  }
3604
- export interface EventsCreated {
3605
- events: (EventObject & {
3606
- /**
3607
- * The value will always be null in this response as the event processing is done asynchronously
3608
- * @example null
3609
- */
3610
- lago_customer_id?: null;
3611
- })[];
3605
+ export interface PaymentRequestObject {
3606
+ /**
3607
+ * Unique identifier of the payment request, created by Lago.
3608
+ * @format uuid
3609
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3610
+ */
3611
+ lago_id: string;
3612
+ /**
3613
+ * The customer's email address used for sending dunning notifications
3614
+ * @format email
3615
+ * @example "dinesh@piedpiper.test"
3616
+ */
3617
+ email: string;
3618
+ /**
3619
+ * The sum of the total amounts of all the invoices included in the payment request, expressed in cents.
3620
+ * @example 100
3621
+ */
3622
+ amount_cents: number;
3623
+ /**
3624
+ * The currency of the payment request.
3625
+ * @example "EUR"
3626
+ */
3627
+ amount_currency: Currency;
3628
+ /**
3629
+ * The status of the payment associated with the payment request. It can have one of the following values:
3630
+ * - `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.
3631
+ * - `succeeded`: the payment of the payment request has been successfully processed.
3632
+ * - `failed`: the payment of the payment request has failed or encountered an error during processing.
3633
+ * @example "succeeded"
3634
+ */
3635
+ payment_status: "pending" | "succeeded" | "failed";
3636
+ /**
3637
+ * 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.
3638
+ * @format date-time
3639
+ * @example "2022-04-29T08:59:51Z"
3640
+ */
3641
+ created_at: string;
3642
+ /** The customer on which the payment request applies. It refers to the customer account or entity associated with the payment request. */
3643
+ customer: CustomerBaseObject;
3644
+ invoices: InvoiceBaseObject[];
3612
3645
  }
3613
- export interface EventEstimateFeesInput {
3614
- event: {
3615
- /**
3616
- * 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.
3617
- * @example "storage"
3618
- */
3619
- code: string;
3620
- /**
3621
- * The unique identifier of the subscription within your application.
3622
- * @example "sub_1234567890"
3623
- */
3624
- external_subscription_id: string;
3625
- /** 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. */
3626
- properties?: object;
3627
- };
3646
+ export interface PaymentRequestsPaginated {
3647
+ payment_requests: PaymentRequestObject[];
3648
+ meta: PaginationMeta;
3628
3649
  }
3629
- export interface Fees {
3630
- fees: FeeObject[];
3650
+ export interface SubscriptionObject {
3651
+ /**
3652
+ * 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
3653
+ * @format uuid
3654
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3655
+ */
3656
+ lago_id: string;
3657
+ /**
3658
+ * The subscription external unique identifier (provided by your own application).
3659
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
3660
+ */
3661
+ external_id: string;
3662
+ /**
3663
+ * 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
3664
+ * @format uuid
3665
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3666
+ */
3667
+ lago_customer_id: string;
3668
+ /**
3669
+ * The customer external unique identifier (provided by your own application).
3670
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
3671
+ */
3672
+ external_customer_id: string;
3673
+ /**
3674
+ * 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).
3675
+ * @example "anniversary"
3676
+ */
3677
+ billing_time: "calendar" | "anniversary";
3678
+ /**
3679
+ * 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.
3680
+ * @example "Repository A"
3681
+ */
3682
+ name: string | null;
3683
+ /**
3684
+ * 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.
3685
+ * @example "premium"
3686
+ */
3687
+ plan_code: string;
3688
+ /**
3689
+ * The status of the subscription, which can have the following values:
3690
+ * - `active`: the subscription is currently active and applied to the customer.
3691
+ * - `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.
3692
+ * - `pending`: a previous subscription has been downgraded, and the current one is awaiting automatic activation at the end of the billing period.
3693
+ * - `terminated`: the subscription is no longer active.
3694
+ * @example "active"
3695
+ */
3696
+ status: "active" | "canceled" | "pending" | "terminated";
3697
+ /**
3698
+ * 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.
3699
+ * @format date-time
3700
+ * @example "2022-08-08T00:00:00Z"
3701
+ */
3702
+ created_at: string;
3703
+ /**
3704
+ * 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).
3705
+ * @format date-time
3706
+ * @example "2022-09-14T16:35:31Z"
3707
+ */
3708
+ canceled_at: string | null;
3709
+ /**
3710
+ * 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).
3711
+ * @format date-time
3712
+ * @example "2022-08-08T00:00:00Z"
3713
+ */
3714
+ started_at: string | null;
3715
+ /**
3716
+ * 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).
3717
+ * @format date-time
3718
+ * @example "2022-10-08T00:00:00Z"
3719
+ */
3720
+ ending_at: string | null;
3721
+ /**
3722
+ * 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).
3723
+ * @format date-time
3724
+ * @example "2022-08-08T00:00:00Z"
3725
+ */
3726
+ subscription_at: string;
3727
+ /**
3728
+ * 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)
3729
+ * @format date-time
3730
+ * @example "2022-09-14T16:35:31Z"
3731
+ */
3732
+ terminated_at: string | null;
3733
+ /**
3734
+ * The code identifying the previous plan associated with this subscription.
3735
+ * @example null
3736
+ */
3737
+ previous_plan_code: string | null;
3738
+ /**
3739
+ * The code identifying the next plan in the case of a downgrade.
3740
+ * @example null
3741
+ */
3742
+ next_plan_code: string | null;
3743
+ /**
3744
+ * The date when the plan will be downgraded, represented in ISO 8601 date format.
3745
+ * @format date
3746
+ * @example "2022-04-30"
3747
+ */
3748
+ downgrade_plan_date: string | null;
3749
+ /**
3750
+ * The date when the free trial is ended, represented in ISO 8601 date format.
3751
+ * @format date-time
3752
+ * @example "2022-08-08T00:00:00Z"
3753
+ */
3754
+ trial_ended_at: string | null;
3755
+ /**
3756
+ * The date and time when the current billing period started, represented in ISO 8601 date format.
3757
+ * @format date-time
3758
+ * @example "2022-08-08T00:00:00Z"
3759
+ */
3760
+ current_billing_period_started_at: string | null;
3761
+ /**
3762
+ * The date and time when the current billing period ends, represented in ISO 8601 date format.
3763
+ * @format date-time
3764
+ * @example "2022-09-08T00:00:00Z"
3765
+ */
3766
+ current_billing_period_ending_at: string | null;
3767
+ /**
3768
+ * 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.
3769
+ * This field allows you to control the behavior of the credit note generation:
3770
+ *
3771
+ * - `credit`: A credit note is generated for the unused subscription time. The unused amount is credited back to the customer.
3772
+ * - `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.
3773
+ * - `skip`: No credit note is generated for the unused subscription time.
3774
+ *
3775
+ * _Note: This field is only applicable to pay-in-advance plans and will be `null` for pay-in-arrears plans._
3776
+ * @example "credit"
3777
+ */
3778
+ on_termination_credit_note: "credit" | "refund" | "skip";
3779
+ /**
3780
+ * When a subscription is terminated before the end of its billing period, we generate an invoice for the unbilled usage.
3781
+ * This field allows you to control the behavior of the invoice generation:
3782
+ *
3783
+ * - `generate`: An invoice is generated for the unbilled usage.
3784
+ * - `skip`: No invoice is generated for the unbilled usage.
3785
+ * @default "generate"
3786
+ * @example "generate"
3787
+ */
3788
+ on_termination_invoice: "generate" | "skip";
3631
3789
  }
3632
- export interface EventEstimateInstantFeesInput {
3633
- event: {
3634
- /**
3635
- * 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.
3636
- * @example "storage"
3637
- */
3638
- code: string;
3790
+ export interface SubscriptionsPaginated {
3791
+ subscriptions: SubscriptionObject[];
3792
+ meta: PaginationMeta;
3793
+ }
3794
+ /** Object that represents rule for wallet recurring transactions. */
3795
+ export interface WalletRecurringTransactionRule {
3796
+ /**
3797
+ * A unique identifier for the recurring transaction rule in the Lago application. Can be used to update a recurring transaction rule.
3798
+ * @format uuid
3799
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3800
+ */
3801
+ lago_id: string;
3802
+ /**
3803
+ * The trigger. Possible values are `interval` or `threshold`.
3804
+ * @example "interval"
3805
+ */
3806
+ trigger: "interval" | "threshold";
3807
+ /**
3808
+ * The method used for recurring top-up. Possible values are `fixed` or `target`.
3809
+ * @example "target"
3810
+ */
3811
+ method: "fixed" | "target";
3812
+ /**
3813
+ * 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`.
3814
+ * @example "monthly"
3815
+ */
3816
+ interval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
3817
+ /**
3818
+ * The status of the recurring transaction rule. Possible values are `active` or `terminated`.
3819
+ * @example "active"
3820
+ */
3821
+ status: "active" | "terminated";
3822
+ /**
3823
+ * 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`.
3824
+ * @pattern ^[0-9]+.?[0-9]*$
3825
+ * @example "20.0"
3826
+ */
3827
+ threshold_credits: string;
3828
+ /**
3829
+ * The number of paid credits. Required only if there is no granted credits.
3830
+ * @pattern ^[0-9]+.?[0-9]*$
3831
+ * @example "20.0"
3832
+ */
3833
+ paid_credits: string;
3834
+ /**
3835
+ * The number of free granted credits. Required only if there is no paid credits.
3836
+ * @pattern ^[0-9]+.?[0-9]*$
3837
+ * @example "10.0"
3838
+ */
3839
+ granted_credits: string;
3840
+ /**
3841
+ * 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).
3842
+ * @format date-time
3843
+ * @example "2022-08-08T00:00:00Z"
3844
+ */
3845
+ started_at: string | null;
3846
+ /**
3847
+ * 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`.
3848
+ * @pattern ^[0-9]+.?[0-9]*$
3849
+ * @example "200.0"
3850
+ */
3851
+ target_ongoing_balance: string | null;
3852
+ /**
3853
+ * 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
3854
+ * @format date-time
3855
+ * @example "2022-04-29T08:59:51Z"
3856
+ */
3857
+ created_at: string;
3858
+ /**
3859
+ * 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).
3860
+ * @format date-time
3861
+ * @example "2023-09-30T23:59:59Z"
3862
+ */
3863
+ expiration_at: string | null;
3864
+ /**
3865
+ * 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.
3866
+ * @example false
3867
+ */
3868
+ invoice_requires_successful_payment: boolean;
3869
+ /**
3870
+ * 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.
3871
+ * @example [{"key":"example_key","value":"example_value"},{"key":"another_key","value":"another_value"}]
3872
+ */
3873
+ transaction_metadata: {
3874
+ /** The unique identifier for the attribute. */
3875
+ key?: string;
3876
+ /** The value associated with the key. */
3877
+ value?: string;
3878
+ }[];
3879
+ /**
3880
+ * 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`.
3881
+ * @example "Tokens for models 'high-fidelity-boost'"
3882
+ */
3883
+ transaction_name: string | null;
3884
+ /**
3885
+ * When true, allows rule to topped up wallet with transactions that exceed the paid top-up limits. Defaults to false.
3886
+ * @example false
3887
+ */
3888
+ ignore_paid_top_up_limits: boolean;
3889
+ }
3890
+ export interface WalletObject {
3891
+ /**
3892
+ * 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.
3893
+ * @format uuid
3894
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3895
+ */
3896
+ lago_id: string;
3897
+ /**
3898
+ * 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.
3899
+ * @format uuid
3900
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3901
+ */
3902
+ lago_customer_id: string;
3903
+ /**
3904
+ * The customer external unique identifier (provided by your own application)
3905
+ * @example "hooli_1234"
3906
+ */
3907
+ external_customer_id: string;
3908
+ /**
3909
+ * The status of the wallet. Possible values are `active` or `terminated`.
3910
+ * @example "active"
3911
+ */
3912
+ status: "active" | "terminated";
3913
+ /**
3914
+ * The currency of the wallet.
3915
+ * @example "USD"
3916
+ */
3917
+ currency: Currency;
3918
+ /**
3919
+ * The name of the wallet.
3920
+ * @example "Prepaid"
3921
+ */
3922
+ name?: string | null;
3923
+ /**
3924
+ * 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.
3925
+ * @pattern ^[0-9]+.?[0-9]*$
3926
+ * @example "1.5"
3927
+ */
3928
+ rate_amount: string;
3929
+ /**
3930
+ * The current wallet balance expressed in credits. This reflects the available balance after all transactions are settled.
3931
+ * @pattern ^[0-9]+.?[0-9]*$
3932
+ * @example "28.0"
3933
+ */
3934
+ credits_balance: string;
3935
+ /**
3936
+ * The current wallet balance expressed in cents. This reflects the available balance after all transactions are settled.
3937
+ * @example 1000
3938
+ */
3939
+ balance_cents: number;
3940
+ /**
3941
+ * The number of consumed credits.
3942
+ * @pattern ^[0-9]+.?[0-9]*$
3943
+ * @example "2.0"
3944
+ */
3945
+ consumed_credits: string;
3946
+ /**
3947
+ * The date of the wallet creation, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
3948
+ * @format date-time
3949
+ * @example "2022-04-29T08:59:51Z"
3950
+ */
3951
+ created_at: string;
3952
+ /**
3953
+ * 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).
3954
+ * @format date-time
3955
+ * @example null
3956
+ */
3957
+ expiration_at?: string | null;
3958
+ /**
3959
+ * 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).
3960
+ * @format date-time
3961
+ * @example "2022-04-29T08:59:51Z"
3962
+ */
3963
+ last_balance_sync_at?: string | null;
3964
+ /**
3965
+ * The date and time of the last credits consumption. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
3966
+ * @format date-time
3967
+ * @example "2022-04-29T08:59:51Z"
3968
+ */
3969
+ last_consumed_credit_at?: string | null;
3970
+ /**
3971
+ * The date of terminaison of the wallet. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
3972
+ * @format date-time
3973
+ * @example "2022-09-14T16:35:31Z"
3974
+ */
3975
+ terminated_at?: string | null;
3976
+ /**
3977
+ * 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.
3978
+ * @example false
3979
+ */
3980
+ invoice_requires_successful_payment: boolean;
3981
+ /** Set wallet limitations to fee types. */
3982
+ applies_to?: {
3639
3983
  /**
3640
- * The unique identifier of the subscription within your application.
3641
- * @example "sub_1234567890"
3984
+ * 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.
3985
+ * @example ["charge"]
3642
3986
  */
3643
- external_subscription_id: string;
3644
- /** 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. */
3645
- properties?: object;
3987
+ fee_types?: ("charge" | "subscription" | "commitment")[];
3646
3988
  /**
3647
- * This field represents a unique identifier for the event.
3648
- * @example "transaction_1234567890"
3989
+ * 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.
3990
+ * @example ["bm1"]
3649
3991
  */
3650
- transaction_id?: string | null;
3992
+ billable_metric_codes?: string[];
3651
3993
  };
3652
- }
3653
- export interface FeeEstimateObject {
3654
- lago_id?: null;
3994
+ /** List of recurring transaction rules. Currently, we only allow one recurring rule per wallet. */
3995
+ recurring_transaction_rules?: WalletRecurringTransactionRule[];
3655
3996
  /**
3656
- * Unique identifier assigned to the charge that the fee belongs to
3657
- * @format uuid
3658
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3997
+ * 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.
3998
+ * @example 800
3659
3999
  */
3660
- lago_charge_id?: string;
4000
+ ongoing_balance_cents: number;
3661
4001
  /**
3662
- * Unique identifier assigned to the charge filter that the fee belongs to
3663
- * @format uuid
3664
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4002
+ * The ongoing usage balance of the wallet, expressed in cents. This reflects all current usage and draft invoices including taxes.
4003
+ * @example 200
3665
4004
  */
3666
- lago_charge_filter_id?: string | null;
3667
- lago_invoice_id?: null;
3668
- lago_true_up_fee_id?: null;
3669
- lago_true_up_parent_fee_id?: null;
4005
+ ongoing_usage_balance_cents: number;
3670
4006
  /**
3671
- * Unique identifier assigned to the subscription, created by Lago. This field is specifically displayed when the fee type is charge or subscription.
3672
- * @format uuid
3673
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4007
+ * 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.
4008
+ * @pattern ^[0-9]+.?[0-9]*$
4009
+ * @example "8.0"
3674
4010
  */
3675
- lago_subscription_id?: string;
4011
+ credits_ongoing_balance: string;
3676
4012
  /**
3677
- * Unique identifier assigned to the customer, created by Lago. This field is specifically displayed when the fee type is charge or subscription.
3678
- * @format uuid
3679
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4013
+ * The ongoing usage balance of the wallet, expressed in credits. This reflects all current usage and draft invoices including taxes.
4014
+ * @pattern ^[0-9]+.?[0-9]*$
4015
+ * @example "2.0"
3680
4016
  */
3681
- lago_customer_id?: string;
4017
+ credits_ongoing_usage_balance: string;
3682
4018
  /**
3683
- * Unique identifier assigned to the customer in your application. This field is specifically displayed when the fee type is charge or subscription.
3684
- * @example "external_id"
4019
+ * Minimum amount of cents that can be top-up with a single paid transaction.
4020
+ * @example 100
3685
4021
  */
3686
- external_customer_id?: string;
4022
+ paid_top_up_min_amount_cents?: number | null;
3687
4023
  /**
3688
- * Unique identifier assigned to the subscription in your application. This field is specifically displayed when the fee type is charge or subscription.
3689
- * @example "external_id"
4024
+ * Maximum amount of cents that can be top-up with a single paid transaction.
4025
+ * @example 1000
3690
4026
  */
3691
- external_subscription_id?: string;
4027
+ paid_top_up_max_amount_cents?: number | null;
4028
+ }
4029
+ export interface WalletsPaginated {
4030
+ wallets: WalletObject[];
4031
+ meta: PaginationMeta;
4032
+ }
4033
+ /** Details about the pricing unit used for charge usage. */
4034
+ export interface UsagePricingUnitDetailsObject {
3692
4035
  /**
3693
- * The cost of this specific fee, excluding any applicable taxes.
3694
- * @example 100
4036
+ * The amount in cents in the pricing unit.
4037
+ * @example 200
3695
4038
  */
3696
4039
  amount_cents: number;
3697
4040
  /**
3698
- * The cost of this specific fee, excluding any applicable taxes, with precision.
3699
- * @example 1.0001
4041
+ * The short name of the pricing unit.
4042
+ * @example "CR"
3700
4043
  */
3701
- precise_amount?: number;
4044
+ short_name: string;
3702
4045
  /**
3703
- * The cost of this specific fee, including any applicable taxes, with precision.
3704
- * @example 1.0212
4046
+ * The conversion rate from pricing units to the plan's currency.
4047
+ * @example "0.5"
3705
4048
  */
3706
- precise_total_amount?: number;
4049
+ conversion_rate: string;
4050
+ }
4051
+ /** Array of filter object, representing multiple dimensions for a charge item. */
4052
+ export type CustomerChargeFiltersUsageObject = {
3707
4053
  /**
3708
- * The currency of this specific fee. It indicates the monetary unit in which the fee's cost is expressed.
3709
- * @example "EUR"
4054
+ * The number of units consumed for a specific charge filter related to a charge item.
4055
+ * @pattern ^[0-9]+.?[0-9]*$
4056
+ * @example "0.9"
3710
4057
  */
3711
- amount_currency: Currency;
4058
+ units?: string;
3712
4059
  /**
3713
- * The cost of the tax associated with this specific fee.
3714
- * @example 0
4060
+ * The total number of units consumed by the customer for a specific charge item, aggregated across all usage events.
4061
+ * @pattern ^[0-9]+.?[0-9]*$
4062
+ * @example "1.0"
3715
4063
  */
3716
- taxes_amount_cents: number;
4064
+ total_aggregated_units?: string;
3717
4065
  /**
3718
- * The cost of the tax associated with this specific fee, with precision.
3719
- * @example 0
4066
+ * The amount in cents, tax excluded, consumed for a specific charge filter related to a charge item.
4067
+ * @example 1000
3720
4068
  */
3721
- taxes_precise_amount?: number;
4069
+ amount_cents?: number;
3722
4070
  /**
3723
- * The tax rate associated with this specific fee.
3724
- * @example 20
4071
+ * 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.
4072
+ * @example 10
3725
4073
  */
3726
- taxes_rate: number;
4074
+ events_count?: number;
3727
4075
  /**
3728
- * 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.
3729
- * @example "0.32"
4076
+ * Specifies the name that will be displayed on an invoice.
4077
+ * @example "AWS eu-east-1"
3730
4078
  */
3731
- units: string;
3732
- description?: null;
4079
+ invoice_display_name?: string;
4080
+ /** Details about the pricing unit used for charge usage. */
4081
+ pricing_unit_details?: UsagePricingUnitDetailsObject;
3733
4082
  /**
3734
- * The unit amount of the fee per unit, with precision.
3735
- * @example 312.5
4083
+ * List of filter values applied to the usage.
4084
+ * @example {"region":["us-east-1"]}
3736
4085
  */
3737
- precise_unit_amount: number;
4086
+ values?: Record<string, string[]>;
4087
+ }[];
4088
+ /** Array of aggregated fees, grouped by the event properties defined in a `standard` charge model. */
4089
+ export type CustomerChargeGroupedUsageObject = {
3738
4090
  /**
3739
- * The coupon amount applied to the estimated instant fee. It will always returns 0
3740
- * @example "0.0"
4091
+ * The amount in cents, tax excluded, consumed for a specific group related to a charge item.
4092
+ * @example 1000
3741
4093
  */
3742
- precise_coupons_amount_cents?: string;
4094
+ amount_cents?: number;
3743
4095
  /**
3744
- * The cost of this specific fee, including any applicable taxes.
3745
- * @example 120
4096
+ * 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.
4097
+ * @example 10
3746
4098
  */
3747
- total_amount_cents: number;
4099
+ events_count?: number;
3748
4100
  /**
3749
- * The currency of this specific fee, including any applicable taxes.
3750
- * @example "EUR"
4101
+ * The number of units consumed for a specific group related to a charge item.
4102
+ * @pattern ^[0-9]+.?[0-9]*$
4103
+ * @example "0.9"
3751
4104
  */
3752
- total_amount_currency: Currency;
4105
+ units?: string;
3753
4106
  /**
3754
- * 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.
3755
- * @example 1
4107
+ * The total number of units consumed by the customer for a specific charge item, aggregated across all usage events.
4108
+ * @pattern ^[0-9]+.?[0-9]*$
4109
+ * @example "1.0"
3756
4110
  */
3757
- events_count?: number;
4111
+ total_aggregated_units?: string;
4112
+ /** Details about the pricing unit used for charge usage. */
4113
+ pricing_unit_details?: UsagePricingUnitDetailsObject;
4114
+ /** Key value list of event properties aggregated by the charge model */
4115
+ grouped_by?: Record<string, string>;
4116
+ /** Array of filter object, representing multiple dimensions for a charge item. */
4117
+ filters?: CustomerChargeFiltersUsageObject;
4118
+ }[];
4119
+ export interface CustomerChargeUsageObject {
3758
4120
  /**
3759
- * 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).
3760
- * @example true
4121
+ * The number of units consumed by the customer for a specific charge item.
4122
+ * @pattern ^[0-9]+.?[0-9]*$
4123
+ * @example "1.0"
3761
4124
  */
3762
- pay_in_advance: boolean;
4125
+ units: string;
3763
4126
  /**
3764
- * 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.
3765
- * @example true
4127
+ * The total number of units consumed by the customer for a specific charge item, aggregated across all usage events.
4128
+ * @pattern ^[0-9]+.?[0-9]*$
4129
+ * @example "1.0"
3766
4130
  */
3767
- invoiceable: boolean;
4131
+ total_aggregated_units: string;
3768
4132
  /**
3769
- * Indicates the payment status of the fee. It represents the current status of the payment associated with the fee. The value will always `pending`.
3770
- * @example "pending"
4133
+ * 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.
4134
+ * @example 10
3771
4135
  */
3772
- payment_status: "pending";
3773
- created_at?: null;
3774
- succeeded_at?: null;
3775
- failed_at?: null;
3776
- refunded_at?: null;
4136
+ events_count: number;
3777
4137
  /**
3778
- * 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`).
3779
- * @example "transaction_1234567890"
4138
+ * The amount in cents, tax excluded, consumed by the customer for a specific charge item.
4139
+ * @example 123
3780
4140
  */
3781
- event_transaction_id?: string;
3782
- amount_details?: null;
3783
- /** Item attached to the fee */
3784
- item: {
3785
- /**
3786
- * The fee type. The value will be `charge`.
3787
- * @example "charge"
3788
- */
3789
- type: "charge";
3790
- /**
3791
- * The code of the fee item. It will be the code of the `billable_metric`.
3792
- * @example "startup"
3793
- */
3794
- code: string;
4141
+ amount_cents: number;
4142
+ /**
4143
+ * The currency of a usage item consumed by the customer.
4144
+ * @example "EUR"
4145
+ */
4146
+ amount_currency: Currency;
4147
+ /** Details about the pricing unit used for charge usage. */
4148
+ pricing_unit_details?: UsagePricingUnitDetailsObject;
4149
+ /** Object listing all the properties for a specific charge item. */
4150
+ charge: {
3795
4151
  /**
3796
- * The name of the fee item. It will be the name of the `billable_metric`.
3797
- * @example "Startup"
4152
+ * 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.
4153
+ * @format uuid
4154
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3798
4155
  */
3799
- name: string;
4156
+ lago_id: string;
3800
4157
  /**
3801
- * The description of the fee item. It will be the name of the `billable_metric`.
3802
- * @example "Startup description"
4158
+ * The pricing model applied to this charge. Possible values are standard, `graduated`, `percentage`, `package` or `volume`.
4159
+ * @example "graduated"
3803
4160
  */
3804
- description?: string;
4161
+ charge_model: "standard" | "graduated" | "package" | "percentage" | "volume";
3805
4162
  /**
3806
4163
  * 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.
3807
- * @example "Setup Fee (SF1)"
4164
+ * @example "Setup"
3808
4165
  */
3809
4166
  invoice_display_name?: string;
4167
+ };
4168
+ /** The related billable metric object. */
4169
+ billable_metric: {
3810
4170
  /**
3811
- * 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.
3812
- * @example "AWS eu-east-1"
3813
- */
3814
- filter_invoice_display_name?: string | null;
3815
- /** Key value list of event properties */
3816
- filters?: object | null;
3817
- /**
3818
- * Unique identifier of the fee item, created by Lago. It will be the identifier of the `billable_metric`.
4171
+ * 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.
3819
4172
  * @format uuid
3820
4173
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3821
4174
  */
3822
- lago_item_id: string;
4175
+ lago_id: string;
3823
4176
  /**
3824
- * The type of the fee item. Values is `BillableMetric`.
3825
- * @example "BillableMetric"
4177
+ * The name of the billable metric used for this charge.
4178
+ * @example "Storage"
3826
4179
  */
3827
- item_type: "BillableMetric";
3828
- /** Key value list of event properties aggregated by the charge model */
3829
- grouped_by?: Record<string, string>;
3830
- };
3831
- }
3832
- export interface FeesEstimate {
3833
- fees: FeeEstimateObject[];
3834
- }
3835
- export interface EventBatchEstimateInstantFeesInput {
3836
- events: EventEstimateInstantFeesInput[];
3837
- }
3838
- export interface Event {
3839
- event: EventObject;
3840
- }
3841
- export interface FeesPaginated {
3842
- fees: FeeObject[];
3843
- meta: PaginationMeta;
3844
- }
3845
- export interface Fee {
3846
- fee: FeeObject;
3847
- }
3848
- export interface FeeUpdateInput {
3849
- fee: {
4180
+ name: string;
3850
4181
  /**
3851
- * The payment status of the fee. Possible values are `pending`, `succeeded`, `failed` or `refunded`.
3852
- * @example "succeeded"
4182
+ * The code of the billable metric used for this charge.
4183
+ * @example "storage"
3853
4184
  */
3854
- payment_status: "pending" | "succeeded" | "failed" | "refunded";
4185
+ code: string;
4186
+ /**
4187
+ * The aggregation type of the billable metric used for this charge. Possible values are `count_agg`, `sum_agg`, `max_agg` or `unique_count_agg`.
4188
+ * @example "sum_agg"
4189
+ */
4190
+ aggregation_type: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg" | "weighted_sum_agg" | "latest_agg";
3855
4191
  };
4192
+ /** Array of filter object, representing multiple dimensions for a charge item. */
4193
+ filters?: CustomerChargeFiltersUsageObject;
4194
+ /** Array of aggregated fees, grouped by the event properties defined in a `standard` charge model. */
4195
+ grouped_usage?: CustomerChargeGroupedUsageObject;
3856
4196
  }
3857
- export interface InvoiceBaseObject {
3858
- /**
3859
- * 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.
3860
- * @format uuid
3861
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3862
- */
3863
- lago_id: string;
3864
- /**
3865
- * The unique code of the billing entity associated with the invoice
3866
- * @example "acme_corp"
3867
- */
3868
- billing_entity_code: string | null;
3869
- /**
3870
- * 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.
3871
- * @example 2
3872
- */
3873
- sequential_id?: number;
3874
- /**
3875
- * 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.
3876
- * @example "LAG-1234-001-002"
3877
- */
3878
- number: string;
4197
+ export interface CustomerUsageObject {
3879
4198
  /**
3880
- * The date when the invoice was issued. It is provided in the ISO 8601 date format.
3881
- * @format date
3882
- * @example "2022-04-30"
4199
+ * The lower bound of the billing period, expressed in the ISO 8601 datetime format in Coordinated Universal Time (UTC).
4200
+ * @format date-time
4201
+ * @example "2022-07-01T00:00:00Z"
3883
4202
  */
3884
- issuing_date: string;
4203
+ from_datetime: string;
3885
4204
  /**
3886
- * The date when the payment dispute was lost. It is expressed in Coordinated Universal Time (UTC).
4205
+ * The upper bound of the billing period, expressed in the ISO 8601 datetime format in Coordinated Universal Time (UTC).
3887
4206
  * @format date-time
3888
- * @example "2022-09-14T16:35:31Z"
4207
+ * @example "2022-07-31T23:59:59Z"
3889
4208
  */
3890
- payment_dispute_lost_at?: string;
4209
+ to_datetime: string;
3891
4210
  /**
3892
- * The payment due date for the invoice, specified in the ISO 8601 date format.
4211
+ * The date of creation of the invoice.
3893
4212
  * @format date
3894
- * @example "2022-04-30"
3895
- */
3896
- payment_due_date?: string;
3897
- /**
3898
- * Specifies if the payment is considered as overdue.
3899
- * @example true
3900
- */
3901
- payment_overdue?: boolean;
3902
- /**
3903
- * The net payment term, expressed in days, specifies the duration within which a customer is expected to remit payment after the invoice is finalized.
3904
- * @example 30
3905
- */
3906
- net_payment_term?: number;
3907
- /**
3908
- * The type of invoice issued. Possible values are `subscription`, `one-off`, `credit` or `progressive_billing`.
3909
- * @example "subscription"
3910
- */
3911
- invoice_type: "subscription" | "add_on" | "credit" | "one_off" | "progressive_billing";
3912
- /**
3913
- * The status of the invoice. It indicates the current state of the invoice and can have following values:
3914
- * - `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.
3915
- * - `finalized`: the invoice has been issued and finalized. In this state, events cannot be ingested or added to the invoice anymore.
3916
- * - `voided`: the invoice has been issued and subsequently voided. In this state, events cannot be ingested or added to the invoice anymore.
3917
- * - `pending`: the invoice remains pending until the taxes are fetched from the external provider.
3918
- * - `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.
3919
- * @example "finalized"
4213
+ * @example "2022-08-01"
3920
4214
  */
3921
- status: "draft" | "finalized" | "voided" | "failed" | "pending";
4215
+ issuing_date: string;
3922
4216
  /**
3923
- * The status of the payment associated with the invoice. It can have one of the following values:
3924
- * - `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.
3925
- * - `succeeded`: the payment of the invoice has been successfully processed.
3926
- * - `failed`: the payment of the invoice has failed or encountered an error during processing.
3927
- * @example "succeeded"
4217
+ * A unique identifier associated with the invoice related to this particular usage record.
4218
+ * @format uuid
4219
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3928
4220
  */
3929
- payment_status: "pending" | "succeeded" | "failed";
4221
+ lago_invoice_id?: string | null;
3930
4222
  /**
3931
- * The currency of the invoice issued.
4223
+ * The currency of the customer's current usage.
3932
4224
  * @example "EUR"
3933
4225
  */
3934
- currency: Currency;
3935
- /**
3936
- * 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.
3937
- * @example 100
3938
- */
3939
- fees_amount_cents: number;
4226
+ currency?: Currency;
3940
4227
  /**
3941
- * The total sum of all coupons discounted on the invoice. It calculates the cumulative discount amount applied by coupons, expressed in cents.
3942
- * @example 10
4228
+ * The amount in cents, tax excluded.
4229
+ * @example 123
3943
4230
  */
3944
- coupons_amount_cents: number;
4231
+ amount_cents: number;
3945
4232
  /**
3946
- * The total sum of all credit notes discounted on the invoice. It calculates the cumulative discount amount applied by credit notes, expressed in cents.
3947
- * @example 10
4233
+ * The tax amount in cents.
4234
+ * @example 200
3948
4235
  */
3949
- credit_notes_amount_cents: number;
4236
+ taxes_amount_cents: number;
3950
4237
  /**
3951
- * Subtotal amount, excluding taxes, expressed in cents.
3952
- * This field depends on the version number. Here are the definitions based on the version:
3953
- * - Version 1: is equal to the sum of `fees_amount_cents`, minus `coupons_amount_cents`, and minus `prepaid_credit_amount_cents`.
3954
- * - Version 2: is equal to the `fees_amount_cents`.
3955
- * - Version 3 & 4: is equal to the `fees_amount_cents`, minus `coupons_amount_cents`
3956
- * @example 100
4238
+ * The total amount in cents, tax included.
4239
+ * @example 123
3957
4240
  */
3958
- sub_total_excluding_taxes_amount_cents: number;
4241
+ total_amount_cents: number;
4242
+ /** Array of charges that comprise the current usage. It contains detailed information about individual charge items associated with the usage. */
4243
+ charges_usage: CustomerChargeUsageObject[];
4244
+ }
4245
+ export interface CustomerUsage {
4246
+ customer_usage: CustomerUsageObject;
4247
+ }
4248
+ export interface CustomerProjectedUsageObject {
3959
4249
  /**
3960
- * The sum of tax amount associated with the invoice, expressed in cents.
3961
- * @example 20
4250
+ * The lower bound of the billing period, expressed in the ISO 8601 datetime format in Coordinated Universal Time (UTC).
4251
+ * @format date-time
4252
+ * @example "2022-07-01T00:00:00Z"
3962
4253
  */
3963
- taxes_amount_cents: number;
4254
+ from_datetime: string;
3964
4255
  /**
3965
- * Subtotal amount, including taxes, expressed in cents.
3966
- * This field depends on the version number. Here are the definitions based on the version:
3967
- * - Version 1: is equal to the `total_amount_cents`.
3968
- * - Version 2: is equal to the sum of `fees_amount_cents` and `taxes_amount_cents`.
3969
- * - Version 3 & 4: is equal to the sum `sub_total_excluding_taxes_amount_cents` and `taxes_amount_cents`
3970
- * @example 120
4256
+ * The upper bound of the billing period, expressed in the ISO 8601 datetime format in Coordinated Universal Time (UTC).
4257
+ * @format date-time
4258
+ * @example "2022-07-31T23:59:59Z"
3971
4259
  */
3972
- sub_total_including_taxes_amount_cents: number;
4260
+ to_datetime: string;
3973
4261
  /**
3974
- * The total sum of all prepaid credits discounted on the invoice. It calculates the cumulative discount amount applied by prepaid credits, expressed in cents.
3975
- * @example 0
4262
+ * The date of creation of the invoice.
4263
+ * @format date
4264
+ * @example "2022-08-01"
3976
4265
  */
3977
- prepaid_credit_amount_cents: number;
4266
+ issuing_date: string;
3978
4267
  /**
3979
- * The usage already billed in previous invoices. Only apply to `progressive_billing` and `subscription` invoices.
3980
- * @example 0
4268
+ * A unique identifier associated with the invoice related to this particular usage record.
4269
+ * @format uuid
4270
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3981
4271
  */
3982
- progressive_billing_credit_amount_cents: number;
4272
+ lago_invoice_id?: string | null;
3983
4273
  /**
3984
- * 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.
3985
- * @example 100
4274
+ * The currency of the customer's current usage.
4275
+ * @example "EUR"
3986
4276
  */
3987
- total_amount_cents: number;
3988
- /** @example 3 */
3989
- version_number: number;
4277
+ currency?: Currency;
3990
4278
  /**
3991
- * 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.
3992
- * @example false
4279
+ * The amount in cents, tax excluded.
4280
+ * @example 123
3993
4281
  */
3994
- self_billed?: boolean;
4282
+ amount_cents: number;
3995
4283
  /**
3996
- * 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
3997
- * @format uri
3998
- * @example "https://getlago.com/invoice/file"
4284
+ * The projected amount in cents, tax excluded.
4285
+ * @example 256
3999
4286
  */
4000
- file_url?: string;
4287
+ projected_amount_cents: number;
4001
4288
  /**
4002
- * 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
4003
- * @format date-time
4004
- * @example "2022-04-29T08:59:51Z"
4289
+ * The tax amount in cents.
4290
+ * @example 200
4005
4291
  */
4006
- created_at: string;
4292
+ taxes_amount_cents: number;
4007
4293
  /**
4008
- * 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
4009
- * @format date-time
4010
- * @example "2022-04-29T08:59:51Z"
4294
+ * The total amount in cents, tax included.
4295
+ * @example 123
4011
4296
  */
4012
- updated_at: string;
4297
+ total_amount_cents: number;
4298
+ /** Array of charges that comprise the current usage. It contains detailed information about individual charge items associated with the usage. */
4299
+ charges_usage: CustomerChargeUsageObject[];
4013
4300
  }
4014
- export interface BillingPeriodObject {
4301
+ export interface CustomerProjectedUsage {
4302
+ customer_projected_usage: CustomerProjectedUsageObject;
4303
+ }
4304
+ export interface CustomerPastUsage {
4305
+ usage_periods: CustomerUsage[];
4306
+ meta: PaginationMeta;
4307
+ }
4308
+ /** . */
4309
+ export interface CustomerCheckoutUrl {
4310
+ customer?: {
4311
+ /**
4312
+ * 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
4313
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4314
+ */
4315
+ lago_customer_id: string;
4316
+ /**
4317
+ * The customer external unique identifier (provided by your own application)
4318
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4319
+ */
4320
+ external_customer_id: string;
4321
+ /**
4322
+ * The Payment Provider name linked to the Customer.
4323
+ * @example "stripe"
4324
+ */
4325
+ payment_provider: string;
4326
+ /**
4327
+ * Code of the payment provider
4328
+ * @example "Stripe Prod"
4329
+ */
4330
+ payment_provider_code?: string;
4331
+ /**
4332
+ * The new generated Payment Provider Checkout URL for the Customer.
4333
+ * @example "https://foo.bar"
4334
+ */
4335
+ checkout_url?: string;
4336
+ };
4337
+ }
4338
+ export interface EventObject {
4015
4339
  /**
4016
- * Unique identifier assigned to the subscription, created by Lago.
4340
+ * 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
4017
4341
  * @format uuid
4018
4342
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4019
4343
  */
4020
- lago_subscription_id: string;
4344
+ lago_id: string;
4021
4345
  /**
4022
- * Unique identifier assigned to the subscription in your application.
4023
- * @example "external_id"
4346
+ * 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.
4347
+ * @example "transaction_1234567890"
4024
4348
  */
4025
- external_subscription_id: string;
4349
+ transaction_id: string;
4026
4350
  /**
4027
- * Unique identifier assigned to the plan, created by Lago.
4351
+ * 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
4028
4352
  * @format uuid
4029
4353
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4030
4354
  */
4031
- lago_plan_id: string;
4032
- /**
4033
- * The beginning date of the subscription billing period. This field indicates the start date of the billing period associated with the subscription fee.
4034
- * @format date-time
4035
- * @example "2022-04-29T08:59:51Z"
4036
- */
4037
- subscription_from_datetime: string;
4355
+ lago_customer_id: string | null;
4038
4356
  /**
4039
- * The ending date of the subscription billing period. This field indicates the end date of the billing period associated with the subscription fee.
4040
- * @format date-time
4041
- * @example "2022-05-29T08:59:51Z"
4357
+ * 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.
4358
+ * @example "storage"
4042
4359
  */
4043
- subscription_to_datetime: string;
4360
+ code: string;
4044
4361
  /**
4045
- * 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.
4362
+ * 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.
4046
4363
  * @format date-time
4047
- * @example "2022-04-29T08:59:51Z"
4364
+ * @example "2022-04-29T08:59:51.123Z"
4048
4365
  */
4049
- charges_from_datetime: string;
4366
+ timestamp: string;
4050
4367
  /**
4051
- * 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.
4052
- * @format date-time
4053
- * @example "2022-05-29T08:59:51Z"
4368
+ * The precise total amount that was sent in the event payload. This filed is used by the `dynamic` pricing model.
4369
+ * @example "1234.56"
4054
4370
  */
4055
- charges_to_datetime: string;
4371
+ precise_total_amount_cents?: string | null;
4056
4372
  /**
4057
- * The reason explaining why this subscription appears on the invoice.
4058
- * @example "subscription_starting"
4373
+ * 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.
4374
+ * @example {"gb":10}
4059
4375
  */
4060
- invoicing_reason: "subscription_starting" | "subscription_periodic" | "subscription_terminating" | "in_advance_charge" | "in_advance_charge_periodic" | "progressive_billing";
4061
- }
4062
- export interface InvoiceMetadataObject {
4376
+ properties?: {
4377
+ /** 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. */
4378
+ operation_type?: "add" | "remove";
4379
+ [key: string]: any;
4380
+ };
4063
4381
  /**
4064
- * Unique identifier assigned to the invoice metadata within the Lago application.
4382
+ * 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
4065
4383
  * @format uuid
4066
4384
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4067
4385
  */
4068
- lago_id?: string;
4069
- /**
4070
- * Represents the key of the metadata's key-value pair.
4071
- * @example "digital_ref_id"
4072
- */
4073
- key?: string;
4386
+ lago_subscription_id: string | null;
4074
4387
  /**
4075
- * Represents the value of the metadata's key-value pair.
4076
- * @example "INV-0123456-98765"
4388
+ * 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.
4389
+ * @example "sub_1234567890"
4077
4390
  */
4078
- value?: string;
4391
+ external_subscription_id: string;
4079
4392
  /**
4080
- * 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).
4393
+ * 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
4081
4394
  * @format date-time
4082
4395
  * @example "2022-04-29T08:59:51Z"
4083
4396
  */
4084
- created_at?: string;
4397
+ created_at: string;
4085
4398
  }
4086
- export type InvoiceAppliedTaxObject = BaseAppliedTax & {
4087
- /**
4088
- * Unique identifier of the invoice, created by Lago.
4089
- * @format uuid
4090
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4091
- */
4092
- lago_invoice_id?: string;
4093
- /**
4094
- * Fees total amount on which the tax is applied
4095
- * @example 20000
4096
- */
4097
- fees_amount_cents?: number;
4098
- };
4099
- export interface UsageThresholdObject {
4399
+ export interface EventsPaginated {
4400
+ events: EventObject[];
4401
+ meta: PaginationMeta;
4402
+ }
4403
+ export interface EventInputObject {
4100
4404
  /**
4101
- * Unique identifier of the usage threshold created by Lago.
4102
- * @format uuid
4103
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4405
+ * This field represents a unique identifier for the event.
4406
+ * It is crucial for ensuring idempotency, meaning that each event can be uniquely identified and processed without causing any unintended side effects.
4407
+ *
4408
+ * 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.
4409
+ * Event uniqueness is maintained with both `transaction_id` and `timestamp` fields.
4410
+ * 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.
4411
+ * @example "transaction_1234567890"
4104
4412
  */
4105
- lago_id: string;
4413
+ transaction_id: string;
4106
4414
  /**
4107
- * The display name of the usage threshold.
4108
- * @example "Threshold 1"
4415
+ * The unique identifier of the subscription in your application. This field is mandatory in order to link events to the correct customer subscription.
4416
+ * @example "sub_1234567890"
4109
4417
  */
4110
- threshold_display_name: string | null;
4418
+ external_subscription_id: string;
4111
4419
  /**
4112
- * The amount to reach to trigger a `progressive_billing` invoice.
4113
- * @example 10000
4420
+ * 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.
4421
+ * @example "storage"
4114
4422
  */
4115
- amount_cents: number;
4423
+ code: string;
4116
4424
  /**
4117
- * 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.
4118
- * @example true
4425
+ * This field captures the Unix timestamp in seconds indicating the occurrence of the event in Coordinated Universal Time (UTC).
4426
+ * If this timestamp is not provided, the API will automatically set it to the time of event reception.
4427
+ * You can also provide miliseconds precision by appending decimals to the timestamp.
4428
+ * @example "1651240791.123"
4119
4429
  */
4120
- recurring: boolean;
4430
+ timestamp?: number | string;
4121
4431
  /**
4122
- * The date and time when the usage threshold was created. It is expressed in UTC format according to the ISO 8601 datetime standard.
4123
- * @format date-time
4124
- * @example "2023-06-27T19:43:42Z"
4432
+ * The precise total amount in cents with precision used by the `dynamic` pricing model to compute the usage amount.
4433
+ * @example "1234.56"
4125
4434
  */
4126
- created_at: string;
4435
+ precise_total_amount_cents?: string | null;
4127
4436
  /**
4128
- * The date and time when the usage threshold was last updated. It is expressed in UTC format according to the ISO 8601 datetime standard.
4129
- * @format date-time
4130
- * @example "2023-06-27T19:43:42Z"
4437
+ * 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.
4438
+ * @example {"gb":10}
4131
4439
  */
4132
- updated_at: string;
4440
+ properties?: object | null;
4133
4441
  }
4134
- export interface AppliedUsageThresholdObject {
4135
- /**
4136
- * The amount of usage in cents that has been accumulated over the lifetime of the subscription.
4137
- * @example 2000
4138
- */
4139
- lifetime_usage_amount_cents: number;
4140
- /**
4141
- * The date and time when the lifetime usage was computed. It is expressed in UTC format according to the ISO 8601 datetime standard.
4142
- * @format date-time
4143
- * @example "2025-03-31T12:31:44Z"
4144
- */
4145
- created_at: string;
4146
- usage_threshold: UsageThresholdObject;
4442
+ export interface EventInput {
4443
+ event: EventInputObject;
4147
4444
  }
4148
- export type InvoiceObject = InvoiceBaseObject & {
4149
- /** The customer on which the invoice applies. It refers to the customer account or entity associated with the invoice. */
4150
- customer?: CustomerObject;
4151
- billing_periods?: BillingPeriodObject[];
4152
- metadata?: InvoiceMetadataObject[];
4153
- applied_taxes?: InvoiceAppliedTaxObject[];
4154
- applied_usage_thresholds?: AppliedUsageThresholdObject[];
4155
- };
4156
- export interface InvoicesPaginated {
4157
- invoices: InvoiceObject[];
4158
- meta: PaginationMeta;
4445
+ export interface EventCreated {
4446
+ event: EventObject & {
4447
+ /**
4448
+ * The value will always be null in this response as the event processing is done asynchronously
4449
+ * @example null
4450
+ */
4451
+ lago_customer_id?: null;
4452
+ };
4159
4453
  }
4160
- export interface InvoiceOneOffCreateInput {
4161
- invoice: {
4454
+ export interface EventBatchInput {
4455
+ events: EventInputObject[];
4456
+ }
4457
+ export interface EventsCreated {
4458
+ events: (EventObject & {
4162
4459
  /**
4163
- * Unique identifier assigned to the customer in your application.
4164
- * @example "hooli_1234"
4460
+ * The value will always be null in this response as the event processing is done asynchronously
4461
+ * @example null
4462
+ */
4463
+ lago_customer_id?: null;
4464
+ })[];
4465
+ }
4466
+ export interface EventEstimateFeesInput {
4467
+ event: {
4468
+ /**
4469
+ * 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.
4470
+ * @example "storage"
4471
+ */
4472
+ code: string;
4473
+ /**
4474
+ * The unique identifier of the subscription within your application.
4475
+ * @example "sub_1234567890"
4476
+ */
4477
+ external_subscription_id: string;
4478
+ /** 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. */
4479
+ properties?: object;
4480
+ };
4481
+ }
4482
+ export interface Fees {
4483
+ fees: FeeObject[];
4484
+ }
4485
+ export interface EventEstimateInstantFeesInput {
4486
+ event: {
4487
+ /**
4488
+ * 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.
4489
+ * @example "storage"
4490
+ */
4491
+ code: string;
4492
+ /**
4493
+ * The unique identifier of the subscription within your application.
4494
+ * @example "sub_1234567890"
4165
4495
  */
4166
- external_customer_id: string;
4496
+ external_subscription_id: string;
4497
+ /** 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. */
4498
+ properties?: object;
4167
4499
  /**
4168
- * The currency of the invoice.
4169
- * @example "EUR"
4500
+ * This field represents a unique identifier for the event.
4501
+ * @example "transaction_1234567890"
4170
4502
  */
4171
- currency?: Currency;
4172
- fees: {
4173
- /**
4174
- * The code of the add-on used as invoice item.
4175
- * @example "setup_fee"
4176
- */
4177
- add_on_code: string;
4178
- /**
4179
- * 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.
4180
- * @example "Setup Fee (SF1)"
4181
- */
4182
- invoice_display_name?: string;
4183
- /**
4184
- * The amount of the fee per unit, expressed in cents. By default, the amount of the add-on is used.
4185
- * @example 12000
4186
- */
4187
- unit_amount_cents?: number | null;
4188
- /**
4189
- * The quantity of units associated with the fee. By default, only 1 unit is added to the invoice.
4190
- * @pattern ^[0-9]+.?[0-9]*$
4191
- * @example "2.5"
4192
- */
4193
- units?: string | null;
4194
- /**
4195
- * This is a description
4196
- * @example "The description of the fee line item in the invoice. By default, the description of the add-on is used."
4197
- */
4198
- description?: string | null;
4199
- /**
4200
- * 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).
4201
- * @format date-time
4202
- * @example "2022-08-08T00:00:00Z"
4203
- */
4204
- from_datetime?: string;
4205
- /**
4206
- * 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).
4207
- * @format date-time
4208
- * @example "2022-08-08T00:00:00Z"
4209
- */
4210
- to_datetime?: string;
4211
- /** List of unique code used to identify the taxes. */
4212
- tax_codes?: TaxCodes;
4213
- /**
4214
- * If true, the invoice will be created but not sent to the payment provider.
4215
- * @default false
4216
- * @example true
4217
- */
4218
- skip_psp?: boolean | null;
4219
- }[];
4503
+ transaction_id?: string | null;
4220
4504
  };
4221
4505
  }
4222
- export interface SubscriptionObject {
4506
+ export interface FeeEstimateObject {
4507
+ lago_id?: null;
4223
4508
  /**
4224
- * 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
4509
+ * Unique identifier assigned to the charge that the fee belongs to
4225
4510
  * @format uuid
4226
4511
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4227
4512
  */
4228
- lago_id: string;
4513
+ lago_charge_id?: string;
4229
4514
  /**
4230
- * The subscription external unique identifier (provided by your own application).
4231
- * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4515
+ * Unique identifier assigned to the charge filter that the fee belongs to
4516
+ * @format uuid
4517
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4232
4518
  */
4233
- external_id: string;
4519
+ lago_charge_filter_id?: string | null;
4520
+ lago_invoice_id?: null;
4521
+ lago_true_up_fee_id?: null;
4522
+ lago_true_up_parent_fee_id?: null;
4234
4523
  /**
4235
- * 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
4524
+ * Unique identifier assigned to the subscription, created by Lago. This field is specifically displayed when the fee type is charge or subscription.
4236
4525
  * @format uuid
4237
4526
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4238
4527
  */
4239
- lago_customer_id: string;
4528
+ lago_subscription_id?: string;
4240
4529
  /**
4241
- * The customer external unique identifier (provided by your own application).
4242
- * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4530
+ * Unique identifier assigned to the customer, created by Lago. This field is specifically displayed when the fee type is charge or subscription.
4531
+ * @format uuid
4532
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4243
4533
  */
4244
- external_customer_id: string;
4534
+ lago_customer_id?: string;
4245
4535
  /**
4246
- * 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).
4247
- * @example "anniversary"
4536
+ * Unique identifier assigned to the customer in your application. This field is specifically displayed when the fee type is charge or subscription.
4537
+ * @example "external_id"
4248
4538
  */
4249
- billing_time: "calendar" | "anniversary";
4539
+ external_customer_id?: string;
4250
4540
  /**
4251
- * The display name of the subscription on an invoice. This field allows for customization of the subscription's name for billing purposes, especially useful when a single customer has multiple subscriptions using the same plan.
4252
- * @example "Repository A"
4541
+ * Unique identifier assigned to the subscription in your application. This field is specifically displayed when the fee type is charge or subscription.
4542
+ * @example "external_id"
4253
4543
  */
4254
- name: string | null;
4544
+ external_subscription_id?: string;
4255
4545
  /**
4256
- * The unique code representing the plan to be attached to the customer. This code must correspond to the `code` property of one of the active plans.
4257
- * @example "premium"
4546
+ * The cost of this specific fee, excluding any applicable taxes.
4547
+ * @example 100
4258
4548
  */
4259
- plan_code: string;
4549
+ amount_cents: number;
4260
4550
  /**
4261
- * The status of the subscription, which can have the following values:
4262
- * - `active`: the subscription is currently active and applied to the customer.
4263
- * - `canceled`: the subscription has been stopped before its activation. This can occur when two consecutive downgrades have been applied to a customer or when a subscription with a pending status is terminated.
4264
- * - `pending`: a previous subscription has been downgraded, and the current one is awaiting automatic activation at the end of the billing period.
4265
- * - `terminated`: the subscription is no longer active.
4266
- * @example "active"
4551
+ * The cost of this specific fee, excluding any applicable taxes, with precision.
4552
+ * @example 1.0001
4267
4553
  */
4268
- status: "active" | "canceled" | "pending" | "terminated";
4554
+ precise_amount?: number;
4269
4555
  /**
4270
- * The creation date of the subscription, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC). This date provides a timestamp indicating when the subscription was initially created.
4271
- * @format date-time
4272
- * @example "2022-08-08T00:00:00Z"
4556
+ * The cost of this specific fee, including any applicable taxes, with precision.
4557
+ * @example 1.0212
4273
4558
  */
4274
- created_at: string;
4559
+ precise_total_amount?: number;
4275
4560
  /**
4276
- * 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).
4277
- * @format date-time
4278
- * @example "2022-09-14T16:35:31Z"
4561
+ * The currency of this specific fee. It indicates the monetary unit in which the fee's cost is expressed.
4562
+ * @example "EUR"
4279
4563
  */
4280
- canceled_at: string | null;
4564
+ amount_currency: Currency;
4281
4565
  /**
4282
- * The effective start date of the subscription. This field can be null if the subscription is `pending` or `canceled`. This date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
4283
- * @format date-time
4284
- * @example "2022-08-08T00:00:00Z"
4566
+ * The cost of the tax associated with this specific fee.
4567
+ * @example 0
4285
4568
  */
4286
- started_at: string | null;
4569
+ taxes_amount_cents: number;
4287
4570
  /**
4288
- * The effective end date of the subscription. If this field is set to null, the subscription will automatically renew. This date should be provided in ISO 8601 datetime format, and use Coordinated Universal Time (UTC).
4289
- * @format date-time
4290
- * @example "2022-10-08T00:00:00Z"
4571
+ * The cost of the tax associated with this specific fee, with precision.
4572
+ * @example 0
4291
4573
  */
4292
- ending_at: string | null;
4574
+ taxes_precise_amount?: number;
4293
4575
  /**
4294
- * The anniversary date and time of the initial subscription. This date serves as the basis for billing subscriptions with `anniversary` billing time. The `anniversary_date` should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
4295
- * @format date-time
4296
- * @example "2022-08-08T00:00:00Z"
4576
+ * The tax rate associated with this specific fee.
4577
+ * @example 20
4297
4578
  */
4298
- subscription_at: string;
4579
+ taxes_rate: number;
4299
4580
  /**
4300
- * 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)
4301
- * @format date-time
4302
- * @example "2022-09-14T16:35:31Z"
4581
+ * 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.
4582
+ * @example "0.32"
4303
4583
  */
4304
- terminated_at: string | null;
4584
+ units: string;
4585
+ description?: null;
4305
4586
  /**
4306
- * The code identifying the previous plan associated with this subscription.
4307
- * @example null
4587
+ * The unit amount of the fee per unit, with precision.
4588
+ * @example 312.5
4308
4589
  */
4309
- previous_plan_code: string | null;
4590
+ precise_unit_amount: number;
4310
4591
  /**
4311
- * The code identifying the next plan in the case of a downgrade.
4312
- * @example null
4592
+ * The coupon amount applied to the estimated instant fee. It will always returns 0
4593
+ * @example "0.0"
4313
4594
  */
4314
- next_plan_code: string | null;
4595
+ precise_coupons_amount_cents?: string;
4315
4596
  /**
4316
- * The date when the plan will be downgraded, represented in ISO 8601 date format.
4317
- * @format date
4318
- * @example "2022-04-30"
4597
+ * The cost of this specific fee, including any applicable taxes.
4598
+ * @example 120
4319
4599
  */
4320
- downgrade_plan_date: string | null;
4600
+ total_amount_cents: number;
4321
4601
  /**
4322
- * The date when the free trial is ended, represented in ISO 8601 date format.
4323
- * @format date-time
4324
- * @example "2022-08-08T00:00:00Z"
4602
+ * The currency of this specific fee, including any applicable taxes.
4603
+ * @example "EUR"
4325
4604
  */
4326
- trial_ended_at: string | null;
4605
+ total_amount_currency: Currency;
4327
4606
  /**
4328
- * The date and time when the current billing period started, represented in ISO 8601 date format.
4329
- * @format date-time
4330
- * @example "2022-08-08T00:00:00Z"
4607
+ * 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.
4608
+ * @example 1
4331
4609
  */
4332
- current_billing_period_started_at: string | null;
4610
+ events_count?: number;
4333
4611
  /**
4334
- * The date and time when the current billing period ends, represented in ISO 8601 date format.
4335
- * @format date-time
4336
- * @example "2022-09-08T00:00:00Z"
4612
+ * 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).
4613
+ * @example true
4337
4614
  */
4338
- current_billing_period_ending_at: string | null;
4615
+ pay_in_advance: boolean;
4339
4616
  /**
4340
- * When a pay-in-advance subscription is terminated before the end of its billing period, we generate a credit note for the unused subscription time by default.
4341
- * This field allows you to control the behavior of the credit note generation:
4342
- *
4343
- * - `credit`: A credit note is generated for the unused subscription time. The unused amount is credited back to the customer.
4344
- * - `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.
4345
- * - `skip`: No credit note is generated for the unused subscription time.
4346
- *
4347
- * _Note: This field is only applicable to pay-in-advance plans and will be `null` for pay-in-arrears plans._
4348
- * @example "credit"
4617
+ * 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.
4618
+ * @example true
4349
4619
  */
4350
- on_termination_credit_note: "credit" | "refund" | "skip";
4620
+ invoiceable: boolean;
4351
4621
  /**
4352
- * When a subscription is terminated before the end of its billing period, we generate an invoice for the unbilled usage.
4353
- * This field allows you to control the behavior of the invoice generation:
4354
- *
4355
- * - `generate`: An invoice is generated for the unbilled usage.
4356
- * - `skip`: No invoice is generated for the unbilled usage.
4357
- * @default "generate"
4358
- * @example "generate"
4622
+ * Indicates the payment status of the fee. It represents the current status of the payment associated with the fee. The value will always `pending`.
4623
+ * @example "pending"
4359
4624
  */
4360
- on_termination_invoice: "generate" | "skip";
4625
+ payment_status: "pending";
4626
+ created_at?: null;
4627
+ succeeded_at?: null;
4628
+ failed_at?: null;
4629
+ refunded_at?: null;
4630
+ /**
4631
+ * 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`).
4632
+ * @example "transaction_1234567890"
4633
+ */
4634
+ event_transaction_id?: string;
4635
+ amount_details?: null;
4636
+ /** Item attached to the fee */
4637
+ item: {
4638
+ /**
4639
+ * The fee type. The value will be `charge`.
4640
+ * @example "charge"
4641
+ */
4642
+ type: "charge";
4643
+ /**
4644
+ * The code of the fee item. It will be the code of the `billable_metric`.
4645
+ * @example "startup"
4646
+ */
4647
+ code: string;
4648
+ /**
4649
+ * The name of the fee item. It will be the name of the `billable_metric`.
4650
+ * @example "Startup"
4651
+ */
4652
+ name: string;
4653
+ /**
4654
+ * The description of the fee item. It will be the name of the `billable_metric`.
4655
+ * @example "Startup description"
4656
+ */
4657
+ description?: string;
4658
+ /**
4659
+ * 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.
4660
+ * @example "Setup Fee (SF1)"
4661
+ */
4662
+ invoice_display_name?: string;
4663
+ /**
4664
+ * 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.
4665
+ * @example "AWS eu-east-1"
4666
+ */
4667
+ filter_invoice_display_name?: string | null;
4668
+ /** Key value list of event properties */
4669
+ filters?: object | null;
4670
+ /**
4671
+ * Unique identifier of the fee item, created by Lago. It will be the identifier of the `billable_metric`.
4672
+ * @format uuid
4673
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4674
+ */
4675
+ lago_item_id: string;
4676
+ /**
4677
+ * The type of the fee item. Values is `BillableMetric`.
4678
+ * @example "BillableMetric"
4679
+ */
4680
+ item_type: "BillableMetric";
4681
+ /** Key value list of event properties aggregated by the charge model */
4682
+ grouped_by?: Record<string, string>;
4683
+ };
4684
+ }
4685
+ export interface FeesEstimate {
4686
+ fees: FeeEstimateObject[];
4687
+ }
4688
+ export interface EventBatchEstimateInstantFeesInput {
4689
+ events: EventEstimateInstantFeesInput[];
4690
+ }
4691
+ export interface Event {
4692
+ event: EventObject;
4693
+ }
4694
+ export interface FeesPaginated {
4695
+ fees: FeeObject[];
4696
+ meta: PaginationMeta;
4697
+ }
4698
+ export interface Fee {
4699
+ fee: FeeObject;
4700
+ }
4701
+ export interface FeeUpdateInput {
4702
+ fee: {
4703
+ /**
4704
+ * The payment status of the fee. Possible values are `pending`, `succeeded`, `failed` or `refunded`.
4705
+ * @example "succeeded"
4706
+ */
4707
+ payment_status: "pending" | "succeeded" | "failed" | "refunded";
4708
+ };
4709
+ }
4710
+ export interface InvoiceOneOffCreateInput {
4711
+ invoice: {
4712
+ /**
4713
+ * Unique identifier assigned to the customer in your application.
4714
+ * @example "hooli_1234"
4715
+ */
4716
+ external_customer_id: string;
4717
+ /**
4718
+ * The currency of the invoice.
4719
+ * @example "EUR"
4720
+ */
4721
+ currency?: Currency;
4722
+ fees: {
4723
+ /**
4724
+ * The code of the add-on used as invoice item.
4725
+ * @example "setup_fee"
4726
+ */
4727
+ add_on_code: string;
4728
+ /**
4729
+ * 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.
4730
+ * @example "Setup Fee (SF1)"
4731
+ */
4732
+ invoice_display_name?: string;
4733
+ /**
4734
+ * The amount of the fee per unit, expressed in cents. By default, the amount of the add-on is used.
4735
+ * @example 12000
4736
+ */
4737
+ unit_amount_cents?: number | null;
4738
+ /**
4739
+ * The quantity of units associated with the fee. By default, only 1 unit is added to the invoice.
4740
+ * @pattern ^[0-9]+.?[0-9]*$
4741
+ * @example "2.5"
4742
+ */
4743
+ units?: string | null;
4744
+ /**
4745
+ * This is a description
4746
+ * @example "The description of the fee line item in the invoice. By default, the description of the add-on is used."
4747
+ */
4748
+ description?: string | null;
4749
+ /**
4750
+ * 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).
4751
+ * @format date-time
4752
+ * @example "2022-08-08T00:00:00Z"
4753
+ */
4754
+ from_datetime?: string;
4755
+ /**
4756
+ * 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).
4757
+ * @format date-time
4758
+ * @example "2022-08-08T00:00:00Z"
4759
+ */
4760
+ to_datetime?: string;
4761
+ /** List of unique code used to identify the taxes. */
4762
+ tax_codes?: TaxCodes;
4763
+ /**
4764
+ * If true, the invoice will be created but not sent to the payment provider.
4765
+ * @default false
4766
+ * @example true
4767
+ */
4768
+ skip_psp?: boolean | null;
4769
+ }[];
4770
+ };
4361
4771
  }
4362
4772
  export interface ErrorDetailObject {
4363
4773
  /**
@@ -4846,67 +5256,6 @@ export interface OrganizationObject {
4846
5256
  export interface Organization {
4847
5257
  organization: OrganizationObject;
4848
5258
  }
4849
- export interface PaymentObject {
4850
- /**
4851
- * Unique identifier of the payment, created by Lago.
4852
- * @format uuid
4853
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4854
- */
4855
- lago_id: string;
4856
- /**
4857
- * The unique identifier of the paid resource, created by Lago.
4858
- * @format uuid
4859
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4860
- */
4861
- lago_payable_id: string;
4862
- /**
4863
- * Unique identifier of the customer, created by Lago.
4864
- * @format uuid
4865
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4866
- */
4867
- lago_customer_id: string;
4868
- /**
4869
- * The status of the payment within the payment provider
4870
- * @example "processing"
4871
- */
4872
- status: string;
4873
- /**
4874
- * The customer external unique identifier (provided by your own application)
4875
- * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4876
- */
4877
- external_id?: string;
4878
- /**
4879
- * Unique identifier of the customer within the payment provider
4880
- * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4881
- */
4882
- provider_customer_id: string;
4883
- /**
4884
- * Code of the payment provider
4885
- * @example "Stripe Prod"
4886
- */
4887
- payment_provider_code?: string;
4888
- /**
4889
- * The type of payment provider
4890
- * @example "stripe"
4891
- */
4892
- payment_provider_type: "adyen" | "cashfree" | "gocardless" | "stripe";
4893
- /**
4894
- * Unique identifier of the payment within the payment provider
4895
- * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4896
- */
4897
- provider_payment_id: string;
4898
- next_action: Record<string, any>;
4899
- /**
4900
- * The amount of the payment in cents
4901
- * @example 1000
4902
- */
4903
- amount_cents?: number;
4904
- /**
4905
- * The currency of the payment
4906
- * @example "EUR"
4907
- */
4908
- amount_currency?: string;
4909
- }
4910
5259
  export interface PaymentReceiptObject {
4911
5260
  /**
4912
5261
  * Unique identifier of the payment receipt, created by Lago.
@@ -4934,51 +5283,6 @@ export interface PaymentReceiptsPaginated {
4934
5283
  export interface PaymentReceipt {
4935
5284
  payment_receipt: PaymentReceiptObject;
4936
5285
  }
4937
- export interface PaymentRequestObject {
4938
- /**
4939
- * Unique identifier of the payment request, created by Lago.
4940
- * @format uuid
4941
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4942
- */
4943
- lago_id: string;
4944
- /**
4945
- * The customer's email address used for sending dunning notifications
4946
- * @format email
4947
- * @example "dinesh@piedpiper.test"
4948
- */
4949
- email: string;
4950
- /**
4951
- * The sum of the total amounts of all the invoices included in the payment request, expressed in cents.
4952
- * @example 100
4953
- */
4954
- amount_cents: number;
4955
- /**
4956
- * The currency of the payment request.
4957
- * @example "EUR"
4958
- */
4959
- amount_currency: Currency;
4960
- /**
4961
- * The status of the payment associated with the payment request. It can have one of the following values:
4962
- * - `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.
4963
- * - `succeeded`: the payment of the payment request has been successfully processed.
4964
- * - `failed`: the payment of the payment request has failed or encountered an error during processing.
4965
- * @example "succeeded"
4966
- */
4967
- payment_status: "pending" | "succeeded" | "failed";
4968
- /**
4969
- * 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.
4970
- * @format date-time
4971
- * @example "2022-04-29T08:59:51Z"
4972
- */
4973
- created_at: string;
4974
- /** The customer on which the payment request applies. It refers to the customer account or entity associated with the payment request. */
4975
- customer: CustomerBaseObject;
4976
- invoices: InvoiceBaseObject[];
4977
- }
4978
- export interface PaymentRequestsPaginated {
4979
- payment_requests: PaymentRequestObject[];
4980
- meta: PaginationMeta;
4981
- }
4982
5286
  export interface PaymentRequestCreateInput {
4983
5287
  payment_request: {
4984
5288
  /**
@@ -4986,68 +5290,18 @@ export interface PaymentRequestCreateInput {
4986
5290
  * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4987
5291
  */
4988
5292
  external_customer_id: string;
4989
- /**
4990
- * The customer's email address used for sending dunning notifications
4991
- * @format email
4992
- * @example "dinesh@piedpiper.test"
4993
- */
4994
- email: string;
4995
- /** A list of Lago IDs for the customer's overdue invoices to start the dunning process */
4996
- lago_invoice_ids: string[];
4997
- };
4998
- }
4999
- export interface PaymentRequest {
5000
- payment_request: PaymentRequestObject;
5001
- }
5002
- export interface PaymentManualObject {
5003
- /**
5004
- * The unique identifier of the payment, created by Lago.
5005
- * @format uuid
5006
- * @example "4cf085a7-c196-4f07-a543-97c50ec6e8b2"
5007
- */
5008
- lago_id?: string;
5009
- /** List of invoice IDs associated with the payment. */
5010
- invoice_ids?: string[];
5011
- /**
5012
- * The amount of the payment in cents.
5013
- * @example 100
5014
- */
5015
- amount_cents?: number;
5016
- /**
5017
- * The currency of the payment amount.
5018
- * @example "USD"
5019
- */
5020
- amount_currency?: string;
5021
- /**
5022
- * The current status of the payment.
5023
- * @example "succeeded"
5024
- */
5025
- payment_status?: string;
5026
- /**
5027
- * The type of payment.
5028
- * @example "manual"
5029
- */
5030
- type?: string;
5031
- /**
5032
- * Reference for the payment.
5033
- * @example "ref1"
5034
- */
5035
- reference?: string;
5036
- /**
5037
- * External identifier for the payment (if applicable).
5038
- * @example null
5039
- */
5040
- external_payment_id?: string | null;
5041
- /**
5042
- * Timestamp when the payment was created.
5043
- * @format date-time
5044
- * @example "2025-02-20T00:00:00Z"
5045
- */
5046
- created_at?: string;
5293
+ /**
5294
+ * The customer's email address used for sending dunning notifications
5295
+ * @format email
5296
+ * @example "dinesh@piedpiper.test"
5297
+ */
5298
+ email: string;
5299
+ /** A list of Lago IDs for the customer's overdue invoices to start the dunning process */
5300
+ lago_invoice_ids: string[];
5301
+ };
5047
5302
  }
5048
- export interface PaymentsPaginated {
5049
- payments: PaymentManualObject[];
5050
- meta: PaginationMeta;
5303
+ export interface PaymentRequest {
5304
+ payment_request: PaymentRequestObject;
5051
5305
  }
5052
5306
  export interface PaymentCreateInput {
5053
5307
  payment: {
@@ -5075,7 +5329,7 @@ export interface PaymentCreateInput {
5075
5329
  };
5076
5330
  }
5077
5331
  export interface Payment {
5078
- payment: PaymentManualObject;
5332
+ payment: PaymentObject;
5079
5333
  }
5080
5334
  export interface MinimumCommitmentObject {
5081
5335
  /**
@@ -5100,10 +5354,10 @@ export interface MinimumCommitmentObject {
5100
5354
  */
5101
5355
  invoice_display_name?: string;
5102
5356
  /**
5103
- * 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`.
5357
+ * 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`.
5104
5358
  * @example "monthly"
5105
5359
  */
5106
- interval?: "weekly" | "monthly" | "quarterly" | "yearly";
5360
+ interval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
5107
5361
  /**
5108
5362
  * 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.
5109
5363
  * @format date-time
@@ -5446,10 +5700,10 @@ export interface PlanObject {
5446
5700
  */
5447
5701
  code: string;
5448
5702
  /**
5449
- * 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`.
5703
+ * 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`.
5450
5704
  * @example "monthly"
5451
5705
  */
5452
- interval: "weekly" | "monthly" | "quarterly" | "yearly";
5706
+ interval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
5453
5707
  /**
5454
5708
  * The description on the plan.
5455
5709
  * @example ""
@@ -5476,7 +5730,7 @@ export interface PlanObject {
5476
5730
  */
5477
5731
  pay_in_advance?: boolean;
5478
5732
  /**
5479
- * 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`.
5733
+ * 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`.
5480
5734
  * @example null
5481
5735
  */
5482
5736
  bill_charges_monthly?: boolean | null;
@@ -5563,10 +5817,10 @@ export interface PlanCreateInput {
5563
5817
  */
5564
5818
  code?: string;
5565
5819
  /**
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`.
5820
+ * 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
5821
  * @example "monthly"
5568
5822
  */
5569
- interval?: "weekly" | "monthly" | "quarterly" | "yearly";
5823
+ interval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
5570
5824
  /**
5571
5825
  * The description on the plan.
5572
5826
  * @example "Plan for early stage startups."
@@ -5593,7 +5847,7 @@ export interface PlanCreateInput {
5593
5847
  */
5594
5848
  pay_in_advance?: boolean;
5595
5849
  /**
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`.
5850
+ * 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
5851
  * @example null
5598
5852
  */
5599
5853
  bill_charges_monthly?: boolean | null;
@@ -5708,10 +5962,10 @@ export interface PlanUpdateInput {
5708
5962
  */
5709
5963
  code?: string;
5710
5964
  /**
5711
- * 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`.
5965
+ * 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`.
5712
5966
  * @example "monthly"
5713
5967
  */
5714
- interval?: "weekly" | "monthly" | "quarterly" | "yearly";
5968
+ interval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
5715
5969
  /**
5716
5970
  * The description on the plan.
5717
5971
  * @example "Plan for early stage startups."
@@ -5738,7 +5992,7 @@ export interface PlanUpdateInput {
5738
5992
  */
5739
5993
  pay_in_advance?: boolean;
5740
5994
  /**
5741
- * 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`.
5995
+ * 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`.
5742
5996
  * @example null
5743
5997
  */
5744
5998
  bill_charges_monthly?: boolean | null;
@@ -5848,10 +6102,6 @@ export interface EntitlementUpdateInput {
5848
6102
  */
5849
6103
  entitlements: Record<string, Record<string, number | boolean | string>>;
5850
6104
  }
5851
- export interface SubscriptionsPaginated {
5852
- subscriptions: SubscriptionObject[];
5853
- meta: PaginationMeta;
5854
- }
5855
6105
  /** Based plan overrides. */
5856
6106
  export interface PlanOverridesObject {
5857
6107
  /**
@@ -5944,28 +6194,28 @@ export interface PlanOverridesObject {
5944
6194
  usage_thresholds?: UsageThresholdInput[];
5945
6195
  }
5946
6196
  export interface SubscriptionCreateInput {
5947
- subscription: {
6197
+ /**
6198
+ * 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.
6199
+ *
6200
+ * Important notes:
6201
+ * - The final amount due for the subscription is not known at the time of creation; it is determined only after the invoice is finalized.
6202
+ * - The payment intent generated for pre-authorization cannot be reused, as the final invoice amount may exceed the authorized amount.
6203
+ * - The payment intent is canceled immediately after creation, but this cancellation occurs asynchronously.
6204
+ * - 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.
6205
+ */
6206
+ authorization?: {
5948
6207
  /**
5949
- * Optionally, you can create a pre-authorization on the customer's card before creating a subscription. This process places a temporary hold (capture) for a specified amount on the customer's account, but does not actually withdraw the funds.
5950
- *
5951
- * Important notes:
5952
- * - The final amount due for the subscription is not known at the time of creation; it is determined only after the invoice is finalized.
5953
- * - The payment intent generated for pre-authorization cannot be reused, as the final invoice amount may exceed the authorized amount.
5954
- * - The payment intent is canceled immediately after creation, but this cancellation occurs asynchronously.
5955
- * - For these reasons, it is recommended to use a small amount (such as $1) for pre-authorization. While this does not guarantee sufficient funds for the final payment, it helps reduce the likelihood of payment errors.
6208
+ * The amount of the authorization in cents.
6209
+ * @example 1000
5956
6210
  */
5957
- authorization?: {
5958
- /**
5959
- * The amount of the authorization in cents.
5960
- * @example 1000
5961
- */
5962
- amount_cents: number;
5963
- /**
5964
- * The currency of the authorization.
5965
- * @example "USD"
5966
- */
5967
- amount_currency: string;
5968
- };
6211
+ amount_cents: number;
6212
+ /**
6213
+ * The currency of the authorization.
6214
+ * @example "USD"
6215
+ */
6216
+ amount_currency: string;
6217
+ };
6218
+ subscription: {
5969
6219
  /**
5970
6220
  * The code of the billing entity to be used for the subscription. If not provided, the default billing entity will be used.
5971
6221
  * @example "default"
@@ -6344,225 +6594,6 @@ export interface Tax {
6344
6594
  export interface TaxUpdateInput {
6345
6595
  tax: TaxBaseInput;
6346
6596
  }
6347
- /** Object that represents rule for wallet recurring transactions. */
6348
- export interface WalletRecurringTransactionRule {
6349
- /**
6350
- * A unique identifier for the recurring transaction rule in the Lago application. Can be used to update a recurring transaction rule.
6351
- * @format uuid
6352
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
6353
- */
6354
- lago_id: string;
6355
- /**
6356
- * The trigger. Possible values are `interval` or `threshold`.
6357
- * @example "interval"
6358
- */
6359
- trigger: "interval" | "threshold";
6360
- /**
6361
- * The method used for recurring top-up. Possible values are `fixed` or `target`.
6362
- * @example "target"
6363
- */
6364
- method: "fixed" | "target";
6365
- /**
6366
- * 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`.
6367
- * @example "monthly"
6368
- */
6369
- interval: "weekly" | "monthly" | "quarterly" | "yearly";
6370
- /**
6371
- * The status of the recurring transaction rule. Possible values are `active` or `terminated`.
6372
- * @example "active"
6373
- */
6374
- status?: "active" | "terminated";
6375
- /**
6376
- * 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`.
6377
- * @pattern ^[0-9]+.?[0-9]*$
6378
- * @example "20.0"
6379
- */
6380
- threshold_credits: string;
6381
- /**
6382
- * The number of paid credits. Required only if there is no granted credits.
6383
- * @pattern ^[0-9]+.?[0-9]*$
6384
- * @example "20.0"
6385
- */
6386
- paid_credits: string;
6387
- /**
6388
- * The number of free granted credits. Required only if there is no paid credits.
6389
- * @pattern ^[0-9]+.?[0-9]*$
6390
- * @example "10.0"
6391
- */
6392
- granted_credits: string;
6393
- /**
6394
- * 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).
6395
- * @format date-time
6396
- * @example "2022-08-08T00:00:00Z"
6397
- */
6398
- started_at?: string | null;
6399
- /**
6400
- * 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`.
6401
- * @pattern ^[0-9]+.?[0-9]*$
6402
- * @example "200.0"
6403
- */
6404
- target_ongoing_balance: string | null;
6405
- /**
6406
- * 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
6407
- * @format date-time
6408
- * @example "2022-04-29T08:59:51Z"
6409
- */
6410
- created_at: string;
6411
- /**
6412
- * 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).
6413
- * @format date-time
6414
- * @example "2023-09-30T23:59:59Z"
6415
- */
6416
- expiration_at?: string | null;
6417
- /**
6418
- * 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.
6419
- * @example false
6420
- */
6421
- invoice_requires_successful_payment?: boolean;
6422
- /**
6423
- * 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.
6424
- * @example [{"key":"example_key","value":"example_value"},{"key":"another_key","value":"another_value"}]
6425
- */
6426
- transaction_metadata?: {
6427
- /** The unique identifier for the attribute. */
6428
- key?: string;
6429
- /** The value associated with the key. */
6430
- value?: string;
6431
- }[];
6432
- }
6433
- export interface WalletObject {
6434
- /**
6435
- * 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.
6436
- * @format uuid
6437
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
6438
- */
6439
- lago_id: string;
6440
- /**
6441
- * 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.
6442
- * @format uuid
6443
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
6444
- */
6445
- lago_customer_id: string;
6446
- /**
6447
- * The customer external unique identifier (provided by your own application)
6448
- * @example "hooli_1234"
6449
- */
6450
- external_customer_id: string;
6451
- /**
6452
- * The status of the wallet. Possible values are `active` or `terminated`.
6453
- * @example "active"
6454
- */
6455
- status: "active" | "terminated";
6456
- /**
6457
- * The currency of the wallet.
6458
- * @example "USD"
6459
- */
6460
- currency: Currency;
6461
- /**
6462
- * The name of the wallet.
6463
- * @example "Prepaid"
6464
- */
6465
- name?: string | null;
6466
- /**
6467
- * 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.
6468
- * @pattern ^[0-9]+.?[0-9]*$
6469
- * @example "1.5"
6470
- */
6471
- rate_amount: string;
6472
- /**
6473
- * The current wallet balance expressed in credits. This reflects the available balance after all transactions are settled.
6474
- * @pattern ^[0-9]+.?[0-9]*$
6475
- * @example "28.0"
6476
- */
6477
- credits_balance: string;
6478
- /**
6479
- * The current wallet balance expressed in cents. This reflects the available balance after all transactions are settled.
6480
- * @example 1000
6481
- */
6482
- balance_cents: number;
6483
- /**
6484
- * The number of consumed credits.
6485
- * @pattern ^[0-9]+.?[0-9]*$
6486
- * @example "2.0"
6487
- */
6488
- consumed_credits: string;
6489
- /**
6490
- * The date of the wallet creation, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
6491
- * @format date-time
6492
- * @example "2022-04-29T08:59:51Z"
6493
- */
6494
- created_at: string;
6495
- /**
6496
- * 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).
6497
- * @format date-time
6498
- * @example null
6499
- */
6500
- expiration_at?: string | null;
6501
- /**
6502
- * 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).
6503
- * @format date-time
6504
- * @example "2022-04-29T08:59:51Z"
6505
- */
6506
- last_balance_sync_at?: string | null;
6507
- /**
6508
- * The date and time of the last credits consumption. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
6509
- * @format date-time
6510
- * @example "2022-04-29T08:59:51Z"
6511
- */
6512
- last_consumed_credit_at?: string | null;
6513
- /**
6514
- * The date of terminaison of the wallet. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
6515
- * @format date-time
6516
- * @example "2022-09-14T16:35:31Z"
6517
- */
6518
- terminated_at?: string | null;
6519
- /**
6520
- * 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.
6521
- * @example false
6522
- */
6523
- invoice_requires_successful_payment: boolean;
6524
- /** Set wallet limitations to fee types. */
6525
- applies_to?: {
6526
- /**
6527
- * 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.
6528
- * @example ["charge"]
6529
- */
6530
- fee_types?: ("charge" | "subscription" | "commitment")[];
6531
- /**
6532
- * 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.
6533
- * @example ["bm1"]
6534
- */
6535
- billable_metric_codes?: string[];
6536
- };
6537
- /** List of recurring transaction rules. Currently, we only allow one recurring rule per wallet. */
6538
- recurring_transaction_rules?: WalletRecurringTransactionRule[];
6539
- /**
6540
- * 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.
6541
- * @example 800
6542
- */
6543
- ongoing_balance_cents: number;
6544
- /**
6545
- * The ongoing usage balance of the wallet, expressed in cents. This reflects all current usage and draft invoices including taxes.
6546
- * @example 200
6547
- */
6548
- ongoing_usage_balance_cents: number;
6549
- /**
6550
- * 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.
6551
- * @pattern ^[0-9]+.?[0-9]*$
6552
- * @example "8.0"
6553
- */
6554
- credits_ongoing_balance: string;
6555
- /**
6556
- * The ongoing usage balance of the wallet, expressed in credits. This reflects all current usage and draft invoices including taxes.
6557
- * @pattern ^[0-9]+.?[0-9]*$
6558
- * @example "2.0"
6559
- */
6560
- credits_ongoing_usage_balance: string;
6561
- }
6562
- export interface WalletsPaginated {
6563
- wallets: WalletObject[];
6564
- meta: PaginationMeta;
6565
- }
6566
6597
  export interface WalletCreateInput {
6567
6598
  wallet?: {
6568
6599
  /**
@@ -6614,6 +6645,11 @@ export interface WalletCreateInput {
6614
6645
  * @example [{"key":"example_key","value":"example_value"},{"key":"another_key","value":"another_value"}]
6615
6646
  */
6616
6647
  transaction_metadata?: any[] | null;
6648
+ /**
6649
+ * 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`.
6650
+ * @example "Tokens for models 'high-fidelity-boost'"
6651
+ */
6652
+ transaction_name?: string | null;
6617
6653
  /** Set wallet limitations to fee types. */
6618
6654
  applies_to?: {
6619
6655
  /**
@@ -6627,6 +6663,21 @@ export interface WalletCreateInput {
6627
6663
  */
6628
6664
  billable_metric_codes?: any[] | null;
6629
6665
  };
6666
+ /**
6667
+ * Minimum amount of cents that can be top-up with a single paid transaction.
6668
+ * @example 100
6669
+ */
6670
+ paid_top_up_min_amount_cents?: number | null;
6671
+ /**
6672
+ * Maximum amount of cents that can be top-up with a single paid transaction.
6673
+ * @example 1000
6674
+ */
6675
+ paid_top_up_max_amount_cents?: number | null;
6676
+ /**
6677
+ * If set to true, the wallet will ignore paid top-up limits on creation.
6678
+ * @example false
6679
+ */
6680
+ ignore_paid_top_up_limits_on_creation?: boolean | null;
6630
6681
  /** List of recurring transaction rules. Currently, we only allow one recurring rule per wallet. */
6631
6682
  recurring_transaction_rules?: any[] | null;
6632
6683
  };
@@ -6671,10 +6722,10 @@ export interface WalletUpdateInput {
6671
6722
  */
6672
6723
  method?: "fixed" | "target";
6673
6724
  /**
6674
- * 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`.
6725
+ * 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`.
6675
6726
  * @example "monthly"
6676
6727
  */
6677
- interval?: "weekly" | "monthly" | "quarterly" | "yearly";
6728
+ interval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
6678
6729
  /**
6679
6730
  * 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`.
6680
6731
  * @pattern ^[0-9]+.?[0-9]*$
@@ -6726,6 +6777,11 @@ export interface WalletUpdateInput {
6726
6777
  /** The value associated with the key. */
6727
6778
  value?: string;
6728
6779
  }[];
6780
+ /**
6781
+ * 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`.
6782
+ * @example "Tokens for models 'high-fidelity-boost'"
6783
+ */
6784
+ transaction_name?: string | null;
6729
6785
  }[];
6730
6786
  /** Set wallet limitations to fee types. */
6731
6787
  applies_to?: {
@@ -6780,6 +6836,11 @@ export interface WalletTransactionCreateInput {
6780
6836
  * @example false
6781
6837
  */
6782
6838
  invoice_requires_successful_payment?: boolean;
6839
+ /**
6840
+ * When true, allows topping up the wallet with transactions that exceed the paid top-up limits. Defaults to false.
6841
+ * @example false
6842
+ */
6843
+ ignore_paid_top_up_limits?: boolean;
6783
6844
  /**
6784
6845
  * This optional field allows you to store a list of key-value pairs that hold additional information or custom attributes related to the data.
6785
6846
  * @example [{"key":"example key","value":"example value"},{"key":"another key","value":"another value"}]
@@ -7465,7 +7526,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
7465
7526
  }
7466
7527
  /**
7467
7528
  * @title Lago API documentation
7468
- * @version 1.33.3
7529
+ * @version 1.36.0
7469
7530
  * @license AGPLv3
7470
7531
  * @baseUrl https://api.getlago.com/api/v1
7471
7532
  * @externalDocs https://github.com/getlago
@@ -7803,7 +7864,8 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
7803
7864
  *
7804
7865
  * - Revenue from `monthly` subscription invoices is included in the MRR for the month in which the invoice is issued.
7805
7866
  * - 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).
7806
- * - 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).
7867
+ * - 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).
7868
+ * - 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).
7807
7869
  * - 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.
7808
7870
  */
7809
7871
  currency?: Currency;
@@ -8340,6 +8402,51 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
8340
8402
  * @example ["billing_entity_code_1","billing_entity_code_2"]
8341
8403
  */
8342
8404
  "billing_entity_codes[]"?: string[];
8405
+ /**
8406
+ * Filter customers by search term. This will filter all customers whose name, firstname, lastname, legal name, external id or email contain the search term.
8407
+ * @example "John Doe"
8408
+ */
8409
+ search_term?: string;
8410
+ /**
8411
+ * Filter customers by countries. Possible values are the ISO 3166-1 alpha-2 codes.
8412
+ * @example ["US","FR"]
8413
+ */
8414
+ "countries[]"?: Country[];
8415
+ /**
8416
+ * Filter customers by states.
8417
+ * @example ["CA","Paris"]
8418
+ */
8419
+ "states[]"?: string[];
8420
+ /**
8421
+ * Filter customers by zipcodes.
8422
+ * @example ["10115","75001"]
8423
+ */
8424
+ "zipcodes[]"?: string[];
8425
+ /**
8426
+ * Filter customers by currencies.
8427
+ * @example ["USD","EUR"]
8428
+ */
8429
+ "currencies[]"?: Currency[];
8430
+ /**
8431
+ * Filter customers by whether they have a tax identification number or not.
8432
+ * @example true
8433
+ */
8434
+ has_tax_identification_number?: boolean;
8435
+ /**
8436
+ * Filter customers by metadata. Replace `key` with the actual metadata key you want to match, and provide the corresponding value. Providing empty value will search for customers without given metadata key. For example, `metadata[is_synced]=true&metadata[last_synced_at]=`.
8437
+ * @example "value"
8438
+ */
8439
+ "metadata[key]"?: string;
8440
+ /**
8441
+ * Filter customers by customer type.
8442
+ * @example "company"
8443
+ */
8444
+ customer_type?: "company" | "individual";
8445
+ /**
8446
+ * Filter customers by whether they have a customer type or not.
8447
+ * @example true
8448
+ */
8449
+ has_customer_type?: boolean;
8343
8450
  }, params?: RequestParams) => Promise<HttpResponse<CustomersPaginated, ApiErrorUnauthorized>>;
8344
8451
  /**
8345
8452
  * @description This endpoint retrieves an existing customer.
@@ -8361,6 +8468,37 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
8361
8468
  * @secure
8362
8469
  */
8363
8470
  destroyCustomer: (externalCustomerId: string, params?: RequestParams) => Promise<HttpResponse<Customer, ApiErrorUnauthorized | ApiErrorNotFound>>;
8471
+ /**
8472
+ * @description This endpoint is used to list all applied coupons for a customer.
8473
+ *
8474
+ * @tags customers, coupons
8475
+ * @name FindAllCustomerAppliedCoupons
8476
+ * @summary List all customer's applied coupons
8477
+ * @request GET:/customers/{external_customer_id}/applied_coupons
8478
+ * @secure
8479
+ */
8480
+ findAllCustomerAppliedCoupons: (externalCustomerId: string, query?: {
8481
+ /**
8482
+ * Page number.
8483
+ * @example 1
8484
+ */
8485
+ page?: number;
8486
+ /**
8487
+ * Number of records per page.
8488
+ * @example 20
8489
+ */
8490
+ per_page?: number;
8491
+ /**
8492
+ * The status of the coupon. Can be either `active` or `terminated`.
8493
+ * @example "active"
8494
+ */
8495
+ status?: "active" | "terminated";
8496
+ /**
8497
+ * The code of the coupon applied to the customer. Use it to filter applied coupons by their code.
8498
+ * @example ["BLACK_FRIDAY_2024","CHRISTMAS_2024"]
8499
+ */
8500
+ "coupon_code[]"?: string[];
8501
+ }, params?: RequestParams) => Promise<HttpResponse<AppliedCouponsPaginated, ApiErrorUnauthorized | ApiErrorNotFound>>;
8364
8502
  /**
8365
8503
  * @description This endpoint is used to delete a specific coupon that has been applied to a customer.
8366
8504
  *
@@ -8371,6 +8509,197 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
8371
8509
  * @secure
8372
8510
  */
8373
8511
  deleteAppliedCoupon: (externalCustomerId: string, appliedCouponId: string, params?: RequestParams) => Promise<HttpResponse<AppliedCoupon, ApiErrorUnauthorized | ApiErrorNotFound>>;
8512
+ /**
8513
+ * @description This endpoint list all existing credit notes for a customer.
8514
+ *
8515
+ * @tags customers, credit_notes
8516
+ * @name FindAllCustomerCreditNotes
8517
+ * @summary List all customer's credit notes
8518
+ * @request GET:/customers/{external_customer_id}/credit_notes
8519
+ * @secure
8520
+ */
8521
+ findAllCustomerCreditNotes: (externalCustomerId: string, query?: {
8522
+ /**
8523
+ * Page number.
8524
+ * @example 1
8525
+ */
8526
+ page?: number;
8527
+ /**
8528
+ * Number of records per page.
8529
+ * @example 20
8530
+ */
8531
+ per_page?: number;
8532
+ /**
8533
+ * Filter credit notes starting from a specific date.
8534
+ * @format date
8535
+ * @example "2022-07-08"
8536
+ */
8537
+ issuing_date_from?: string;
8538
+ /**
8539
+ * Filter credit notes up to a specific date.
8540
+ * @format date
8541
+ * @example "2022-08-09"
8542
+ */
8543
+ issuing_date_to?: string;
8544
+ /**
8545
+ * Search credit notes by id, number, customer name, customer external_id or customer email.
8546
+ * @example "Jane"
8547
+ */
8548
+ search_term?: string;
8549
+ /** Filter credit notes by reasons. Possible values are `product_unsatisfactory`, `order_change`, `order_cancellation`, `fraudulent_charge`, `duplicated_charge` or `other`. */
8550
+ reason?: "product_unsatisfactory" | "order_change" | "order_cancellation" | "fraudulent_charge" | "duplicated_charge" | "other";
8551
+ /** Filter credit notes by credit status. Possible values are `available`, `consumed` or `voided`. */
8552
+ credit_status?: "available" | "consumed" | "voided";
8553
+ /** Filter credit notes by refund status. Possible values are `pending`, `succeeded` or `failed`. */
8554
+ refund_status?: "pending" | "succeeded" | "failed";
8555
+ /**
8556
+ * Filter credit notes by their related invoice number.
8557
+ * @example "INV-001-002"
8558
+ */
8559
+ invoice_number?: string;
8560
+ /**
8561
+ * Filter credit notes of at least a specific amount. This parameter must be defined in cents to ensure consistent handling for all currency types.
8562
+ * @example 9000
8563
+ */
8564
+ amount_from?: number;
8565
+ /**
8566
+ * Filter credit notes up to a specific amount. This parameter must be defined in cents to ensure consistent handling for all currency types.
8567
+ * @example 100000
8568
+ */
8569
+ amount_to?: number;
8570
+ /**
8571
+ * Filter credit notes belonging to a self billed invoice. Possible values are `true` or `false`.
8572
+ * @example true
8573
+ */
8574
+ self_billed?: boolean;
8575
+ }, params?: RequestParams) => Promise<HttpResponse<CreditNotesPaginated, ApiErrorUnauthorized | ApiErrorNotFound>>;
8576
+ /**
8577
+ * @description This endpoint is used for retrieving all invoices of a customer.
8578
+ *
8579
+ * @tags customers, invoices
8580
+ * @name FindAllCustomerInvoices
8581
+ * @summary List all customer's invoices
8582
+ * @request GET:/customers/{external_customer_id}/invoices
8583
+ * @secure
8584
+ */
8585
+ findAllCustomerInvoices: (externalCustomerId: string, query?: {
8586
+ /**
8587
+ * Page number.
8588
+ * @example 1
8589
+ */
8590
+ page?: number;
8591
+ /**
8592
+ * Number of records per page.
8593
+ * @example 20
8594
+ */
8595
+ per_page?: number;
8596
+ /**
8597
+ * Filter invoices of at least a specific amount. This parameter must be defined in cents to ensure consistent handling for all currency types.
8598
+ * @example 9000
8599
+ */
8600
+ amount_from?: number;
8601
+ /**
8602
+ * Filter invoices up to a specific amount. This parameter must be defined in cents to ensure consistent handling for all currency types.
8603
+ * @example 100000
8604
+ */
8605
+ amount_to?: number;
8606
+ /**
8607
+ * Filter invoices starting from a specific date.
8608
+ * @format date
8609
+ * @example "2022-07-08"
8610
+ */
8611
+ issuing_date_from?: string;
8612
+ /**
8613
+ * Filter invoices up to a specific date.
8614
+ * @format date
8615
+ * @example "2022-08-09"
8616
+ */
8617
+ issuing_date_to?: string;
8618
+ /** Filter invoices by status. Possible values are `draft` or `finalized`. */
8619
+ status?: "draft" | "finalized";
8620
+ /** Filter invoices by payment status. Possible values are `pending`, `failed` or `succeeded`. */
8621
+ payment_status?: "pending" | "failed" | "succeeded";
8622
+ /**
8623
+ * Filter invoices by payment_overdue. Possible values are `true` or `false`.
8624
+ * @example true
8625
+ */
8626
+ payment_overdue?: boolean;
8627
+ /**
8628
+ * Search invoices by id, number, customer name, customer external_id or customer email.
8629
+ * @example "Jane"
8630
+ */
8631
+ search_term?: string;
8632
+ /**
8633
+ * Filter invoices with a payment dispute lost. Possible values are `true` or `false`.
8634
+ * @example true
8635
+ */
8636
+ payment_dispute_lost?: boolean;
8637
+ /** Filter invoices by invoice type. Possible values are `subscription`, `add_on`, `credit`, `one_off`, `advance_charges` or `progressive_billing`. */
8638
+ invoice_type?: "subscription" | "add_on" | "credit" | "one_off" | "advance_charges" | "progressive_billing";
8639
+ /**
8640
+ * Filter invoices by self billed. Possible values are `true` or `false`.
8641
+ * @example true
8642
+ */
8643
+ self_billed?: boolean;
8644
+ /**
8645
+ * 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`.
8646
+ * @example "someValue"
8647
+ */
8648
+ "metadata[key]"?: string;
8649
+ }, params?: RequestParams) => Promise<HttpResponse<InvoicesPaginated, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
8650
+ /**
8651
+ * @description This endpoint is used to list all payments of a customer
8652
+ *
8653
+ * @tags customers, payments
8654
+ * @name FindAllCustomerPayments
8655
+ * @summary List all customer's payments
8656
+ * @request GET:/customers/{external_customer_id}/payments
8657
+ * @secure
8658
+ */
8659
+ findAllCustomerPayments: (externalCustomerId: string, query?: {
8660
+ /**
8661
+ * Page number.
8662
+ * @example 1
8663
+ */
8664
+ page?: number;
8665
+ /**
8666
+ * Number of records per page.
8667
+ * @example 20
8668
+ */
8669
+ per_page?: number;
8670
+ /**
8671
+ * 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.
8672
+ * @format uuid
8673
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
8674
+ */
8675
+ invoice_id?: string;
8676
+ }, params?: RequestParams) => Promise<HttpResponse<PaymentsPaginated, ApiErrorUnauthorized | ApiErrorNotFound>>;
8677
+ /**
8678
+ * @description This endpoint is used to list all existing payment requests of a customer.
8679
+ *
8680
+ * @tags customers, payment_requests
8681
+ * @name FindAllCustomerPaymentRequests
8682
+ * @summary List all customer's payment requests
8683
+ * @request GET:/customers/{external_customer_id}/payment_requests
8684
+ * @secure
8685
+ */
8686
+ findAllCustomerPaymentRequests: (externalCustomerId: string, query?: {
8687
+ /**
8688
+ * Page number.
8689
+ * @example 1
8690
+ */
8691
+ page?: number;
8692
+ /**
8693
+ * Number of records per page.
8694
+ * @example 20
8695
+ */
8696
+ per_page?: number;
8697
+ /**
8698
+ * Filter by payment status. Possible values are `pending`, `failed` or `succeeded`.
8699
+ * @example "pending"
8700
+ */
8701
+ payment_status?: "pending" | "failed" | "succeeded";
8702
+ }, params?: RequestParams) => Promise<HttpResponse<PaymentRequestsPaginated, ApiErrorUnauthorized | ApiErrorNotFound>>;
8374
8703
  /**
8375
8704
  * @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
8376
8705
  *
@@ -8389,6 +8718,58 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
8389
8718
  portal_url: string;
8390
8719
  };
8391
8720
  }, ApiErrorUnauthorized | ApiErrorNotFound>>;
8721
+ /**
8722
+ * @description This endpoint retrieves all active subscriptions for a customer.
8723
+ *
8724
+ * @tags customers, subscriptions
8725
+ * @name FindAllCustomerSubscriptions
8726
+ * @summary List all customer's subscriptions
8727
+ * @request GET:/customers/{external_customer_id}/subscriptions
8728
+ * @secure
8729
+ */
8730
+ findAllCustomerSubscriptions: (externalCustomerId: string, query?: {
8731
+ /**
8732
+ * Page number.
8733
+ * @example 1
8734
+ */
8735
+ page?: number;
8736
+ /**
8737
+ * Number of records per page.
8738
+ * @example 20
8739
+ */
8740
+ per_page?: number;
8741
+ /**
8742
+ * 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.
8743
+ * @example "premium"
8744
+ */
8745
+ plan_code?: string;
8746
+ /**
8747
+ * 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`.
8748
+ * @example ["active","pending"]
8749
+ */
8750
+ "status[]"?: ("pending" | "canceled" | "terminated" | "active")[];
8751
+ }, params?: RequestParams) => Promise<HttpResponse<SubscriptionsPaginated, ApiErrorUnauthorized | ApiErrorNotFound>>;
8752
+ /**
8753
+ * @description This endpoint is used to list all wallets with prepaid credits of a customer
8754
+ *
8755
+ * @tags customers, wallets
8756
+ * @name FindAllCustomerWallets
8757
+ * @summary List all customer's wallets
8758
+ * @request GET:/customers/{external_customer_id}/wallets
8759
+ * @secure
8760
+ */
8761
+ findAllCustomerWallets: (externalCustomerId: string, query?: {
8762
+ /**
8763
+ * Page number.
8764
+ * @example 1
8765
+ */
8766
+ page?: number;
8767
+ /**
8768
+ * Number of records per page.
8769
+ * @example 20
8770
+ */
8771
+ per_page?: number;
8772
+ }, params?: RequestParams) => Promise<HttpResponse<WalletsPaginated, ApiErrorUnauthorized | ApiErrorForbidden | ApiErrorNotFound>>;
8392
8773
  /**
8393
8774
  * @description This endpoint enables the retrieval of the usage-based billing data for a customer within the current period.
8394
8775
  *
@@ -8521,6 +8902,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
8521
8902
  * @example "event-123"
8522
8903
  */
8523
8904
  code?: string;
8905
+ /**
8906
+ * Requires `external_subscription_id` to be set. Filter events by timestamp after the subscription started at datetime.
8907
+ * @example true
8908
+ */
8909
+ timestamp_from_started_at?: boolean;
8524
8910
  /**
8525
8911
  * Filter events by timestamp starting from a specific date.
8526
8912
  * @format date-time
@@ -9084,7 +9470,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
9084
9470
  * @request GET:/payments/{lago_id}
9085
9471
  * @secure
9086
9472
  */
9087
- findPayment: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<PaymentManualObject, ApiErrorUnauthorized | ApiErrorNotFound>>;
9473
+ findPayment: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<PaymentObject, ApiErrorUnauthorized | ApiErrorNotFound>>;
9088
9474
  };
9089
9475
  plans: {
9090
9476
  /**