lago-javascript-client 1.33.3 → 1.33.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3195,1169 +3195,1541 @@ export interface CustomerCreateInput {
3195
3195
  export interface Customer {
3196
3196
  customer: CustomerObjectExtended;
3197
3197
  }
3198
- /** Details about the pricing unit used for charge usage. */
3199
- export interface UsagePricingUnitDetailsObject {
3198
+ export interface InvoiceBaseObject {
3200
3199
  /**
3201
- * The amount in cents in the pricing unit.
3202
- * @example 200
3200
+ * Unique identifier assigned to the fee within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the fee's record within the Lago system.
3201
+ * @format uuid
3202
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3203
3203
  */
3204
- amount_cents: number;
3204
+ lago_id: string;
3205
3205
  /**
3206
- * The short name of the pricing unit.
3207
- * @example "CR"
3206
+ * The unique code of the billing entity associated with the invoice
3207
+ * @example "acme_corp"
3208
3208
  */
3209
- short_name: string;
3209
+ billing_entity_code: string | null;
3210
3210
  /**
3211
- * The conversion rate from pricing units to the plan's currency.
3212
- * @example "0.5"
3211
+ * This ID helps in uniquely identifying and organizing the invoices associated with a specific customer. It provides a sequential numbering system specific to the customer, allowing for easy tracking and management of invoices within the customer's context.
3212
+ * @example 2
3213
3213
  */
3214
- conversion_rate: string;
3215
- }
3216
- /** Array of filter object, representing multiple dimensions for a charge item. */
3217
- export type CustomerChargeFiltersUsageObject = {
3214
+ sequential_id?: number;
3218
3215
  /**
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"
3216
+ * The unique number assigned to the invoice. This number serves as a distinct identifier for the invoice and helps in differentiating it from other invoices in the system.
3217
+ * @example "LAG-1234-001-002"
3222
3218
  */
3223
- units?: string;
3219
+ number: string;
3224
3220
  /**
3225
- * The amount in cents, tax excluded, consumed for a specific charge filter related to a charge item.
3226
- * @example 1000
3221
+ * The date when the invoice was issued. It is provided in the ISO 8601 date format.
3222
+ * @format date
3223
+ * @example "2022-04-30"
3227
3224
  */
3228
- amount_cents?: number;
3225
+ issuing_date: string;
3229
3226
  /**
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
3227
+ * The date when the payment dispute was lost. It is expressed in Coordinated Universal Time (UTC).
3228
+ * @format date-time
3229
+ * @example "2022-09-14T16:35:31Z"
3232
3230
  */
3233
- events_count?: number;
3231
+ payment_dispute_lost_at?: string;
3234
3232
  /**
3235
- * Specifies the name that will be displayed on an invoice.
3236
- * @example "AWS eu-east-1"
3233
+ * The payment due date for the invoice, specified in the ISO 8601 date format.
3234
+ * @format date
3235
+ * @example "2022-04-30"
3237
3236
  */
3238
- invoice_display_name?: string;
3239
- /** Details about the pricing unit used for charge usage. */
3240
- pricing_unit_details?: UsagePricingUnitDetailsObject;
3237
+ payment_due_date?: string;
3241
3238
  /**
3242
- * List of filter values applied to the usage.
3243
- * @example {"region":["us-east-1"]}
3239
+ * Specifies if the payment is considered as overdue.
3240
+ * @example true
3244
3241
  */
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 = {
3242
+ payment_overdue?: boolean;
3249
3243
  /**
3250
- * The amount in cents, tax excluded, consumed for a specific group related to a charge item.
3251
- * @example 1000
3244
+ * The net payment term, expressed in days, specifies the duration within which a customer is expected to remit payment after the invoice is finalized.
3245
+ * @example 30
3252
3246
  */
3253
- amount_cents?: number;
3247
+ net_payment_term?: number;
3254
3248
  /**
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
3249
+ * The type of invoice issued. Possible values are `subscription`, `one-off`, `credit` or `progressive_billing`.
3250
+ * @example "subscription"
3257
3251
  */
3258
- events_count?: number;
3252
+ invoice_type: "subscription" | "add_on" | "credit" | "one_off" | "progressive_billing";
3259
3253
  /**
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"
3254
+ * The status of the invoice. It indicates the current state of the invoice and can have following values:
3255
+ * - `draft`: the invoice is in the draft state, waiting for the end of the grace period to be finalized. During this period, events can still be ingested and added to the invoice.
3256
+ * - `finalized`: the invoice has been issued and finalized. In this state, events cannot be ingested or added to the invoice anymore.
3257
+ * - `voided`: the invoice has been issued and subsequently voided. In this state, events cannot be ingested or added to the invoice anymore.
3258
+ * - `pending`: the invoice remains pending until the taxes are fetched from the external provider.
3259
+ * - `failed`: during an attempt of finalization of the invoice, an error happened. This invoice will have an array of error_details, explaining, in which part of the system an error happened and how it's possible to fix it. This invoice can't be edited or updated, only retried. This action will discard current error_details and will create new ones if the finalization failed again.
3260
+ * @example "finalized"
3263
3261
  */
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 {
3262
+ status: "draft" | "finalized" | "voided" | "failed" | "pending";
3273
3263
  /**
3274
- * The number of units consumed by the customer for a specific charge item.
3275
- * @pattern ^[0-9]+.?[0-9]*$
3276
- * @example "1.0"
3264
+ * The status of the payment associated with the invoice. It can have one of the following values:
3265
+ * - `pending`: the payment is pending, waiting for payment processing in Stripe or when the invoice is emitted but users have not updated the payment status through the endpoint.
3266
+ * - `succeeded`: the payment of the invoice has been successfully processed.
3267
+ * - `failed`: the payment of the invoice has failed or encountered an error during processing.
3268
+ * @example "succeeded"
3277
3269
  */
3278
- units: string;
3270
+ payment_status: "pending" | "succeeded" | "failed";
3279
3271
  /**
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
3272
+ * The currency of the invoice issued.
3273
+ * @example "EUR"
3282
3274
  */
3283
- events_count: number;
3275
+ currency: Currency;
3284
3276
  /**
3285
- * The amount in cents, tax excluded, consumed by the customer for a specific charge item.
3286
- * @example 123
3277
+ * The total sum of fees amount in cents. It calculates the cumulative amount of all the fees associated with the invoice, providing a consolidated value.
3278
+ * @example 100
3287
3279
  */
3288
- amount_cents: number;
3280
+ fees_amount_cents: number;
3289
3281
  /**
3290
- * The currency of a usage item consumed by the customer.
3291
- * @example "EUR"
3282
+ * The total sum of all coupons discounted on the invoice. It calculates the cumulative discount amount applied by coupons, expressed in cents.
3283
+ * @example 10
3292
3284
  */
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 {
3285
+ coupons_amount_cents: number;
3345
3286
  /**
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"
3287
+ * The total sum of all credit notes discounted on the invoice. It calculates the cumulative discount amount applied by credit notes, expressed in cents.
3288
+ * @example 10
3349
3289
  */
3350
- from_datetime: string;
3290
+ credit_notes_amount_cents: number;
3351
3291
  /**
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"
3292
+ * Subtotal amount, excluding taxes, expressed in cents.
3293
+ * This field depends on the version number. Here are the definitions based on the version:
3294
+ * - Version 1: is equal to the sum of `fees_amount_cents`, minus `coupons_amount_cents`, and minus `prepaid_credit_amount_cents`.
3295
+ * - Version 2: is equal to the `fees_amount_cents`.
3296
+ * - Version 3 & 4: is equal to the `fees_amount_cents`, minus `coupons_amount_cents`
3297
+ * @example 100
3355
3298
  */
3356
- to_datetime: string;
3299
+ sub_total_excluding_taxes_amount_cents: number;
3357
3300
  /**
3358
- * The date of creation of the invoice.
3359
- * @format date
3360
- * @example "2022-08-01"
3301
+ * The sum of tax amount associated with the invoice, expressed in cents.
3302
+ * @example 20
3361
3303
  */
3362
- issuing_date: string;
3304
+ taxes_amount_cents: number;
3363
3305
  /**
3364
- * A unique identifier associated with the invoice related to this particular usage record.
3365
- * @format uuid
3366
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3306
+ * Subtotal amount, including taxes, expressed in cents.
3307
+ * This field depends on the version number. Here are the definitions based on the version:
3308
+ * - Version 1: is equal to the `total_amount_cents`.
3309
+ * - Version 2: is equal to the sum of `fees_amount_cents` and `taxes_amount_cents`.
3310
+ * - Version 3 & 4: is equal to the sum `sub_total_excluding_taxes_amount_cents` and `taxes_amount_cents`
3311
+ * @example 120
3367
3312
  */
3368
- lago_invoice_id?: string | null;
3313
+ sub_total_including_taxes_amount_cents: number;
3369
3314
  /**
3370
- * The currency of the customer's current usage.
3371
- * @example "EUR"
3315
+ * The total sum of all prepaid credits discounted on the invoice. It calculates the cumulative discount amount applied by prepaid credits, expressed in cents.
3316
+ * @example 0
3372
3317
  */
3373
- currency?: Currency;
3318
+ prepaid_credit_amount_cents: number;
3374
3319
  /**
3375
- * The amount in cents, tax excluded.
3376
- * @example 123
3320
+ * The usage already billed in previous invoices. Only apply to `progressive_billing` and `subscription` invoices.
3321
+ * @example 0
3377
3322
  */
3378
- amount_cents: number;
3323
+ progressive_billing_credit_amount_cents: number;
3379
3324
  /**
3380
- * The tax amount in cents.
3381
- * @example 200
3325
+ * The sum of the amount and taxes amount on the invoice, expressed in cents. It calculates the total financial value of the invoice, including both the original amount and any applicable taxes.
3326
+ * @example 100
3382
3327
  */
3383
- taxes_amount_cents: number;
3328
+ total_amount_cents: number;
3329
+ /** @example 3 */
3330
+ version_number: number;
3384
3331
  /**
3385
- * The total amount in cents, tax included.
3386
- * @example 123
3332
+ * Indicates if the invoice is self-billed. Self-billing is a process where an organization creates the invoice on behalf of the partner. This field specifies whether the invoice is self-billed or not.
3333
+ * @example false
3387
3334
  */
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 {
3335
+ self_billed?: boolean;
3396
3336
  /**
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"
3337
+ * Contains the URL that provides direct access to the invoice PDF file. You can use this URL to download or view the PDF document of the invoice
3338
+ * @format uri
3339
+ * @example "https://getlago.com/invoice/file"
3400
3340
  */
3401
- from_datetime: string;
3341
+ file_url?: string;
3402
3342
  /**
3403
- * The upper bound of the billing period, expressed in the ISO 8601 datetime format in Coordinated Universal Time (UTC).
3343
+ * The date of the invoice creation, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC). The creation_date provides a standardized and internationally recognized timestamp for when the invoice object was created
3404
3344
  * @format date-time
3405
- * @example "2022-07-31T23:59:59Z"
3345
+ * @example "2022-04-29T08:59:51Z"
3406
3346
  */
3407
- to_datetime: string;
3347
+ created_at: string;
3408
3348
  /**
3409
- * The date of creation of the invoice.
3410
- * @format date
3411
- * @example "2022-08-01"
3349
+ * The date of the invoice update, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC). The update_date provides a standardized and internationally recognized timestamp for when the invoice object was updated
3350
+ * @format date-time
3351
+ * @example "2022-04-29T08:59:51Z"
3412
3352
  */
3413
- issuing_date: string;
3353
+ updated_at: string;
3354
+ }
3355
+ export interface BillingPeriodObject {
3414
3356
  /**
3415
- * A unique identifier associated with the invoice related to this particular usage record.
3357
+ * Unique identifier assigned to the subscription, created by Lago.
3416
3358
  * @format uuid
3417
3359
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3418
3360
  */
3419
- lago_invoice_id?: string | null;
3361
+ lago_subscription_id: string;
3420
3362
  /**
3421
- * The currency of the customer's current usage.
3422
- * @example "EUR"
3363
+ * Unique identifier assigned to the subscription in your application.
3364
+ * @example "external_id"
3423
3365
  */
3424
- currency?: Currency;
3366
+ external_subscription_id: string;
3425
3367
  /**
3426
- * The amount in cents, tax excluded.
3427
- * @example 123
3368
+ * Unique identifier assigned to the plan, created by Lago.
3369
+ * @format uuid
3370
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3428
3371
  */
3429
- amount_cents: number;
3372
+ lago_plan_id: string;
3430
3373
  /**
3431
- * The projected amount in cents, tax excluded.
3432
- * @example 256
3374
+ * The beginning date of the subscription billing period. This field indicates the start date of the billing period associated with the subscription fee.
3375
+ * @format date-time
3376
+ * @example "2022-04-29T08:59:51Z"
3433
3377
  */
3434
- projected_amount_cents: number;
3378
+ subscription_from_datetime: string;
3435
3379
  /**
3436
- * The tax amount in cents.
3437
- * @example 200
3380
+ * The ending date of the subscription billing period. This field indicates the end date of the billing period associated with the subscription fee.
3381
+ * @format date-time
3382
+ * @example "2022-05-29T08:59:51Z"
3438
3383
  */
3439
- taxes_amount_cents: number;
3384
+ subscription_to_datetime: string;
3440
3385
  /**
3441
- * The total amount in cents, tax included.
3442
- * @example 123
3386
+ * The beginning date of the period that covers the charge fees. It is applicable only to the `charge` fees attached to the subscription. This field indicates the start date of the billing period or subscription period associated with the fees.
3387
+ * @format date-time
3388
+ * @example "2022-04-29T08:59:51Z"
3443
3389
  */
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;
3390
+ charges_from_datetime: string;
3391
+ /**
3392
+ * The ending date of the period that covers the charge fees. It is applicable only to the `charge` fees attached to the subscription. This field indicates the end date of the billing period or subscription period associated with the fees.
3393
+ * @format date-time
3394
+ * @example "2022-05-29T08:59:51Z"
3395
+ */
3396
+ charges_to_datetime: string;
3397
+ /**
3398
+ * The reason explaining why this subscription appears on the invoice.
3399
+ * @example "subscription_starting"
3400
+ */
3401
+ invoicing_reason: "subscription_starting" | "subscription_periodic" | "subscription_terminating" | "in_advance_charge" | "in_advance_charge_periodic" | "progressive_billing";
3454
3402
  }
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
- };
3403
+ export interface InvoiceMetadataObject {
3404
+ /**
3405
+ * Unique identifier assigned to the invoice metadata within the Lago application.
3406
+ * @format uuid
3407
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3408
+ */
3409
+ lago_id?: string;
3410
+ /**
3411
+ * Represents the key of the metadata's key-value pair.
3412
+ * @example "digital_ref_id"
3413
+ */
3414
+ key?: string;
3415
+ /**
3416
+ * Represents the value of the metadata's key-value pair.
3417
+ * @example "INV-0123456-98765"
3418
+ */
3419
+ value?: string;
3420
+ /**
3421
+ * The date and time when the metadata object was created. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
3422
+ * @format date-time
3423
+ * @example "2022-04-29T08:59:51Z"
3424
+ */
3425
+ created_at?: string;
3484
3426
  }
3485
- export interface EventObject {
3427
+ export type InvoiceAppliedTaxObject = BaseAppliedTax & {
3486
3428
  /**
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
3429
+ * Unique identifier of the invoice, created by Lago.
3488
3430
  * @format uuid
3489
3431
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3490
3432
  */
3491
- lago_id: string;
3433
+ lago_invoice_id?: string;
3492
3434
  /**
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"
3435
+ * Fees total amount on which the tax is applied
3436
+ * @example 20000
3495
3437
  */
3496
- transaction_id: string;
3438
+ fees_amount_cents?: number;
3439
+ };
3440
+ export interface UsageThresholdObject {
3497
3441
  /**
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
3442
+ * Unique identifier of the usage threshold created by Lago.
3499
3443
  * @format uuid
3500
3444
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3501
3445
  */
3502
- lago_customer_id: string | null;
3446
+ lago_id: string;
3503
3447
  /**
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"
3448
+ * The display name of the usage threshold.
3449
+ * @example "Threshold 1"
3506
3450
  */
3507
- code: string;
3451
+ threshold_display_name: string | null;
3508
3452
  /**
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"
3453
+ * The amount to reach to trigger a `progressive_billing` invoice.
3454
+ * @example 10000
3512
3455
  */
3513
- timestamp: string;
3456
+ amount_cents: number;
3514
3457
  /**
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"
3458
+ * This field when set to `true` indicates that a `progressive_billing` invoice will be created every time the lifetime usage increases by the specified amount.
3459
+ * @example true
3517
3460
  */
3518
- precise_total_amount_cents?: string | null;
3461
+ recurring: boolean;
3519
3462
  /**
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}
3463
+ * The date and time when the usage threshold was created. It is expressed in UTC format according to the ISO 8601 datetime standard.
3464
+ * @format date-time
3465
+ * @example "2023-06-27T19:43:42Z"
3522
3466
  */
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
- };
3467
+ created_at: string;
3528
3468
  /**
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"
3469
+ * The date and time when the usage threshold was last updated. It is expressed in UTC format according to the ISO 8601 datetime standard.
3470
+ * @format date-time
3471
+ * @example "2023-06-27T19:43:42Z"
3532
3472
  */
3533
- lago_subscription_id: string | null;
3473
+ updated_at: string;
3474
+ }
3475
+ export interface AppliedUsageThresholdObject {
3534
3476
  /**
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"
3477
+ * The amount of usage in cents that has been accumulated over the lifetime of the subscription.
3478
+ * @example 2000
3537
3479
  */
3538
- external_subscription_id: string;
3480
+ lifetime_usage_amount_cents: number;
3539
3481
  /**
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
3482
+ * The date and time when the lifetime usage was computed. It is expressed in UTC format according to the ISO 8601 datetime standard.
3541
3483
  * @format date-time
3542
- * @example "2022-04-29T08:59:51Z"
3484
+ * @example "2025-03-31T12:31:44Z"
3543
3485
  */
3544
3486
  created_at: string;
3487
+ usage_threshold: UsageThresholdObject;
3545
3488
  }
3546
- export interface EventsPaginated {
3547
- events: EventObject[];
3489
+ export type InvoiceObject = InvoiceBaseObject & {
3490
+ /** The customer on which the invoice applies. It refers to the customer account or entity associated with the invoice. */
3491
+ customer?: CustomerObject;
3492
+ billing_periods?: BillingPeriodObject[];
3493
+ metadata?: InvoiceMetadataObject[];
3494
+ applied_taxes?: InvoiceAppliedTaxObject[];
3495
+ applied_usage_thresholds?: AppliedUsageThresholdObject[];
3496
+ };
3497
+ export interface InvoicesPaginated {
3498
+ invoices: InvoiceObject[];
3548
3499
  meta: PaginationMeta;
3549
3500
  }
3550
- export interface EventInputObject {
3501
+ export interface PaymentObject {
3551
3502
  /**
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"
3503
+ * The unique identifier of the payment, created by Lago.
3504
+ * @format uuid
3505
+ * @example "4cf085a7-c196-4f07-a543-97c50ec6e8b2"
3559
3506
  */
3560
- transaction_id: string;
3507
+ lago_id: string;
3561
3508
  /**
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"
3509
+ * Unique identifier of the customer, created by Lago.
3510
+ * @format uuid
3511
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3564
3512
  */
3565
- external_subscription_id: string;
3513
+ lago_customer_id: string;
3566
3514
  /**
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"
3515
+ * The customer external unique identifier (provided by your own application)
3516
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
3569
3517
  */
3570
- code: string;
3518
+ external_customer_id: string;
3519
+ /** List of invoice IDs associated with the payment. */
3520
+ invoice_ids: string[];
3571
3521
  /**
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"
3522
+ * The unique identifier of the paid resource, created by Lago.
3523
+ * @format uuid
3524
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3576
3525
  */
3577
- timestamp?: number | string;
3526
+ lago_payable_id: string;
3578
3527
  /**
3579
- * The precise total amount in cents with precision used by the `dynamic` pricing model to compute the usage amount.
3580
- * @example "1234.56"
3528
+ * The type of the paid resource, associated with the `lago_payable_id`.
3529
+ * @example "Invoice"
3581
3530
  */
3582
- precise_total_amount_cents?: string | null;
3531
+ payable_type: "Invoice" | "PaymentRequest";
3583
3532
  /**
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}
3533
+ * The amount of the payment in cents.
3534
+ * @example 1099
3586
3535
  */
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
- };
3600
- }
3601
- export interface EventBatchInput {
3602
- events: EventInputObject[];
3603
- }
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
- })[];
3612
- }
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
- };
3628
- }
3629
- export interface Fees {
3630
- fees: FeeObject[];
3631
- }
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;
3639
- /**
3640
- * The unique identifier of the subscription within your application.
3641
- * @example "sub_1234567890"
3642
- */
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;
3646
- /**
3647
- * This field represents a unique identifier for the event.
3648
- * @example "transaction_1234567890"
3649
- */
3650
- transaction_id?: string | null;
3651
- };
3652
- }
3653
- export interface FeeEstimateObject {
3654
- lago_id?: null;
3536
+ amount_cents: number;
3655
3537
  /**
3656
- * Unique identifier assigned to the charge that the fee belongs to
3657
- * @format uuid
3658
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3538
+ * The currency of the payment amount.
3539
+ * @example "USD"
3659
3540
  */
3660
- lago_charge_id?: string;
3541
+ amount_currency: Currency;
3661
3542
  /**
3662
- * Unique identifier assigned to the charge filter that the fee belongs to
3663
- * @format uuid
3664
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3543
+ * The status of the payment within the payment provider. This can be very different from a payment provider to another.
3544
+ * @example "Completed"
3665
3545
  */
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;
3546
+ status: string;
3670
3547
  /**
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"
3548
+ * The normalized payment status by Lago.
3549
+ * @example "succeeded"
3674
3550
  */
3675
- lago_subscription_id?: string;
3551
+ payment_status: "succeeded" | "failed" | "pending" | "processing";
3676
3552
  /**
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"
3553
+ * The type of payment.
3554
+ * @example "manual"
3680
3555
  */
3681
- lago_customer_id?: string;
3556
+ type: "manual" | "provider";
3682
3557
  /**
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"
3558
+ * Reference for the payment.
3559
+ * @example "ref1"
3685
3560
  */
3686
- external_customer_id?: string;
3561
+ reference: string;
3687
3562
  /**
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"
3563
+ * Code of the payment provider
3564
+ * @example "stripe_prod"
3690
3565
  */
3691
- external_subscription_id?: string;
3566
+ payment_provider_code: string;
3692
3567
  /**
3693
- * The cost of this specific fee, excluding any applicable taxes.
3694
- * @example 100
3568
+ * The type of payment provider
3569
+ * @example "stripe"
3695
3570
  */
3696
- amount_cents: number;
3571
+ payment_provider_type: "adyen" | "cashfree" | "gocardless" | "stripe" | "flutterwave" | "moneyhash";
3572
+ /** DEPRECATED: use provider_payment_id */
3573
+ external_payment_id: string | null;
3697
3574
  /**
3698
- * The cost of this specific fee, excluding any applicable taxes, with precision.
3699
- * @example 1.0001
3575
+ * Unique identifier of the payment within the payment provider (if applicable).
3576
+ * @example "pi_5eb0285741bc6ba"
3700
3577
  */
3701
- precise_amount?: number;
3578
+ provider_payment_id: string | null;
3702
3579
  /**
3703
- * The cost of this specific fee, including any applicable taxes, with precision.
3704
- * @example 1.0212
3580
+ * Unique identifier of the customer within the payment provider
3581
+ * @example "cus_5eb0285bcf941bc6ba"
3705
3582
  */
3706
- precise_total_amount?: number;
3583
+ provider_customer_id: string;
3707
3584
  /**
3708
- * The currency of this specific fee. It indicates the monetary unit in which the fee's cost is expressed.
3585
+ * The next action to be taken by the customer to complete the payment. Should usually be empty, except when receiving the `payment.requires_action` webhook.
3586
+ * @example {"type":"redirect_to_url","redirect_to_url":{"url":"https://hooks.stripe.com/3d_secure_2/hosted?merchant=acct_AAA&payment_intent=pi_BBB&payment_intent_client_secret=pi_BBB&publishable_key=pk_test_CCC","return_url":"https://app.example.com"}}
3587
+ */
3588
+ next_action: Record<string, any>;
3589
+ /**
3590
+ * Timestamp when the payment was created in Lago's database, not on the payment provider.
3591
+ * @format date-time
3592
+ * @example "2025-01-21T00:10:29Z"
3593
+ */
3594
+ created_at: string;
3595
+ }
3596
+ export interface PaymentsPaginated {
3597
+ payments: PaymentObject[];
3598
+ meta: PaginationMeta;
3599
+ }
3600
+ export interface PaymentRequestObject {
3601
+ /**
3602
+ * Unique identifier of the payment request, created by Lago.
3603
+ * @format uuid
3604
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3605
+ */
3606
+ lago_id: string;
3607
+ /**
3608
+ * The customer's email address used for sending dunning notifications
3609
+ * @format email
3610
+ * @example "dinesh@piedpiper.test"
3611
+ */
3612
+ email: string;
3613
+ /**
3614
+ * The sum of the total amounts of all the invoices included in the payment request, expressed in cents.
3615
+ * @example 100
3616
+ */
3617
+ amount_cents: number;
3618
+ /**
3619
+ * The currency of the payment request.
3709
3620
  * @example "EUR"
3710
3621
  */
3711
3622
  amount_currency: Currency;
3712
3623
  /**
3713
- * The cost of the tax associated with this specific fee.
3714
- * @example 0
3624
+ * The status of the payment associated with the payment request. It can have one of the following values:
3625
+ * - `pending`: the payment is pending, waiting for payment processing in the payment provider or when the invoice is emitted but users have not updated the payment status through the endpoint.
3626
+ * - `succeeded`: the payment of the payment request has been successfully processed.
3627
+ * - `failed`: the payment of the payment request has failed or encountered an error during processing.
3628
+ * @example "succeeded"
3715
3629
  */
3716
- taxes_amount_cents: number;
3630
+ payment_status: "pending" | "succeeded" | "failed";
3717
3631
  /**
3718
- * The cost of the tax associated with this specific fee, with precision.
3719
- * @example 0
3632
+ * The date and time when the payment request was created. It is expressed in UTC format according to the ISO 8601 datetime standard. This field provides the timestamp for the exact moment when the payment request was initially created.
3633
+ * @format date-time
3634
+ * @example "2022-04-29T08:59:51Z"
3720
3635
  */
3721
- taxes_precise_amount?: number;
3636
+ created_at: string;
3637
+ /** The customer on which the payment request applies. It refers to the customer account or entity associated with the payment request. */
3638
+ customer: CustomerBaseObject;
3639
+ invoices: InvoiceBaseObject[];
3640
+ }
3641
+ export interface PaymentRequestsPaginated {
3642
+ payment_requests: PaymentRequestObject[];
3643
+ meta: PaginationMeta;
3644
+ }
3645
+ export interface SubscriptionObject {
3722
3646
  /**
3723
- * The tax rate associated with this specific fee.
3724
- * @example 20
3647
+ * Unique identifier assigned to the subscription within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the subscription's record within the Lago system
3648
+ * @format uuid
3649
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3725
3650
  */
3726
- taxes_rate: number;
3651
+ lago_id: string;
3727
3652
  /**
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"
3653
+ * The subscription external unique identifier (provided by your own application).
3654
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
3730
3655
  */
3731
- units: string;
3732
- description?: null;
3656
+ external_id: string;
3733
3657
  /**
3734
- * The unit amount of the fee per unit, with precision.
3735
- * @example 312.5
3658
+ * Unique identifier assigned to the customer within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the customer's record within the Lago system
3659
+ * @format uuid
3660
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3736
3661
  */
3737
- precise_unit_amount: number;
3662
+ lago_customer_id: string;
3738
3663
  /**
3739
- * The coupon amount applied to the estimated instant fee. It will always returns 0
3740
- * @example "0.0"
3664
+ * The customer external unique identifier (provided by your own application).
3665
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
3741
3666
  */
3742
- precise_coupons_amount_cents?: string;
3667
+ external_customer_id: string;
3743
3668
  /**
3744
- * The cost of this specific fee, including any applicable taxes.
3745
- * @example 120
3669
+ * The billing time for the subscription, which can be set as either `anniversary` or `calendar`. If not explicitly provided, it will default to `calendar`. The billing time determines the timing of recurring billing cycles for the subscription. By specifying `anniversary`, the billing cycle will be based on the specific date the subscription started (billed fully), while `calendar` sets the billing cycle at the first day of the week/month/year (billed with proration).
3670
+ * @example "anniversary"
3746
3671
  */
3747
- total_amount_cents: number;
3672
+ billing_time: "calendar" | "anniversary";
3748
3673
  /**
3749
- * The currency of this specific fee, including any applicable taxes.
3750
- * @example "EUR"
3674
+ * The display name of the subscription on an invoice. This field allows for customization of the subscription's name for billing purposes, especially useful when a single customer has multiple subscriptions using the same plan.
3675
+ * @example "Repository A"
3751
3676
  */
3752
- total_amount_currency: Currency;
3677
+ name: string | null;
3753
3678
  /**
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
3679
+ * The unique code representing the plan to be attached to the customer. This code must correspond to the `code` property of one of the active plans.
3680
+ * @example "premium"
3756
3681
  */
3757
- events_count?: number;
3682
+ plan_code: string;
3758
3683
  /**
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
3684
+ * The status of the subscription, which can have the following values:
3685
+ * - `active`: the subscription is currently active and applied to the customer.
3686
+ * - `canceled`: the subscription has been stopped before its activation. This can occur when two consecutive downgrades have been applied to a customer or when a subscription with a pending status is terminated.
3687
+ * - `pending`: a previous subscription has been downgraded, and the current one is awaiting automatic activation at the end of the billing period.
3688
+ * - `terminated`: the subscription is no longer active.
3689
+ * @example "active"
3761
3690
  */
3762
- pay_in_advance: boolean;
3691
+ status: "active" | "canceled" | "pending" | "terminated";
3763
3692
  /**
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
3693
+ * The creation date of the subscription, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC). This date provides a timestamp indicating when the subscription was initially created.
3694
+ * @format date-time
3695
+ * @example "2022-08-08T00:00:00Z"
3766
3696
  */
3767
- invoiceable: boolean;
3697
+ created_at: string;
3768
3698
  /**
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"
3699
+ * The cancellation date of the subscription. This field is not null when the subscription is `canceled`. This date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
3700
+ * @format date-time
3701
+ * @example "2022-09-14T16:35:31Z"
3771
3702
  */
3772
- payment_status: "pending";
3773
- created_at?: null;
3774
- succeeded_at?: null;
3775
- failed_at?: null;
3776
- refunded_at?: null;
3703
+ canceled_at: string | null;
3777
3704
  /**
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"
3705
+ * The effective start date of the subscription. This field can be null if the subscription is `pending` or `canceled`. This date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
3706
+ * @format date-time
3707
+ * @example "2022-08-08T00:00:00Z"
3780
3708
  */
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;
3795
- /**
3796
- * The name of the fee item. It will be the name of the `billable_metric`.
3797
- * @example "Startup"
3798
- */
3799
- name: string;
3800
- /**
3801
- * The description of the fee item. It will be the name of the `billable_metric`.
3802
- * @example "Startup description"
3803
- */
3804
- description?: string;
3805
- /**
3806
- * 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)"
3808
- */
3809
- invoice_display_name?: string;
3810
- /**
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`.
3819
- * @format uuid
3820
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3821
- */
3822
- lago_item_id: string;
3823
- /**
3824
- * The type of the fee item. Values is `BillableMetric`.
3825
- * @example "BillableMetric"
3826
- */
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: {
3850
- /**
3851
- * The payment status of the fee. Possible values are `pending`, `succeeded`, `failed` or `refunded`.
3852
- * @example "succeeded"
3853
- */
3854
- payment_status: "pending" | "succeeded" | "failed" | "refunded";
3855
- };
3856
- }
3857
- export interface InvoiceBaseObject {
3709
+ started_at: string | null;
3858
3710
  /**
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"
3711
+ * The effective end date of the subscription. If this field is set to null, the subscription will automatically renew. This date should be provided in ISO 8601 datetime format, and use Coordinated Universal Time (UTC).
3712
+ * @format date-time
3713
+ * @example "2022-10-08T00:00:00Z"
3862
3714
  */
3863
- lago_id: string;
3715
+ ending_at: string | null;
3864
3716
  /**
3865
- * The unique code of the billing entity associated with the invoice
3866
- * @example "acme_corp"
3717
+ * The anniversary date and time of the initial subscription. This date serves as the basis for billing subscriptions with `anniversary` billing time. The `anniversary_date` should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
3718
+ * @format date-time
3719
+ * @example "2022-08-08T00:00:00Z"
3867
3720
  */
3868
- billing_entity_code: string | null;
3721
+ subscription_at: string;
3869
3722
  /**
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
3723
+ * The termination date of the subscription. This field is not null when the subscription is `terminated`. This date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC)
3724
+ * @format date-time
3725
+ * @example "2022-09-14T16:35:31Z"
3872
3726
  */
3873
- sequential_id?: number;
3727
+ terminated_at: string | null;
3874
3728
  /**
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"
3729
+ * The code identifying the previous plan associated with this subscription.
3730
+ * @example null
3877
3731
  */
3878
- number: string;
3732
+ previous_plan_code: string | null;
3879
3733
  /**
3880
- * The date when the invoice was issued. It is provided in the ISO 8601 date format.
3734
+ * The code identifying the next plan in the case of a downgrade.
3735
+ * @example null
3736
+ */
3737
+ next_plan_code: string | null;
3738
+ /**
3739
+ * The date when the plan will be downgraded, represented in ISO 8601 date format.
3881
3740
  * @format date
3882
3741
  * @example "2022-04-30"
3883
3742
  */
3884
- issuing_date: string;
3743
+ downgrade_plan_date: string | null;
3885
3744
  /**
3886
- * The date when the payment dispute was lost. It is expressed in Coordinated Universal Time (UTC).
3745
+ * The date when the free trial is ended, represented in ISO 8601 date format.
3887
3746
  * @format date-time
3888
- * @example "2022-09-14T16:35:31Z"
3747
+ * @example "2022-08-08T00:00:00Z"
3889
3748
  */
3890
- payment_dispute_lost_at?: string;
3749
+ trial_ended_at: string | null;
3891
3750
  /**
3892
- * The payment due date for the invoice, specified in the ISO 8601 date format.
3893
- * @format date
3894
- * @example "2022-04-30"
3751
+ * The date and time when the current billing period started, represented in ISO 8601 date format.
3752
+ * @format date-time
3753
+ * @example "2022-08-08T00:00:00Z"
3895
3754
  */
3896
- payment_due_date?: string;
3755
+ current_billing_period_started_at: string | null;
3897
3756
  /**
3898
- * Specifies if the payment is considered as overdue.
3899
- * @example true
3757
+ * The date and time when the current billing period ends, represented in ISO 8601 date format.
3758
+ * @format date-time
3759
+ * @example "2022-09-08T00:00:00Z"
3900
3760
  */
3901
- payment_overdue?: boolean;
3761
+ current_billing_period_ending_at: string | null;
3902
3762
  /**
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
3763
+ * When a pay-in-advance subscription is terminated before the end of its billing period, we generate a credit note for the unused subscription time by default.
3764
+ * This field allows you to control the behavior of the credit note generation:
3765
+ *
3766
+ * - `credit`: A credit note is generated for the unused subscription time. The unused amount is credited back to the customer.
3767
+ * - `refund`: A credit note is generated for the unused subscription time. If the invoice is paid or partially paid, the unused paid amount is refunded; any unpaid unused amount is credited back to the customer.
3768
+ * - `skip`: No credit note is generated for the unused subscription time.
3769
+ *
3770
+ * _Note: This field is only applicable to pay-in-advance plans and will be `null` for pay-in-arrears plans._
3771
+ * @example "credit"
3905
3772
  */
3906
- net_payment_term?: number;
3773
+ on_termination_credit_note: "credit" | "refund" | "skip";
3907
3774
  /**
3908
- * The type of invoice issued. Possible values are `subscription`, `one-off`, `credit` or `progressive_billing`.
3909
- * @example "subscription"
3775
+ * When a subscription is terminated before the end of its billing period, we generate an invoice for the unbilled usage.
3776
+ * This field allows you to control the behavior of the invoice generation:
3777
+ *
3778
+ * - `generate`: An invoice is generated for the unbilled usage.
3779
+ * - `skip`: No invoice is generated for the unbilled usage.
3780
+ * @default "generate"
3781
+ * @example "generate"
3910
3782
  */
3911
- invoice_type: "subscription" | "add_on" | "credit" | "one_off" | "progressive_billing";
3783
+ on_termination_invoice: "generate" | "skip";
3784
+ }
3785
+ export interface SubscriptionsPaginated {
3786
+ subscriptions: SubscriptionObject[];
3787
+ meta: PaginationMeta;
3788
+ }
3789
+ /** Object that represents rule for wallet recurring transactions. */
3790
+ export interface WalletRecurringTransactionRule {
3912
3791
  /**
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"
3792
+ * A unique identifier for the recurring transaction rule in the Lago application. Can be used to update a recurring transaction rule.
3793
+ * @format uuid
3794
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3920
3795
  */
3921
- status: "draft" | "finalized" | "voided" | "failed" | "pending";
3796
+ lago_id: string;
3922
3797
  /**
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"
3798
+ * The trigger. Possible values are `interval` or `threshold`.
3799
+ * @example "interval"
3928
3800
  */
3929
- payment_status: "pending" | "succeeded" | "failed";
3801
+ trigger: "interval" | "threshold";
3930
3802
  /**
3931
- * The currency of the invoice issued.
3932
- * @example "EUR"
3803
+ * The method used for recurring top-up. Possible values are `fixed` or `target`.
3804
+ * @example "target"
3933
3805
  */
3934
- currency: Currency;
3806
+ method: "fixed" | "target";
3935
3807
  /**
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
3808
+ * The interval used for recurring top-up. It represents the frequency at which automatic top-up occurs. The interval can be one of the following values: `weekly`, `monthly`, `quarterly`, `semiannual` or `yearly`. Required only if trigger is set to `interval`.
3809
+ * @example "monthly"
3938
3810
  */
3939
- fees_amount_cents: number;
3811
+ interval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
3940
3812
  /**
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
3813
+ * The status of the recurring transaction rule. Possible values are `active` or `terminated`.
3814
+ * @example "active"
3943
3815
  */
3944
- coupons_amount_cents: number;
3816
+ status: "active" | "terminated";
3945
3817
  /**
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
3818
+ * The threshold for recurring top-ups is the value at which an automatic top-up is triggered. For example, if this threshold is set at 10 credits, an automatic top-up will occur whenever the wallet balance falls to or below 10 credits. Required only when trigger is set to `threshold`.
3819
+ * @pattern ^[0-9]+.?[0-9]*$
3820
+ * @example "20.0"
3948
3821
  */
3949
- credit_notes_amount_cents: number;
3822
+ threshold_credits: string;
3950
3823
  /**
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
3824
+ * The number of paid credits. Required only if there is no granted credits.
3825
+ * @pattern ^[0-9]+.?[0-9]*$
3826
+ * @example "20.0"
3957
3827
  */
3958
- sub_total_excluding_taxes_amount_cents: number;
3828
+ paid_credits: string;
3959
3829
  /**
3960
- * The sum of tax amount associated with the invoice, expressed in cents.
3961
- * @example 20
3830
+ * The number of free granted credits. Required only if there is no paid credits.
3831
+ * @pattern ^[0-9]+.?[0-9]*$
3832
+ * @example "10.0"
3962
3833
  */
3963
- taxes_amount_cents: number;
3834
+ granted_credits: string;
3964
3835
  /**
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
3836
+ * The effective start date for recurring top-ups. This date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
3837
+ * @format date-time
3838
+ * @example "2022-08-08T00:00:00Z"
3971
3839
  */
3972
- sub_total_including_taxes_amount_cents: number;
3840
+ started_at: string | null;
3973
3841
  /**
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
3842
+ * The target ongoing balance is the value set for the ongoing balance to be reached by the automatic top-up. Required only when trigger is set to `target`.
3843
+ * @pattern ^[0-9]+.?[0-9]*$
3844
+ * @example "200.0"
3976
3845
  */
3977
- prepaid_credit_amount_cents: number;
3846
+ target_ongoing_balance: string | null;
3978
3847
  /**
3979
- * The usage already billed in previous invoices. Only apply to `progressive_billing` and `subscription` invoices.
3980
- * @example 0
3848
+ * The date of the metadata object creation, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC). The creation_date provides a standardized and internationally recognized timestamp for when the metadata object was created
3849
+ * @format date-time
3850
+ * @example "2022-04-29T08:59:51Z"
3981
3851
  */
3982
- progressive_billing_credit_amount_cents: number;
3852
+ created_at: string;
3983
3853
  /**
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
3854
+ * The expiration date and time for this specific recurring transaction rule. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
3855
+ * @format date-time
3856
+ * @example "2023-09-30T23:59:59Z"
3986
3857
  */
3987
- total_amount_cents: number;
3988
- /** @example 3 */
3989
- version_number: number;
3858
+ expiration_at: string | null;
3990
3859
  /**
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.
3860
+ * A boolean setting that, when set to true, delays issuing an invoice for a wallet top-up until a successful payment is made; if false, the invoice is issued immediately upon wallet top-up, regardless of the payment status. Default value of false.
3992
3861
  * @example false
3993
3862
  */
3994
- self_billed?: boolean;
3863
+ invoice_requires_successful_payment: boolean;
3995
3864
  /**
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"
3999
- */
4000
- file_url?: string;
4001
- /**
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"
3865
+ * This field allows you to store a list of key-value pairs containing additional information or custom attributes. These key-value pairs will populate the metadata of the wallet transactions triggered by this rule.
3866
+ * @example [{"key":"example_key","value":"example_value"},{"key":"another_key","value":"another_value"}]
4005
3867
  */
4006
- created_at: string;
3868
+ transaction_metadata: {
3869
+ /** The unique identifier for the attribute. */
3870
+ key?: string;
3871
+ /** The value associated with the key. */
3872
+ value?: string;
3873
+ }[];
4007
3874
  /**
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"
3875
+ * The name of the wallet transactions triggered by this rule. It will appear on the invoice as the label for the fee. If not set, the label on the invoice will fallback to either `Prepaid credits - {{wallet_name}}` if the wallet name is set, or `Prepaid credits`.
3876
+ * @example "Tokens for models 'high-fidelity-boost'"
4011
3877
  */
4012
- updated_at: string;
3878
+ transaction_name: string | null;
4013
3879
  }
4014
- export interface BillingPeriodObject {
3880
+ export interface WalletObject {
4015
3881
  /**
4016
- * Unique identifier assigned to the subscription, created by Lago.
3882
+ * Unique identifier assigned to the wallet within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the wallet's record within the Lago system.
4017
3883
  * @format uuid
4018
3884
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4019
3885
  */
4020
- lago_subscription_id: string;
4021
- /**
4022
- * Unique identifier assigned to the subscription in your application.
4023
- * @example "external_id"
4024
- */
4025
- external_subscription_id: string;
3886
+ lago_id: string;
4026
3887
  /**
4027
- * Unique identifier assigned to the plan, created by Lago.
3888
+ * Unique identifier assigned to the customer within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the customer's record within the Lago system.
4028
3889
  * @format uuid
4029
3890
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4030
3891
  */
4031
- lago_plan_id: string;
3892
+ lago_customer_id: string;
4032
3893
  /**
4033
- * The beginning date of the subscription billing period. This field indicates the start date of the billing period associated with the subscription fee.
3894
+ * The customer external unique identifier (provided by your own application)
3895
+ * @example "hooli_1234"
3896
+ */
3897
+ external_customer_id: string;
3898
+ /**
3899
+ * The status of the wallet. Possible values are `active` or `terminated`.
3900
+ * @example "active"
3901
+ */
3902
+ status: "active" | "terminated";
3903
+ /**
3904
+ * The currency of the wallet.
3905
+ * @example "USD"
3906
+ */
3907
+ currency: Currency;
3908
+ /**
3909
+ * The name of the wallet.
3910
+ * @example "Prepaid"
3911
+ */
3912
+ name?: string | null;
3913
+ /**
3914
+ * The rate of conversion between credits and the amount in the specified currency. It indicates the ratio or factor used to convert credits into the corresponding monetary value in the currency of the transaction.
3915
+ * @pattern ^[0-9]+.?[0-9]*$
3916
+ * @example "1.5"
3917
+ */
3918
+ rate_amount: string;
3919
+ /**
3920
+ * The current wallet balance expressed in credits. This reflects the available balance after all transactions are settled.
3921
+ * @pattern ^[0-9]+.?[0-9]*$
3922
+ * @example "28.0"
3923
+ */
3924
+ credits_balance: string;
3925
+ /**
3926
+ * The current wallet balance expressed in cents. This reflects the available balance after all transactions are settled.
3927
+ * @example 1000
3928
+ */
3929
+ balance_cents: number;
3930
+ /**
3931
+ * The number of consumed credits.
3932
+ * @pattern ^[0-9]+.?[0-9]*$
3933
+ * @example "2.0"
3934
+ */
3935
+ consumed_credits: string;
3936
+ /**
3937
+ * The date of the wallet creation, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
4034
3938
  * @format date-time
4035
3939
  * @example "2022-04-29T08:59:51Z"
4036
3940
  */
4037
- subscription_from_datetime: string;
3941
+ created_at: string;
4038
3942
  /**
4039
- * The ending date of the subscription billing period. This field indicates the end date of the billing period associated with the subscription fee.
3943
+ * The date and time that determines when the wallet will expire. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
4040
3944
  * @format date-time
4041
- * @example "2022-05-29T08:59:51Z"
3945
+ * @example null
4042
3946
  */
4043
- subscription_to_datetime: string;
3947
+ expiration_at?: string | null;
4044
3948
  /**
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.
3949
+ * The date and time of the last balance top-up. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
4046
3950
  * @format date-time
4047
3951
  * @example "2022-04-29T08:59:51Z"
4048
3952
  */
4049
- charges_from_datetime: string;
3953
+ last_balance_sync_at?: string | null;
4050
3954
  /**
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.
3955
+ * The date and time of the last credits consumption. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
4052
3956
  * @format date-time
4053
- * @example "2022-05-29T08:59:51Z"
3957
+ * @example "2022-04-29T08:59:51Z"
4054
3958
  */
4055
- charges_to_datetime: string;
3959
+ last_consumed_credit_at?: string | null;
4056
3960
  /**
4057
- * The reason explaining why this subscription appears on the invoice.
4058
- * @example "subscription_starting"
3961
+ * The date of terminaison of the wallet. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
3962
+ * @format date-time
3963
+ * @example "2022-09-14T16:35:31Z"
4059
3964
  */
4060
- invoicing_reason: "subscription_starting" | "subscription_periodic" | "subscription_terminating" | "in_advance_charge" | "in_advance_charge_periodic" | "progressive_billing";
4061
- }
4062
- export interface InvoiceMetadataObject {
3965
+ terminated_at?: string | null;
4063
3966
  /**
4064
- * Unique identifier assigned to the invoice metadata within the Lago application.
4065
- * @format uuid
4066
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3967
+ * A boolean setting that, when set to true, delays issuing an invoice for a wallet top-up until a successful payment is made; if false, the invoice is issued immediately upon wallet top-up, regardless of the payment status. Default value of false.
3968
+ * @example false
4067
3969
  */
4068
- lago_id?: string;
3970
+ invoice_requires_successful_payment: boolean;
3971
+ /** Set wallet limitations to fee types. */
3972
+ applies_to?: {
3973
+ /**
3974
+ * An array of fee types to which the wallet is applicable. By specifying the fee types in this field, you can restrict the wallet's usage to specific fee types only.
3975
+ * @example ["charge"]
3976
+ */
3977
+ fee_types?: ("charge" | "subscription" | "commitment")[];
3978
+ /**
3979
+ * An array of billable metric codes to which the wallet is applicable. By specifying the billable metric codes in this field, you can restrict the wallet's usage to specific metrics only.
3980
+ * @example ["bm1"]
3981
+ */
3982
+ billable_metric_codes?: string[];
3983
+ };
3984
+ /** List of recurring transaction rules. Currently, we only allow one recurring rule per wallet. */
3985
+ recurring_transaction_rules?: WalletRecurringTransactionRule[];
4069
3986
  /**
4070
- * Represents the key of the metadata's key-value pair.
4071
- * @example "digital_ref_id"
3987
+ * The ongoing wallet balance expressed in cents. This represents the `balance_cents` minus the `ongoing_usage_balance_cents`, showing the real time balance after accounting for current usage including taxes.
3988
+ * @example 800
4072
3989
  */
4073
- key?: string;
3990
+ ongoing_balance_cents: number;
4074
3991
  /**
4075
- * Represents the value of the metadata's key-value pair.
4076
- * @example "INV-0123456-98765"
3992
+ * The ongoing usage balance of the wallet, expressed in cents. This reflects all current usage and draft invoices including taxes.
3993
+ * @example 200
4077
3994
  */
4078
- value?: string;
3995
+ ongoing_usage_balance_cents: number;
4079
3996
  /**
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).
4081
- * @format date-time
4082
- * @example "2022-04-29T08:59:51Z"
3997
+ * The ongoing wallet balance expressed in credits. This represents the `credits_balance` minus the `credits_ongoing_usage_balance`, showing the real time balance after accounting for current usage including taxes.
3998
+ * @pattern ^[0-9]+.?[0-9]*$
3999
+ * @example "8.0"
4083
4000
  */
4084
- created_at?: string;
4001
+ credits_ongoing_balance: string;
4002
+ /**
4003
+ * The ongoing usage balance of the wallet, expressed in credits. This reflects all current usage and draft invoices including taxes.
4004
+ * @pattern ^[0-9]+.?[0-9]*$
4005
+ * @example "2.0"
4006
+ */
4007
+ credits_ongoing_usage_balance: string;
4085
4008
  }
4086
- export type InvoiceAppliedTaxObject = BaseAppliedTax & {
4009
+ export interface WalletsPaginated {
4010
+ wallets: WalletObject[];
4011
+ meta: PaginationMeta;
4012
+ }
4013
+ /** Details about the pricing unit used for charge usage. */
4014
+ export interface UsagePricingUnitDetailsObject {
4087
4015
  /**
4088
- * Unique identifier of the invoice, created by Lago.
4089
- * @format uuid
4090
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4016
+ * The amount in cents in the pricing unit.
4017
+ * @example 200
4091
4018
  */
4092
- lago_invoice_id?: string;
4019
+ amount_cents: number;
4093
4020
  /**
4094
- * Fees total amount on which the tax is applied
4095
- * @example 20000
4021
+ * The short name of the pricing unit.
4022
+ * @example "CR"
4096
4023
  */
4097
- fees_amount_cents?: number;
4098
- };
4099
- export interface UsageThresholdObject {
4024
+ short_name: string;
4100
4025
  /**
4101
- * Unique identifier of the usage threshold created by Lago.
4102
- * @format uuid
4103
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4026
+ * The conversion rate from pricing units to the plan's currency.
4027
+ * @example "0.5"
4104
4028
  */
4105
- lago_id: string;
4029
+ conversion_rate: string;
4030
+ }
4031
+ /** Array of filter object, representing multiple dimensions for a charge item. */
4032
+ export type CustomerChargeFiltersUsageObject = {
4106
4033
  /**
4107
- * The display name of the usage threshold.
4108
- * @example "Threshold 1"
4034
+ * The number of units consumed for a specific charge filter related to a charge item.
4035
+ * @pattern ^[0-9]+.?[0-9]*$
4036
+ * @example "0.9"
4109
4037
  */
4110
- threshold_display_name: string | null;
4038
+ units?: string;
4111
4039
  /**
4112
- * The amount to reach to trigger a `progressive_billing` invoice.
4113
- * @example 10000
4040
+ * The amount in cents, tax excluded, consumed for a specific charge filter related to a charge item.
4041
+ * @example 1000
4114
4042
  */
4115
- amount_cents: number;
4043
+ amount_cents?: number;
4116
4044
  /**
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
4045
+ * The quantity of usage events that have been recorded for a particular charge filter during the specified time period. These events may also be referred to as the number of transactions in some contexts.
4046
+ * @example 10
4119
4047
  */
4120
- recurring: boolean;
4048
+ events_count?: number;
4121
4049
  /**
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"
4050
+ * Specifies the name that will be displayed on an invoice.
4051
+ * @example "AWS eu-east-1"
4125
4052
  */
4126
- created_at: string;
4053
+ invoice_display_name?: string;
4054
+ /** Details about the pricing unit used for charge usage. */
4055
+ pricing_unit_details?: UsagePricingUnitDetailsObject;
4127
4056
  /**
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"
4057
+ * List of filter values applied to the usage.
4058
+ * @example {"region":["us-east-1"]}
4131
4059
  */
4132
- updated_at: string;
4133
- }
4134
- export interface AppliedUsageThresholdObject {
4060
+ values?: Record<string, string[]>;
4061
+ }[];
4062
+ /** Array of aggregated fees, grouped by the event properties defined in a `standard` charge model. */
4063
+ export type CustomerChargeGroupedUsageObject = {
4135
4064
  /**
4136
- * The amount of usage in cents that has been accumulated over the lifetime of the subscription.
4137
- * @example 2000
4065
+ * The amount in cents, tax excluded, consumed for a specific group related to a charge item.
4066
+ * @example 1000
4138
4067
  */
4139
- lifetime_usage_amount_cents: number;
4068
+ amount_cents?: number;
4140
4069
  /**
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"
4070
+ * The quantity of usage events that have been recorded for a particular charge during the specified time period. These events may also be referred to as the number of transactions in some contexts.
4071
+ * @example 10
4144
4072
  */
4145
- created_at: string;
4146
- usage_threshold: UsageThresholdObject;
4147
- }
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;
4159
- }
4160
- export interface InvoiceOneOffCreateInput {
4161
- invoice: {
4162
- /**
4163
- * Unique identifier assigned to the customer in your application.
4164
- * @example "hooli_1234"
4073
+ events_count?: number;
4074
+ /**
4075
+ * The number of units consumed for a specific group related to a charge item.
4076
+ * @pattern ^[0-9]+.?[0-9]*$
4077
+ * @example "0.9"
4078
+ */
4079
+ units?: string;
4080
+ /** Details about the pricing unit used for charge usage. */
4081
+ pricing_unit_details?: UsagePricingUnitDetailsObject;
4082
+ /** Key value list of event properties aggregated by the charge model */
4083
+ grouped_by?: Record<string, string>;
4084
+ /** Array of filter object, representing multiple dimensions for a charge item. */
4085
+ filters?: CustomerChargeFiltersUsageObject;
4086
+ }[];
4087
+ export interface CustomerChargeUsageObject {
4088
+ /**
4089
+ * The number of units consumed by the customer for a specific charge item.
4090
+ * @pattern ^[0-9]+.?[0-9]*$
4091
+ * @example "1.0"
4092
+ */
4093
+ units: string;
4094
+ /**
4095
+ * The quantity of usage events that have been recorded for a particular charge during the specified time period. These events may also be referred to as the number of transactions in some contexts.
4096
+ * @example 10
4097
+ */
4098
+ events_count: number;
4099
+ /**
4100
+ * The amount in cents, tax excluded, consumed by the customer for a specific charge item.
4101
+ * @example 123
4102
+ */
4103
+ amount_cents: number;
4104
+ /**
4105
+ * The currency of a usage item consumed by the customer.
4106
+ * @example "EUR"
4107
+ */
4108
+ amount_currency: Currency;
4109
+ /** Details about the pricing unit used for charge usage. */
4110
+ pricing_unit_details?: UsagePricingUnitDetailsObject;
4111
+ /** Object listing all the properties for a specific charge item. */
4112
+ charge: {
4113
+ /**
4114
+ * Unique identifier assigned to the charge within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the charge's record within the Lago system.
4115
+ * @format uuid
4116
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4117
+ */
4118
+ lago_id: string;
4119
+ /**
4120
+ * The pricing model applied to this charge. Possible values are standard, `graduated`, `percentage`, `package` or `volume`.
4121
+ * @example "graduated"
4122
+ */
4123
+ charge_model: "standard" | "graduated" | "package" | "percentage" | "volume";
4124
+ /**
4125
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
4126
+ * @example "Setup"
4127
+ */
4128
+ invoice_display_name?: string;
4129
+ };
4130
+ /** The related billable metric object. */
4131
+ billable_metric: {
4132
+ /**
4133
+ * Unique identifier assigned to the billable metric within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the billable metric's record within the Lago system.
4134
+ * @format uuid
4135
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4136
+ */
4137
+ lago_id: string;
4138
+ /**
4139
+ * The name of the billable metric used for this charge.
4140
+ * @example "Storage"
4141
+ */
4142
+ name: string;
4143
+ /**
4144
+ * The code of the billable metric used for this charge.
4145
+ * @example "storage"
4146
+ */
4147
+ code: string;
4148
+ /**
4149
+ * The aggregation type of the billable metric used for this charge. Possible values are `count_agg`, `sum_agg`, `max_agg` or `unique_count_agg`.
4150
+ * @example "sum_agg"
4151
+ */
4152
+ aggregation_type: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg" | "weighted_sum_agg" | "latest_agg";
4153
+ };
4154
+ /** Array of filter object, representing multiple dimensions for a charge item. */
4155
+ filters?: CustomerChargeFiltersUsageObject;
4156
+ /** Array of aggregated fees, grouped by the event properties defined in a `standard` charge model. */
4157
+ grouped_usage?: CustomerChargeGroupedUsageObject;
4158
+ }
4159
+ export interface CustomerUsageObject {
4160
+ /**
4161
+ * The lower bound of the billing period, expressed in the ISO 8601 datetime format in Coordinated Universal Time (UTC).
4162
+ * @format date-time
4163
+ * @example "2022-07-01T00:00:00Z"
4164
+ */
4165
+ from_datetime: string;
4166
+ /**
4167
+ * The upper bound of the billing period, expressed in the ISO 8601 datetime format in Coordinated Universal Time (UTC).
4168
+ * @format date-time
4169
+ * @example "2022-07-31T23:59:59Z"
4170
+ */
4171
+ to_datetime: string;
4172
+ /**
4173
+ * The date of creation of the invoice.
4174
+ * @format date
4175
+ * @example "2022-08-01"
4176
+ */
4177
+ issuing_date: string;
4178
+ /**
4179
+ * A unique identifier associated with the invoice related to this particular usage record.
4180
+ * @format uuid
4181
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4182
+ */
4183
+ lago_invoice_id?: string | null;
4184
+ /**
4185
+ * The currency of the customer's current usage.
4186
+ * @example "EUR"
4187
+ */
4188
+ currency?: Currency;
4189
+ /**
4190
+ * The amount in cents, tax excluded.
4191
+ * @example 123
4192
+ */
4193
+ amount_cents: number;
4194
+ /**
4195
+ * The tax amount in cents.
4196
+ * @example 200
4197
+ */
4198
+ taxes_amount_cents: number;
4199
+ /**
4200
+ * The total amount in cents, tax included.
4201
+ * @example 123
4202
+ */
4203
+ total_amount_cents: number;
4204
+ /** Array of charges that comprise the current usage. It contains detailed information about individual charge items associated with the usage. */
4205
+ charges_usage: CustomerChargeUsageObject[];
4206
+ }
4207
+ export interface CustomerUsage {
4208
+ customer_usage: CustomerUsageObject;
4209
+ }
4210
+ export interface CustomerProjectedUsageObject {
4211
+ /**
4212
+ * The lower bound of the billing period, expressed in the ISO 8601 datetime format in Coordinated Universal Time (UTC).
4213
+ * @format date-time
4214
+ * @example "2022-07-01T00:00:00Z"
4215
+ */
4216
+ from_datetime: string;
4217
+ /**
4218
+ * The upper bound of the billing period, expressed in the ISO 8601 datetime format in Coordinated Universal Time (UTC).
4219
+ * @format date-time
4220
+ * @example "2022-07-31T23:59:59Z"
4221
+ */
4222
+ to_datetime: string;
4223
+ /**
4224
+ * The date of creation of the invoice.
4225
+ * @format date
4226
+ * @example "2022-08-01"
4227
+ */
4228
+ issuing_date: string;
4229
+ /**
4230
+ * A unique identifier associated with the invoice related to this particular usage record.
4231
+ * @format uuid
4232
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4233
+ */
4234
+ lago_invoice_id?: string | null;
4235
+ /**
4236
+ * The currency of the customer's current usage.
4237
+ * @example "EUR"
4238
+ */
4239
+ currency?: Currency;
4240
+ /**
4241
+ * The amount in cents, tax excluded.
4242
+ * @example 123
4243
+ */
4244
+ amount_cents: number;
4245
+ /**
4246
+ * The projected amount in cents, tax excluded.
4247
+ * @example 256
4248
+ */
4249
+ projected_amount_cents: number;
4250
+ /**
4251
+ * The tax amount in cents.
4252
+ * @example 200
4253
+ */
4254
+ taxes_amount_cents: number;
4255
+ /**
4256
+ * The total amount in cents, tax included.
4257
+ * @example 123
4258
+ */
4259
+ total_amount_cents: number;
4260
+ /** Array of charges that comprise the current usage. It contains detailed information about individual charge items associated with the usage. */
4261
+ charges_usage: CustomerChargeUsageObject[];
4262
+ }
4263
+ export interface CustomerProjectedUsage {
4264
+ customer_projected_usage: CustomerProjectedUsageObject;
4265
+ }
4266
+ export interface CustomerPastUsage {
4267
+ usage_periods: CustomerUsage[];
4268
+ meta: PaginationMeta;
4269
+ }
4270
+ /** . */
4271
+ export interface CustomerCheckoutUrl {
4272
+ customer?: {
4273
+ /**
4274
+ * Unique identifier assigned to the customer within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the customer's record within the Lago system
4275
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4276
+ */
4277
+ lago_customer_id: string;
4278
+ /**
4279
+ * The customer external unique identifier (provided by your own application)
4280
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4165
4281
  */
4166
4282
  external_customer_id: string;
4167
4283
  /**
4168
- * The currency of the invoice.
4169
- * @example "EUR"
4284
+ * The Payment Provider name linked to the Customer.
4285
+ * @example "stripe"
4170
4286
  */
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
- }[];
4287
+ payment_provider: string;
4288
+ /**
4289
+ * Code of the payment provider
4290
+ * @example "Stripe Prod"
4291
+ */
4292
+ payment_provider_code?: string;
4293
+ /**
4294
+ * The new generated Payment Provider Checkout URL for the Customer.
4295
+ * @example "https://foo.bar"
4296
+ */
4297
+ checkout_url?: string;
4298
+ };
4299
+ }
4300
+ export interface EventObject {
4301
+ /**
4302
+ * Unique identifier assigned to the event within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the event's record within the Lago system
4303
+ * @format uuid
4304
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4305
+ */
4306
+ lago_id: string;
4307
+ /**
4308
+ * This field represents a unique identifier for the event. It is crucial for ensuring idempotency, meaning that each event can be uniquely identified and processed without causing any unintended side effects.
4309
+ * @example "transaction_1234567890"
4310
+ */
4311
+ transaction_id: string;
4312
+ /**
4313
+ * Unique identifier assigned to the customer within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the customer's record within the Lago system
4314
+ * @format uuid
4315
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4316
+ */
4317
+ lago_customer_id: string | null;
4318
+ /**
4319
+ * The code that identifies a targeted billable metric. It is essential that this code matches the `code` property of one of your active billable metrics. If the provided code does not correspond to any active billable metric, it will be ignored during the process.
4320
+ * @example "storage"
4321
+ */
4322
+ code: string;
4323
+ /**
4324
+ * This field captures the Unix timestamp in seconds indicating the occurrence of the event in Coordinated Universal Time (UTC). If this timestamp is not provided, the API will automatically set it to the time of event reception.
4325
+ * @format date-time
4326
+ * @example "2022-04-29T08:59:51.123Z"
4327
+ */
4328
+ timestamp: string;
4329
+ /**
4330
+ * The precise total amount that was sent in the event payload. This filed is used by the `dynamic` pricing model.
4331
+ * @example "1234.56"
4332
+ */
4333
+ precise_total_amount_cents?: string | null;
4334
+ /**
4335
+ * This field represents additional properties associated with the event, which are utilized in the calculation of the final fee. This object becomes mandatory when the targeted billable metric employs a `sum_agg`, `max_agg`, or `unique_count_agg` aggregation method. However, when using a simple `count_agg`, this object is not required.
4336
+ * @example {"gb":10}
4337
+ */
4338
+ properties?: {
4339
+ /** The `operation_type` field is only necessary when adding or removing a specific unit when the targeted billable metric adopts a `unique_count_agg` aggregation method. In other cases, the `operation_type` field is not required. The valid values for the `operation_type` field are `add` or `remove`, which indicate whether the unit is being added or removed from the unique count aggregation, respectively. */
4340
+ operation_type?: "add" | "remove";
4341
+ [key: string]: any;
4342
+ };
4343
+ /**
4344
+ * Unique identifier assigned to the subscription within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the subscription's record within the Lago system
4345
+ * @format uuid
4346
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4347
+ */
4348
+ lago_subscription_id: string | null;
4349
+ /**
4350
+ * The unique identifier of the subscription within your application. It is a mandatory field when the customer possesses multiple subscriptions or when the `external_customer_id` is not provided.
4351
+ * @example "sub_1234567890"
4352
+ */
4353
+ external_subscription_id: string;
4354
+ /**
4355
+ * The creation date of the event's record in the Lago application, presented in the ISO 8601 datetime format, specifically in Coordinated Universal Time (UTC). It provides the precise timestamp of when the event's record was created within the Lago application
4356
+ * @format date-time
4357
+ * @example "2022-04-29T08:59:51Z"
4358
+ */
4359
+ created_at: string;
4360
+ }
4361
+ export interface EventsPaginated {
4362
+ events: EventObject[];
4363
+ meta: PaginationMeta;
4364
+ }
4365
+ export interface EventInputObject {
4366
+ /**
4367
+ * This field represents a unique identifier for the event.
4368
+ * It is crucial for ensuring idempotency, meaning that each event can be uniquely identified and processed without causing any unintended side effects.
4369
+ *
4370
+ * WARNING: If the Lago organization is configured to use the new Clickhouse-based event pipeline (designed for high-volume processing), the idempotency logic is handled differently.
4371
+ * Event uniqueness is maintained with both `transaction_id` and `timestamp` fields.
4372
+ * If a new event arrives with identical values for these two fields as an existing event, the new one will overwrite the previous event rather than being rejected.
4373
+ * @example "transaction_1234567890"
4374
+ */
4375
+ transaction_id: string;
4376
+ /**
4377
+ * The unique identifier of the subscription in your application. This field is mandatory in order to link events to the correct customer subscription.
4378
+ * @example "sub_1234567890"
4379
+ */
4380
+ external_subscription_id: string;
4381
+ /**
4382
+ * The code that identifies a targeted billable metric. It is essential that this code matches the `code` property of one of your active billable metrics. If the provided code does not correspond to any active billable metric, it will be ignored during the process.
4383
+ * @example "storage"
4384
+ */
4385
+ code: string;
4386
+ /**
4387
+ * This field captures the Unix timestamp in seconds indicating the occurrence of the event in Coordinated Universal Time (UTC).
4388
+ * If this timestamp is not provided, the API will automatically set it to the time of event reception.
4389
+ * You can also provide miliseconds precision by appending decimals to the timestamp.
4390
+ * @example "1651240791.123"
4391
+ */
4392
+ timestamp?: number | string;
4393
+ /**
4394
+ * The precise total amount in cents with precision used by the `dynamic` pricing model to compute the usage amount.
4395
+ * @example "1234.56"
4396
+ */
4397
+ precise_total_amount_cents?: string | null;
4398
+ /**
4399
+ * This field represents additional properties associated with the event, which are utilized in the calculation of the final fee. This object becomes mandatory when the targeted billable metric employs a `sum_agg`, `max_agg`, or `unique_count_agg` aggregation method. However, when using a simple `count_agg`, this object is not required.
4400
+ * @example {"gb":10}
4401
+ */
4402
+ properties?: object | null;
4403
+ }
4404
+ export interface EventInput {
4405
+ event: EventInputObject;
4406
+ }
4407
+ export interface EventCreated {
4408
+ event: EventObject & {
4409
+ /**
4410
+ * The value will always be null in this response as the event processing is done asynchronously
4411
+ * @example null
4412
+ */
4413
+ lago_customer_id?: null;
4414
+ };
4415
+ }
4416
+ export interface EventBatchInput {
4417
+ events: EventInputObject[];
4418
+ }
4419
+ export interface EventsCreated {
4420
+ events: (EventObject & {
4421
+ /**
4422
+ * The value will always be null in this response as the event processing is done asynchronously
4423
+ * @example null
4424
+ */
4425
+ lago_customer_id?: null;
4426
+ })[];
4427
+ }
4428
+ export interface EventEstimateFeesInput {
4429
+ event: {
4430
+ /**
4431
+ * The code that identifies a targeted billable metric. It is essential that this code matches the `code` property of one of your active billable metrics. If the provided code does not correspond to any active billable metric, it will be ignored during the process.
4432
+ * @example "storage"
4433
+ */
4434
+ code: string;
4435
+ /**
4436
+ * The unique identifier of the subscription within your application.
4437
+ * @example "sub_1234567890"
4438
+ */
4439
+ external_subscription_id: string;
4440
+ /** This field represents additional properties associated with the event, which are utilized in the calculation of the final fee. This object becomes mandatory when the targeted billable metric employs a `sum_agg`, `max_agg`, or `unique_count_agg` aggregation method. However, when using a simple `count_agg`, this object is not required. */
4441
+ properties?: object;
4220
4442
  };
4221
4443
  }
4222
- export interface SubscriptionObject {
4444
+ export interface Fees {
4445
+ fees: FeeObject[];
4446
+ }
4447
+ export interface EventEstimateInstantFeesInput {
4448
+ event: {
4449
+ /**
4450
+ * The code that identifies a targeted billable metric. It is essential that this code matches the `code` property of one of your active billable metrics. If the provided code does not correspond to any active billable metric, it will be ignored during the process.
4451
+ * @example "storage"
4452
+ */
4453
+ code: string;
4454
+ /**
4455
+ * The unique identifier of the subscription within your application.
4456
+ * @example "sub_1234567890"
4457
+ */
4458
+ external_subscription_id: string;
4459
+ /** This field represents additional properties associated with the event, which are utilized in the calculation of the final fee. This object becomes mandatory when the targeted billable metric employs a `sum_agg`, `max_agg`, or `unique_count_agg` aggregation method. However, when using a simple `count_agg`, this object is not required. */
4460
+ properties?: object;
4461
+ /**
4462
+ * This field represents a unique identifier for the event.
4463
+ * @example "transaction_1234567890"
4464
+ */
4465
+ transaction_id?: string | null;
4466
+ };
4467
+ }
4468
+ export interface FeeEstimateObject {
4469
+ lago_id?: null;
4223
4470
  /**
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
4471
+ * Unique identifier assigned to the charge that the fee belongs to
4225
4472
  * @format uuid
4226
4473
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4227
4474
  */
4228
- lago_id: string;
4475
+ lago_charge_id?: string;
4229
4476
  /**
4230
- * The subscription external unique identifier (provided by your own application).
4231
- * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4477
+ * Unique identifier assigned to the charge filter that the fee belongs to
4478
+ * @format uuid
4479
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4232
4480
  */
4233
- external_id: string;
4481
+ lago_charge_filter_id?: string | null;
4482
+ lago_invoice_id?: null;
4483
+ lago_true_up_fee_id?: null;
4484
+ lago_true_up_parent_fee_id?: null;
4234
4485
  /**
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
4486
+ * Unique identifier assigned to the subscription, created by Lago. This field is specifically displayed when the fee type is charge or subscription.
4236
4487
  * @format uuid
4237
4488
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4238
4489
  */
4239
- lago_customer_id: string;
4490
+ lago_subscription_id?: string;
4240
4491
  /**
4241
- * The customer external unique identifier (provided by your own application).
4242
- * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4492
+ * Unique identifier assigned to the customer, created by Lago. This field is specifically displayed when the fee type is charge or subscription.
4493
+ * @format uuid
4494
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4243
4495
  */
4244
- external_customer_id: string;
4496
+ lago_customer_id?: string;
4245
4497
  /**
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"
4498
+ * Unique identifier assigned to the customer in your application. This field is specifically displayed when the fee type is charge or subscription.
4499
+ * @example "external_id"
4248
4500
  */
4249
- billing_time: "calendar" | "anniversary";
4501
+ external_customer_id?: string;
4250
4502
  /**
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"
4503
+ * Unique identifier assigned to the subscription in your application. This field is specifically displayed when the fee type is charge or subscription.
4504
+ * @example "external_id"
4253
4505
  */
4254
- name: string | null;
4506
+ external_subscription_id?: string;
4255
4507
  /**
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"
4508
+ * The cost of this specific fee, excluding any applicable taxes.
4509
+ * @example 100
4258
4510
  */
4259
- plan_code: string;
4511
+ amount_cents: number;
4260
4512
  /**
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"
4513
+ * The cost of this specific fee, excluding any applicable taxes, with precision.
4514
+ * @example 1.0001
4267
4515
  */
4268
- status: "active" | "canceled" | "pending" | "terminated";
4516
+ precise_amount?: number;
4269
4517
  /**
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"
4518
+ * The cost of this specific fee, including any applicable taxes, with precision.
4519
+ * @example 1.0212
4273
4520
  */
4274
- created_at: string;
4521
+ precise_total_amount?: number;
4275
4522
  /**
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"
4523
+ * The currency of this specific fee. It indicates the monetary unit in which the fee's cost is expressed.
4524
+ * @example "EUR"
4279
4525
  */
4280
- canceled_at: string | null;
4526
+ amount_currency: Currency;
4281
4527
  /**
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"
4528
+ * The cost of the tax associated with this specific fee.
4529
+ * @example 0
4285
4530
  */
4286
- started_at: string | null;
4531
+ taxes_amount_cents: number;
4287
4532
  /**
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"
4533
+ * The cost of the tax associated with this specific fee, with precision.
4534
+ * @example 0
4291
4535
  */
4292
- ending_at: string | null;
4536
+ taxes_precise_amount?: number;
4293
4537
  /**
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"
4538
+ * The tax rate associated with this specific fee.
4539
+ * @example 20
4297
4540
  */
4298
- subscription_at: string;
4541
+ taxes_rate: number;
4299
4542
  /**
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"
4543
+ * The number of units used to charge the customer. This field indicates the quantity or count of units consumed or utilized in the context of the charge. It helps in determining the basis for calculating the fee or cost associated with the usage of the service or product provided to the customer.
4544
+ * @example "0.32"
4303
4545
  */
4304
- terminated_at: string | null;
4546
+ units: string;
4547
+ description?: null;
4305
4548
  /**
4306
- * The code identifying the previous plan associated with this subscription.
4307
- * @example null
4549
+ * The unit amount of the fee per unit, with precision.
4550
+ * @example 312.5
4308
4551
  */
4309
- previous_plan_code: string | null;
4552
+ precise_unit_amount: number;
4310
4553
  /**
4311
- * The code identifying the next plan in the case of a downgrade.
4312
- * @example null
4554
+ * The coupon amount applied to the estimated instant fee. It will always returns 0
4555
+ * @example "0.0"
4313
4556
  */
4314
- next_plan_code: string | null;
4557
+ precise_coupons_amount_cents?: string;
4315
4558
  /**
4316
- * The date when the plan will be downgraded, represented in ISO 8601 date format.
4317
- * @format date
4318
- * @example "2022-04-30"
4559
+ * The cost of this specific fee, including any applicable taxes.
4560
+ * @example 120
4319
4561
  */
4320
- downgrade_plan_date: string | null;
4562
+ total_amount_cents: number;
4321
4563
  /**
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"
4564
+ * The currency of this specific fee, including any applicable taxes.
4565
+ * @example "EUR"
4325
4566
  */
4326
- trial_ended_at: string | null;
4567
+ total_amount_currency: Currency;
4327
4568
  /**
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"
4569
+ * The number of events that have been sent and used to charge the customer. This field indicates the count or quantity of events that have been processed and considered in the charging process.
4570
+ * @example 1
4331
4571
  */
4332
- current_billing_period_started_at: string | null;
4572
+ events_count?: number;
4333
4573
  /**
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"
4574
+ * Flag that indicates whether the fee was paid in advance. It serves as a boolean value, where `true` represents that the fee was paid in advance (straightaway), and `false` indicates that the fee was not paid in arrears (at the end of the period).
4575
+ * @example true
4337
4576
  */
4338
- current_billing_period_ending_at: string | null;
4577
+ pay_in_advance: boolean;
4339
4578
  /**
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"
4579
+ * Flag that indicates whether the fee was included on the invoice. It serves as a boolean value, where `true` represents that the fee was included on the invoice, and `false` indicates that the fee was not included on the invoice.
4580
+ * @example true
4349
4581
  */
4350
- on_termination_credit_note: "credit" | "refund" | "skip";
4582
+ invoiceable: boolean;
4351
4583
  /**
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"
4584
+ * Indicates the payment status of the fee. It represents the current status of the payment associated with the fee. The value will always `pending`.
4585
+ * @example "pending"
4359
4586
  */
4360
- on_termination_invoice: "generate" | "skip";
4587
+ payment_status: "pending";
4588
+ created_at?: null;
4589
+ succeeded_at?: null;
4590
+ failed_at?: null;
4591
+ refunded_at?: null;
4592
+ /**
4593
+ * Unique identifier assigned to the transaction. This field is specifically displayed when the fee type is `charge` and the payment for the fee is made in advance (`pay_in_advance` is set to `true`).
4594
+ * @example "transaction_1234567890"
4595
+ */
4596
+ event_transaction_id?: string;
4597
+ amount_details?: null;
4598
+ /** Item attached to the fee */
4599
+ item: {
4600
+ /**
4601
+ * The fee type. The value will be `charge`.
4602
+ * @example "charge"
4603
+ */
4604
+ type: "charge";
4605
+ /**
4606
+ * The code of the fee item. It will be the code of the `billable_metric`.
4607
+ * @example "startup"
4608
+ */
4609
+ code: string;
4610
+ /**
4611
+ * The name of the fee item. It will be the name of the `billable_metric`.
4612
+ * @example "Startup"
4613
+ */
4614
+ name: string;
4615
+ /**
4616
+ * The description of the fee item. It will be the name of the `billable_metric`.
4617
+ * @example "Startup description"
4618
+ */
4619
+ description?: string;
4620
+ /**
4621
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
4622
+ * @example "Setup Fee (SF1)"
4623
+ */
4624
+ invoice_display_name?: string;
4625
+ /**
4626
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the actual charge filter values will be used as the default display name.
4627
+ * @example "AWS eu-east-1"
4628
+ */
4629
+ filter_invoice_display_name?: string | null;
4630
+ /** Key value list of event properties */
4631
+ filters?: object | null;
4632
+ /**
4633
+ * Unique identifier of the fee item, created by Lago. It will be the identifier of the `billable_metric`.
4634
+ * @format uuid
4635
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4636
+ */
4637
+ lago_item_id: string;
4638
+ /**
4639
+ * The type of the fee item. Values is `BillableMetric`.
4640
+ * @example "BillableMetric"
4641
+ */
4642
+ item_type: "BillableMetric";
4643
+ /** Key value list of event properties aggregated by the charge model */
4644
+ grouped_by?: Record<string, string>;
4645
+ };
4646
+ }
4647
+ export interface FeesEstimate {
4648
+ fees: FeeEstimateObject[];
4649
+ }
4650
+ export interface EventBatchEstimateInstantFeesInput {
4651
+ events: EventEstimateInstantFeesInput[];
4652
+ }
4653
+ export interface Event {
4654
+ event: EventObject;
4655
+ }
4656
+ export interface FeesPaginated {
4657
+ fees: FeeObject[];
4658
+ meta: PaginationMeta;
4659
+ }
4660
+ export interface Fee {
4661
+ fee: FeeObject;
4662
+ }
4663
+ export interface FeeUpdateInput {
4664
+ fee: {
4665
+ /**
4666
+ * The payment status of the fee. Possible values are `pending`, `succeeded`, `failed` or `refunded`.
4667
+ * @example "succeeded"
4668
+ */
4669
+ payment_status: "pending" | "succeeded" | "failed" | "refunded";
4670
+ };
4671
+ }
4672
+ export interface InvoiceOneOffCreateInput {
4673
+ invoice: {
4674
+ /**
4675
+ * Unique identifier assigned to the customer in your application.
4676
+ * @example "hooli_1234"
4677
+ */
4678
+ external_customer_id: string;
4679
+ /**
4680
+ * The currency of the invoice.
4681
+ * @example "EUR"
4682
+ */
4683
+ currency?: Currency;
4684
+ fees: {
4685
+ /**
4686
+ * The code of the add-on used as invoice item.
4687
+ * @example "setup_fee"
4688
+ */
4689
+ add_on_code: string;
4690
+ /**
4691
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
4692
+ * @example "Setup Fee (SF1)"
4693
+ */
4694
+ invoice_display_name?: string;
4695
+ /**
4696
+ * The amount of the fee per unit, expressed in cents. By default, the amount of the add-on is used.
4697
+ * @example 12000
4698
+ */
4699
+ unit_amount_cents?: number | null;
4700
+ /**
4701
+ * The quantity of units associated with the fee. By default, only 1 unit is added to the invoice.
4702
+ * @pattern ^[0-9]+.?[0-9]*$
4703
+ * @example "2.5"
4704
+ */
4705
+ units?: string | null;
4706
+ /**
4707
+ * This is a description
4708
+ * @example "The description of the fee line item in the invoice. By default, the description of the add-on is used."
4709
+ */
4710
+ description?: string | null;
4711
+ /**
4712
+ * The lower boundary of the invoice billing interval. The `from_datetime` should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
4713
+ * @format date-time
4714
+ * @example "2022-08-08T00:00:00Z"
4715
+ */
4716
+ from_datetime?: string;
4717
+ /**
4718
+ * The upper boundary of the invoice billing interval. The `to_datetime` should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
4719
+ * @format date-time
4720
+ * @example "2022-08-08T00:00:00Z"
4721
+ */
4722
+ to_datetime?: string;
4723
+ /** List of unique code used to identify the taxes. */
4724
+ tax_codes?: TaxCodes;
4725
+ /**
4726
+ * If true, the invoice will be created but not sent to the payment provider.
4727
+ * @default false
4728
+ * @example true
4729
+ */
4730
+ skip_psp?: boolean | null;
4731
+ }[];
4732
+ };
4361
4733
  }
4362
4734
  export interface ErrorDetailObject {
4363
4735
  /**
@@ -4846,67 +5218,6 @@ export interface OrganizationObject {
4846
5218
  export interface Organization {
4847
5219
  organization: OrganizationObject;
4848
5220
  }
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
5221
  export interface PaymentReceiptObject {
4911
5222
  /**
4912
5223
  * Unique identifier of the payment receipt, created by Lago.
@@ -4925,130 +5236,35 @@ export interface PaymentReceiptObject {
4925
5236
  * @example "LAG-1234-001-002"
4926
5237
  */
4927
5238
  number: string;
4928
- payment: PaymentObject;
4929
- }
4930
- export interface PaymentReceiptsPaginated {
4931
- payment_receipts: PaymentReceiptObject[];
4932
- meta: PaginationMeta;
4933
- }
4934
- export interface PaymentReceipt {
4935
- payment_receipt: PaymentReceiptObject;
4936
- }
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
- export interface PaymentRequestCreateInput {
4983
- payment_request: {
4984
- /**
4985
- * The customer external unique identifier (provided by your own application)
4986
- * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4987
- */
4988
- 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;
5239
+ payment: PaymentObject;
5047
5240
  }
5048
- export interface PaymentsPaginated {
5049
- payments: PaymentManualObject[];
5241
+ export interface PaymentReceiptsPaginated {
5242
+ payment_receipts: PaymentReceiptObject[];
5050
5243
  meta: PaginationMeta;
5051
5244
  }
5245
+ export interface PaymentReceipt {
5246
+ payment_receipt: PaymentReceiptObject;
5247
+ }
5248
+ export interface PaymentRequestCreateInput {
5249
+ payment_request: {
5250
+ /**
5251
+ * The customer external unique identifier (provided by your own application)
5252
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
5253
+ */
5254
+ external_customer_id: string;
5255
+ /**
5256
+ * The customer's email address used for sending dunning notifications
5257
+ * @format email
5258
+ * @example "dinesh@piedpiper.test"
5259
+ */
5260
+ email: string;
5261
+ /** A list of Lago IDs for the customer's overdue invoices to start the dunning process */
5262
+ lago_invoice_ids: string[];
5263
+ };
5264
+ }
5265
+ export interface PaymentRequest {
5266
+ payment_request: PaymentRequestObject;
5267
+ }
5052
5268
  export interface PaymentCreateInput {
5053
5269
  payment: {
5054
5270
  /**
@@ -5075,7 +5291,7 @@ export interface PaymentCreateInput {
5075
5291
  };
5076
5292
  }
5077
5293
  export interface Payment {
5078
- payment: PaymentManualObject;
5294
+ payment: PaymentObject;
5079
5295
  }
5080
5296
  export interface MinimumCommitmentObject {
5081
5297
  /**
@@ -5100,10 +5316,10 @@ export interface MinimumCommitmentObject {
5100
5316
  */
5101
5317
  invoice_display_name?: string;
5102
5318
  /**
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`.
5319
+ * The interval used for recurring billing. It represents the frequency at which subscription billing occurs. The interval can be one of the following values: `yearly`, `semiannual`, `quarterly`, `monthly` or `weekly`.
5104
5320
  * @example "monthly"
5105
5321
  */
5106
- interval?: "weekly" | "monthly" | "quarterly" | "yearly";
5322
+ interval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
5107
5323
  /**
5108
5324
  * The date and time when the minimum commitment was created. It is expressed in UTC format according to the ISO 8601 datetime standard. This field provides the timestamp for the exact moment when the minimum commitment was initially created.
5109
5325
  * @format date-time
@@ -5446,10 +5662,10 @@ export interface PlanObject {
5446
5662
  */
5447
5663
  code: string;
5448
5664
  /**
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`.
5665
+ * The interval used for recurring billing. It represents the frequency at which subscription billing occurs. The interval can be one of the following values: `yearly`, `semiannual`, `quarterly`, `monthly` or `weekly`.
5450
5666
  * @example "monthly"
5451
5667
  */
5452
- interval: "weekly" | "monthly" | "quarterly" | "yearly";
5668
+ interval: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
5453
5669
  /**
5454
5670
  * The description on the plan.
5455
5671
  * @example ""
@@ -5476,7 +5692,7 @@ export interface PlanObject {
5476
5692
  */
5477
5693
  pay_in_advance?: boolean;
5478
5694
  /**
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`.
5695
+ * This field, when set to `true`, enables to invoice usage-based charges on monthly basis, even if the cadence of the plan is yearly or semiannual. This allows customers to pay charges overage on a monthly basis. This can be set to true only if the plan's interval is `yearly` or `semiannual`.
5480
5696
  * @example null
5481
5697
  */
5482
5698
  bill_charges_monthly?: boolean | null;
@@ -5563,10 +5779,10 @@ export interface PlanCreateInput {
5563
5779
  */
5564
5780
  code?: string;
5565
5781
  /**
5566
- * The interval used for recurring billing. It represents the frequency at which subscription billing occurs. The interval can be one of the following values: `yearly`, `quarterly`, `monthly`, or `weekly`.
5782
+ * The interval used for recurring billing. It represents the frequency at which subscription billing occurs. The interval can be one of the following values: `yearly`, `semiannual`, `quarterly`, `monthly`, or `weekly`.
5567
5783
  * @example "monthly"
5568
5784
  */
5569
- interval?: "weekly" | "monthly" | "quarterly" | "yearly";
5785
+ interval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
5570
5786
  /**
5571
5787
  * The description on the plan.
5572
5788
  * @example "Plan for early stage startups."
@@ -5593,7 +5809,7 @@ export interface PlanCreateInput {
5593
5809
  */
5594
5810
  pay_in_advance?: boolean;
5595
5811
  /**
5596
- * This field, when set to `true`, enables to invoice usage-based charges on monthly basis, even if the cadence of the plan is yearly. This allows customers to pay charges overage on a monthly basis. This can be set to true only if the plan's interval is `yearly`.
5812
+ * This field, when set to `true`, enables to invoice usage-based charges on monthly basis, even if the cadence of the plan is `yearly` or `semiannual`. This allows customers to pay charges overage on a monthly basis. This can be set to true only if the plan's interval is `yearly` or `semiannual`.
5597
5813
  * @example null
5598
5814
  */
5599
5815
  bill_charges_monthly?: boolean | null;
@@ -5708,10 +5924,10 @@ export interface PlanUpdateInput {
5708
5924
  */
5709
5925
  code?: string;
5710
5926
  /**
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`.
5927
+ * The interval used for recurring billing. It represents the frequency at which subscription billing occurs. The interval can be one of the following values: `yearly`, `semiannual`, `quarterly`, `monthly`, or `weekly`.
5712
5928
  * @example "monthly"
5713
5929
  */
5714
- interval?: "weekly" | "monthly" | "quarterly" | "yearly";
5930
+ interval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
5715
5931
  /**
5716
5932
  * The description on the plan.
5717
5933
  * @example "Plan for early stage startups."
@@ -5738,7 +5954,7 @@ export interface PlanUpdateInput {
5738
5954
  */
5739
5955
  pay_in_advance?: boolean;
5740
5956
  /**
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`.
5957
+ * This field, when set to `true`, enables to invoice usage-based charges on monthly basis, even if the cadence of the plan is yearly or semiannual. This allows customers to pay charges overage on a monthly basis. This can be set to true only if the plan's interval is `yearly` or `semiannual`.
5742
5958
  * @example null
5743
5959
  */
5744
5960
  bill_charges_monthly?: boolean | null;
@@ -5848,10 +6064,6 @@ export interface EntitlementUpdateInput {
5848
6064
  */
5849
6065
  entitlements: Record<string, Record<string, number | boolean | string>>;
5850
6066
  }
5851
- export interface SubscriptionsPaginated {
5852
- subscriptions: SubscriptionObject[];
5853
- meta: PaginationMeta;
5854
- }
5855
6067
  /** Based plan overrides. */
5856
6068
  export interface PlanOverridesObject {
5857
6069
  /**
@@ -6318,250 +6530,31 @@ export interface TaxBaseInput {
6318
6530
  */
6319
6531
  code?: string;
6320
6532
  /**
6321
- * The percentage rate of the tax
6322
- * @pattern ^[0-9]+.?[0-9]*$
6323
- * @example "20.0"
6324
- */
6325
- rate?: string;
6326
- /**
6327
- * Internal description of the taxe
6328
- * @example "French standard VAT"
6329
- */
6330
- description?: string | null;
6331
- /**
6332
- * This field is deprecated and will be removed in a future version. When set to true, it applies the tax to the organization's default billing entity. To apply or remove a tax from any billing entity (including the default one), please use the `PUT /billing_entities/:code` endpoint instead.
6333
- * @deprecated
6334
- * @example true
6335
- */
6336
- applied_to_organization?: boolean;
6337
- }
6338
- export interface TaxCreateInput {
6339
- tax: TaxBaseInput;
6340
- }
6341
- export interface Tax {
6342
- tax: TaxObject;
6343
- }
6344
- export interface TaxUpdateInput {
6345
- tax: TaxBaseInput;
6346
- }
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.
6533
+ * The percentage rate of the tax
6551
6534
  * @pattern ^[0-9]+.?[0-9]*$
6552
- * @example "8.0"
6535
+ * @example "20.0"
6553
6536
  */
6554
- credits_ongoing_balance: string;
6537
+ rate?: string;
6555
6538
  /**
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"
6539
+ * Internal description of the taxe
6540
+ * @example "French standard VAT"
6559
6541
  */
6560
- credits_ongoing_usage_balance: string;
6542
+ description?: string | null;
6543
+ /**
6544
+ * This field is deprecated and will be removed in a future version. When set to true, it applies the tax to the organization's default billing entity. To apply or remove a tax from any billing entity (including the default one), please use the `PUT /billing_entities/:code` endpoint instead.
6545
+ * @deprecated
6546
+ * @example true
6547
+ */
6548
+ applied_to_organization?: boolean;
6561
6549
  }
6562
- export interface WalletsPaginated {
6563
- wallets: WalletObject[];
6564
- meta: PaginationMeta;
6550
+ export interface TaxCreateInput {
6551
+ tax: TaxBaseInput;
6552
+ }
6553
+ export interface Tax {
6554
+ tax: TaxObject;
6555
+ }
6556
+ export interface TaxUpdateInput {
6557
+ tax: TaxBaseInput;
6565
6558
  }
6566
6559
  export interface WalletCreateInput {
6567
6560
  wallet?: {
@@ -6614,6 +6607,11 @@ export interface WalletCreateInput {
6614
6607
  * @example [{"key":"example_key","value":"example_value"},{"key":"another_key","value":"another_value"}]
6615
6608
  */
6616
6609
  transaction_metadata?: any[] | null;
6610
+ /**
6611
+ * The name of the wallet transactions triggered when creating the wallet. It will appear on the invoice as the label for the fee. If not set, the label on the invoice will fallback to either `Prepaid credits - {{wallet_name}}` if the wallet name is set, or `Prepaid credits`.
6612
+ * @example "Tokens for models 'high-fidelity-boost'"
6613
+ */
6614
+ transaction_name?: string | null;
6617
6615
  /** Set wallet limitations to fee types. */
6618
6616
  applies_to?: {
6619
6617
  /**
@@ -6671,10 +6669,10 @@ export interface WalletUpdateInput {
6671
6669
  */
6672
6670
  method?: "fixed" | "target";
6673
6671
  /**
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`.
6672
+ * The interval used for recurring top-up. It represents the frequency at which automatic top-up occurs. The interval can be one of the following values: `weekly`, `monthly`, `quarterly`, `semiannual` or `yearly`. Required only when trigger is set to `interval`.
6675
6673
  * @example "monthly"
6676
6674
  */
6677
- interval?: "weekly" | "monthly" | "quarterly" | "yearly";
6675
+ interval?: "weekly" | "monthly" | "quarterly" | "semiannual" | "yearly";
6678
6676
  /**
6679
6677
  * The threshold for recurring top-ups is the value at which an automatic top-up is triggered. For example, if this threshold is set at 10 credits, an automatic top-up will occur whenever the wallet balance falls to or below 10 credits. Required only when trigger is set to `threshold`.
6680
6678
  * @pattern ^[0-9]+.?[0-9]*$
@@ -6726,6 +6724,11 @@ export interface WalletUpdateInput {
6726
6724
  /** The value associated with the key. */
6727
6725
  value?: string;
6728
6726
  }[];
6727
+ /**
6728
+ * The name of the wallet transactions triggered by this rule. It will appear on the invoice as the label for the fee. If not set, the label on the invoice will fallback to either `Prepaid credits - {{wallet_name}}` if the wallet name is set, or `Prepaid credits`.
6729
+ * @example "Tokens for models 'high-fidelity-boost'"
6730
+ */
6731
+ transaction_name?: string | null;
6729
6732
  }[];
6730
6733
  /** Set wallet limitations to fee types. */
6731
6734
  applies_to?: {
@@ -7803,7 +7806,8 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
7803
7806
  *
7804
7807
  * - Revenue from `monthly` subscription invoices is included in the MRR for the month in which the invoice is issued.
7805
7808
  * - Revenue from `quarterly` subscription invoices is distributed evenly over three months. This distribution applies to fees paid in advance (allocated to the next remaining months depending on calendar or anniversary billing) as well as to fees paid in arrears (allocated to the preceding months depending on calendar or anniversary billing).
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).
7809
+ * - Revenue from `yearly` subscription invoices is distributed evenly over twelve months. This allocation is applicable for fees paid in advance (spread over the next remaining months depending on calendar or anniversary billing) and for fees paid in arrears (spread over the previous months depending on calendar or anniversary billing).
7810
+ * - Revenue from `semiannual` subscription invoices is distributed evenly over six months. This allocation is applicable for fees paid in advance (spread over the next remaining months depending on calendar or anniversary billing) and for fees paid in arrears (spread over the previous months depending on calendar or anniversary billing).
7807
7811
  * - Revenue from `weekly` subscription invoices, the total revenue from all invoices issued within a month is summed up. This total is then divided by the number of invoices issued during that month, and the result is multiplied by 4.33, representing the average number of weeks in a month.
7808
7812
  */
7809
7813
  currency?: Currency;
@@ -8361,6 +8365,37 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
8361
8365
  * @secure
8362
8366
  */
8363
8367
  destroyCustomer: (externalCustomerId: string, params?: RequestParams) => Promise<HttpResponse<Customer, ApiErrorUnauthorized | ApiErrorNotFound>>;
8368
+ /**
8369
+ * @description This endpoint is used to list all applied coupons for a customer.
8370
+ *
8371
+ * @tags customers, coupons
8372
+ * @name FindAllCustomerAppliedCoupons
8373
+ * @summary List all customer's applied coupons
8374
+ * @request GET:/customers/{external_customer_id}/applied_coupons
8375
+ * @secure
8376
+ */
8377
+ findAllCustomerAppliedCoupons: (externalCustomerId: string, query?: {
8378
+ /**
8379
+ * Page number.
8380
+ * @example 1
8381
+ */
8382
+ page?: number;
8383
+ /**
8384
+ * Number of records per page.
8385
+ * @example 20
8386
+ */
8387
+ per_page?: number;
8388
+ /**
8389
+ * The status of the coupon. Can be either `active` or `terminated`.
8390
+ * @example "active"
8391
+ */
8392
+ status?: "active" | "terminated";
8393
+ /**
8394
+ * The code of the coupon applied to the customer. Use it to filter applied coupons by their code.
8395
+ * @example ["BLACK_FRIDAY_2024","CHRISTMAS_2024"]
8396
+ */
8397
+ "coupon_code[]"?: string[];
8398
+ }, params?: RequestParams) => Promise<HttpResponse<AppliedCouponsPaginated, ApiErrorUnauthorized | ApiErrorNotFound>>;
8364
8399
  /**
8365
8400
  * @description This endpoint is used to delete a specific coupon that has been applied to a customer.
8366
8401
  *
@@ -8371,6 +8406,197 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
8371
8406
  * @secure
8372
8407
  */
8373
8408
  deleteAppliedCoupon: (externalCustomerId: string, appliedCouponId: string, params?: RequestParams) => Promise<HttpResponse<AppliedCoupon, ApiErrorUnauthorized | ApiErrorNotFound>>;
8409
+ /**
8410
+ * @description This endpoint list all existing credit notes for a customer.
8411
+ *
8412
+ * @tags customers, credit_notes
8413
+ * @name FindAllCustomerCreditNotes
8414
+ * @summary List all customer's credit notes
8415
+ * @request GET:/customers/{external_customer_id}/credit_notes
8416
+ * @secure
8417
+ */
8418
+ findAllCustomerCreditNotes: (externalCustomerId: string, query?: {
8419
+ /**
8420
+ * Page number.
8421
+ * @example 1
8422
+ */
8423
+ page?: number;
8424
+ /**
8425
+ * Number of records per page.
8426
+ * @example 20
8427
+ */
8428
+ per_page?: number;
8429
+ /**
8430
+ * Filter credit notes starting from a specific date.
8431
+ * @format date
8432
+ * @example "2022-07-08"
8433
+ */
8434
+ issuing_date_from?: string;
8435
+ /**
8436
+ * Filter credit notes up to a specific date.
8437
+ * @format date
8438
+ * @example "2022-08-09"
8439
+ */
8440
+ issuing_date_to?: string;
8441
+ /**
8442
+ * Search credit notes by id, number, customer name, customer external_id or customer email.
8443
+ * @example "Jane"
8444
+ */
8445
+ search_term?: string;
8446
+ /** Filter credit notes by reasons. Possible values are `product_unsatisfactory`, `order_change`, `order_cancellation`, `fraudulent_charge`, `duplicated_charge` or `other`. */
8447
+ reason?: "product_unsatisfactory" | "order_change" | "order_cancellation" | "fraudulent_charge" | "duplicated_charge" | "other";
8448
+ /** Filter credit notes by credit status. Possible values are `available`, `consumed` or `voided`. */
8449
+ credit_status?: "available" | "consumed" | "voided";
8450
+ /** Filter credit notes by refund status. Possible values are `pending`, `succeeded` or `failed`. */
8451
+ refund_status?: "pending" | "succeeded" | "failed";
8452
+ /**
8453
+ * Filter credit notes by their related invoice number.
8454
+ * @example "INV-001-002"
8455
+ */
8456
+ invoice_number?: string;
8457
+ /**
8458
+ * Filter credit notes of at least a specific amount. This parameter must be defined in cents to ensure consistent handling for all currency types.
8459
+ * @example 9000
8460
+ */
8461
+ amount_from?: number;
8462
+ /**
8463
+ * Filter credit notes up to a specific amount. This parameter must be defined in cents to ensure consistent handling for all currency types.
8464
+ * @example 100000
8465
+ */
8466
+ amount_to?: number;
8467
+ /**
8468
+ * Filter credit notes belonging to a self billed invoice. Possible values are `true` or `false`.
8469
+ * @example true
8470
+ */
8471
+ self_billed?: boolean;
8472
+ }, params?: RequestParams) => Promise<HttpResponse<CreditNotesPaginated, ApiErrorUnauthorized | ApiErrorNotFound>>;
8473
+ /**
8474
+ * @description This endpoint is used for retrieving all invoices of a customer.
8475
+ *
8476
+ * @tags customers, invoices
8477
+ * @name FindAllCustomerInvoices
8478
+ * @summary List all customer's invoices
8479
+ * @request GET:/customers/{external_customer_id}/invoices
8480
+ * @secure
8481
+ */
8482
+ findAllCustomerInvoices: (externalCustomerId: string, query?: {
8483
+ /**
8484
+ * Page number.
8485
+ * @example 1
8486
+ */
8487
+ page?: number;
8488
+ /**
8489
+ * Number of records per page.
8490
+ * @example 20
8491
+ */
8492
+ per_page?: number;
8493
+ /**
8494
+ * Filter invoices of at least a specific amount. This parameter must be defined in cents to ensure consistent handling for all currency types.
8495
+ * @example 9000
8496
+ */
8497
+ amount_from?: number;
8498
+ /**
8499
+ * Filter invoices up to a specific amount. This parameter must be defined in cents to ensure consistent handling for all currency types.
8500
+ * @example 100000
8501
+ */
8502
+ amount_to?: number;
8503
+ /**
8504
+ * Filter invoices starting from a specific date.
8505
+ * @format date
8506
+ * @example "2022-07-08"
8507
+ */
8508
+ issuing_date_from?: string;
8509
+ /**
8510
+ * Filter invoices up to a specific date.
8511
+ * @format date
8512
+ * @example "2022-08-09"
8513
+ */
8514
+ issuing_date_to?: string;
8515
+ /** Filter invoices by status. Possible values are `draft` or `finalized`. */
8516
+ status?: "draft" | "finalized";
8517
+ /** Filter invoices by payment status. Possible values are `pending`, `failed` or `succeeded`. */
8518
+ payment_status?: "pending" | "failed" | "succeeded";
8519
+ /**
8520
+ * Filter invoices by payment_overdue. Possible values are `true` or `false`.
8521
+ * @example true
8522
+ */
8523
+ payment_overdue?: boolean;
8524
+ /**
8525
+ * Search invoices by id, number, customer name, customer external_id or customer email.
8526
+ * @example "Jane"
8527
+ */
8528
+ search_term?: string;
8529
+ /**
8530
+ * Filter invoices with a payment dispute lost. Possible values are `true` or `false`.
8531
+ * @example true
8532
+ */
8533
+ payment_dispute_lost?: boolean;
8534
+ /** Filter invoices by invoice type. Possible values are `subscription`, `add_on`, `credit`, `one_off`, `advance_charges` or `progressive_billing`. */
8535
+ invoice_type?: "subscription" | "add_on" | "credit" | "one_off" | "advance_charges" | "progressive_billing";
8536
+ /**
8537
+ * Filter invoices by self billed. Possible values are `true` or `false`.
8538
+ * @example true
8539
+ */
8540
+ self_billed?: boolean;
8541
+ /**
8542
+ * Filter invoices by metadata. Replace `key` with the actual metadata key you want to match, and provide the corresponding value. Providing empty value will search for invoice without given metadata key. For example, `metadata[color]=blue`.
8543
+ * @example "someValue"
8544
+ */
8545
+ "metadata[key]"?: string;
8546
+ }, params?: RequestParams) => Promise<HttpResponse<InvoicesPaginated, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
8547
+ /**
8548
+ * @description This endpoint is used to list all payments of a customer
8549
+ *
8550
+ * @tags customers, payments
8551
+ * @name FindAllCustomerPayments
8552
+ * @summary List all customer's payments
8553
+ * @request GET:/customers/{external_customer_id}/payments
8554
+ * @secure
8555
+ */
8556
+ findAllCustomerPayments: (externalCustomerId: string, query?: {
8557
+ /**
8558
+ * Page number.
8559
+ * @example 1
8560
+ */
8561
+ page?: number;
8562
+ /**
8563
+ * Number of records per page.
8564
+ * @example 20
8565
+ */
8566
+ per_page?: number;
8567
+ /**
8568
+ * Unique identifier assigned to the invoice within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the invoice's record within the Lago system.
8569
+ * @format uuid
8570
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
8571
+ */
8572
+ invoice_id?: string;
8573
+ }, params?: RequestParams) => Promise<HttpResponse<PaymentsPaginated, ApiErrorUnauthorized | ApiErrorNotFound>>;
8574
+ /**
8575
+ * @description This endpoint is used to list all existing payment requests of a customer.
8576
+ *
8577
+ * @tags customers, payment_requests
8578
+ * @name FindAllCustomerPaymentRequests
8579
+ * @summary List all customer's payment requests
8580
+ * @request GET:/customers/{external_customer_id}/payment_requests
8581
+ * @secure
8582
+ */
8583
+ findAllCustomerPaymentRequests: (externalCustomerId: string, query?: {
8584
+ /**
8585
+ * Page number.
8586
+ * @example 1
8587
+ */
8588
+ page?: number;
8589
+ /**
8590
+ * Number of records per page.
8591
+ * @example 20
8592
+ */
8593
+ per_page?: number;
8594
+ /**
8595
+ * Filter by payment status. Possible values are `pending`, `failed` or `succeeded`.
8596
+ * @example "pending"
8597
+ */
8598
+ payment_status?: "pending" | "failed" | "succeeded";
8599
+ }, params?: RequestParams) => Promise<HttpResponse<PaymentRequestsPaginated, ApiErrorUnauthorized | ApiErrorNotFound>>;
8374
8600
  /**
8375
8601
  * @description Retrieves an embeddable link for displaying a customer portal. This endpoint allows you to fetch the URL that can be embedded to provide customers access to a dedicated portal
8376
8602
  *
@@ -8389,6 +8615,58 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
8389
8615
  portal_url: string;
8390
8616
  };
8391
8617
  }, ApiErrorUnauthorized | ApiErrorNotFound>>;
8618
+ /**
8619
+ * @description This endpoint retrieves all active subscriptions for a customer.
8620
+ *
8621
+ * @tags customers, subscriptions
8622
+ * @name FindAllCustomerSubscriptions
8623
+ * @summary List all customer's subscriptions
8624
+ * @request GET:/customers/{external_customer_id}/subscriptions
8625
+ * @secure
8626
+ */
8627
+ findAllCustomerSubscriptions: (externalCustomerId: string, query?: {
8628
+ /**
8629
+ * Page number.
8630
+ * @example 1
8631
+ */
8632
+ page?: number;
8633
+ /**
8634
+ * Number of records per page.
8635
+ * @example 20
8636
+ */
8637
+ per_page?: number;
8638
+ /**
8639
+ * The unique code representing the plan to be attached to the customer. This code must correspond to the code property of one of the active plans.
8640
+ * @example "premium"
8641
+ */
8642
+ plan_code?: string;
8643
+ /**
8644
+ * If the field is not defined, Lago will return only `active` subscriptions. However, if you wish to fetch subscriptions by different status you can define them in a status[] query param. Available filter values: `pending`, `canceled`, `terminated`, `active`.
8645
+ * @example ["active","pending"]
8646
+ */
8647
+ "status[]"?: ("pending" | "canceled" | "terminated" | "active")[];
8648
+ }, params?: RequestParams) => Promise<HttpResponse<SubscriptionsPaginated, ApiErrorUnauthorized | ApiErrorNotFound>>;
8649
+ /**
8650
+ * @description This endpoint is used to list all wallets with prepaid credits of a customer
8651
+ *
8652
+ * @tags customers, wallets
8653
+ * @name FindAllCustomerWallets
8654
+ * @summary List all customer's wallets
8655
+ * @request GET:/customers/{external_customer_id}/wallets
8656
+ * @secure
8657
+ */
8658
+ findAllCustomerWallets: (externalCustomerId: string, query?: {
8659
+ /**
8660
+ * Page number.
8661
+ * @example 1
8662
+ */
8663
+ page?: number;
8664
+ /**
8665
+ * Number of records per page.
8666
+ * @example 20
8667
+ */
8668
+ per_page?: number;
8669
+ }, params?: RequestParams) => Promise<HttpResponse<WalletsPaginated, ApiErrorUnauthorized | ApiErrorForbidden | ApiErrorNotFound>>;
8392
8670
  /**
8393
8671
  * @description This endpoint enables the retrieval of the usage-based billing data for a customer within the current period.
8394
8672
  *
@@ -9084,7 +9362,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
9084
9362
  * @request GET:/payments/{lago_id}
9085
9363
  * @secure
9086
9364
  */
9087
- findPayment: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<PaymentManualObject, ApiErrorUnauthorized | ApiErrorNotFound>>;
9365
+ findPayment: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<PaymentObject, ApiErrorUnauthorized | ApiErrorNotFound>>;
9088
9366
  };
9089
9367
  plans: {
9090
9368
  /**