lago-javascript-client 1.9.0 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -297,6 +297,19 @@ export interface AppliedCouponsPaginated {
297
297
  applied_coupons: AppliedCouponObjectExtended[];
298
298
  meta: PaginationMeta;
299
299
  }
300
+ export interface AppliedUsageThresholdObject {
301
+ /**
302
+ * The amount of usage in cents that has been accumulated over the lifetime of the subscription.
303
+ * @example 2000
304
+ */
305
+ lifetime_usage_amount_cents: number;
306
+ /**
307
+ * The date and time when the lifetime usage was computed. It is expressed in UTC format according to the ISO 8601 datetime standard.
308
+ * @format date-time
309
+ */
310
+ created_at: string;
311
+ usage_threshold: UsageThresholdObject;
312
+ }
300
313
  export interface BaseAppliedTax {
301
314
  /**
302
315
  * Unique identifier of the applied tax, created by Lago.
@@ -1090,17 +1103,17 @@ export interface CreditObject {
1090
1103
  */
1091
1104
  lago_item_id: string;
1092
1105
  /**
1093
- * The type of credit applied. Possible values are `coupon` or `credit_note`.
1106
+ * The type of credit applied. Possible values are `coupon`, `credit_note` or `invoice` (for `progressive_billing` invoice).
1094
1107
  * @example "coupon"
1095
1108
  */
1096
- type: "coupon" | "credit_note";
1109
+ type: "coupon" | "credit_note" | "invoice";
1097
1110
  /**
1098
- * The code of the credit applied. It can be the code of the coupon attached to the credit or the credit note's number.
1111
+ * The code of the credit applied. It can be the code of the coupon attached to the credit, the credit note's number or the `progressive_billing` invoice number.
1099
1112
  * @example "startup_deal"
1100
1113
  */
1101
1114
  code: string;
1102
1115
  /**
1103
- * The name of the credit applied. It can be the name of the coupon attached to the credit or the initial invoice's number linked to the credit note.
1116
+ * The name of the credit applied. It can be the name of the coupon attached to the credit, the initial invoice's number linked to the credit note or the `progressive_billing` invoice number.
1104
1117
  * @example "Startup Deal"
1105
1118
  */
1106
1119
  name: string;
@@ -1409,7 +1422,7 @@ export interface CustomerBillingConfiguration {
1409
1422
  */
1410
1423
  document_locale?: string;
1411
1424
  /**
1412
- * Specifies the available payment methods that can be used for this customer when `payment_provider` is set to `stripe`. The `provider_payment_methods` field is an array that allows multiple payment options to be defined. If this field is not explicitly set, the payment methods will be set to `[card]`. For now, possible values are `card`, `sepa_debit`, `us_bank_account`, `bacs_debit` and `link`. Note that when `link` is selected, `card` should also be provided in the array.
1425
+ * Specifies the available payment methods that can be used for this customer when `payment_provider` is set to `stripe`. The `provider_payment_methods` field is an array that allows multiple payment options to be defined. If this field is not explicitly set, the payment methods will be set to `card`. For now, possible values are `card`, `sepa_debit`, `us_bank_account`, `bacs_debit` and `link`. Note that when `link` is selected, `card` should also be provided in the array.
1413
1426
  * @example ["card","sepa_debit"]
1414
1427
  */
1415
1428
  provider_payment_methods?: string[] | null;
@@ -1424,10 +1437,10 @@ export interface IntegrationCustomer {
1424
1437
  lago_id?: string;
1425
1438
  /**
1426
1439
  * The integration type used for accounting and tax syncs.
1427
- * Accepted values: `netsuite`.
1440
+ * Accepted values: `netsuite, anrok`.
1428
1441
  * @example "netsuite"
1429
1442
  */
1430
- type?: "netsuite";
1443
+ type?: "netsuite" | "anrok";
1431
1444
  /**
1432
1445
  * Unique code used to identify an integration connection.
1433
1446
  * @example "netsuite-eu-1"
@@ -1657,6 +1670,14 @@ export interface CustomerCreateInput {
1657
1670
  * @example 30
1658
1671
  */
1659
1672
  net_payment_term?: number | null;
1673
+ /**
1674
+ * Specifies how invoices with a zero total amount should be handled:
1675
+ * - `inherit`: (Default) Follows the organization-level configuration.
1676
+ * - `finalize`: Invoices are issued and finalized even if the total amount is zero.
1677
+ * - `skip`: Invoices with a total amount of zero are not finalized.
1678
+ * @example "inherit"
1679
+ */
1680
+ finalize_zero_amount_invoice?: "inherit" | "skip" | "finalize";
1660
1681
  /** Configuration specific to the payment provider, utilized for billing the customer. This object contains settings and parameters necessary for processing payments and invoicing the customer. */
1661
1682
  billing_configuration?: CustomerBillingConfiguration;
1662
1683
  /** Configuration specific to the payment provider, utilized for billing the customer. This object contains settings and parameters necessary for processing payments and invoicing the customer. */
@@ -1670,10 +1691,10 @@ export interface CustomerCreateInput {
1670
1691
  id?: string;
1671
1692
  /**
1672
1693
  * The integration type used for accounting and tax syncs.
1673
- * Accepted values: `netsuite`.
1694
+ * Accepted values: `netsuite, anrok, xero`.
1674
1695
  * @example "netsuite"
1675
1696
  */
1676
- integration_type?: "netsuite";
1697
+ integration_type?: "netsuite" | "anrok" | "xero";
1677
1698
  /**
1678
1699
  * Unique code used to identify an integration connection.
1679
1700
  * @example "netsuite-eu-1"
@@ -1751,7 +1772,7 @@ export interface CustomerMetadata {
1751
1772
  */
1752
1773
  created_at: string;
1753
1774
  }
1754
- export interface CustomerObject {
1775
+ export type CustomerObject = {
1755
1776
  /**
1756
1777
  * 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
1757
1778
  * @format uuid
@@ -1864,13 +1885,22 @@ export interface CustomerObject {
1864
1885
  * @example "2022-04-29T08:59:51Z"
1865
1886
  */
1866
1887
  updated_at?: string;
1888
+ /**
1889
+ * Specifies how invoices with a zero total amount should be handled:
1890
+ * - `inherit`: (Default) Follows the organization-level configuration.
1891
+ * - `finalize`: Invoices are issued and finalized even if the total amount is zero.
1892
+ * - `skip`: Invoices with a total amount of zero are not finalized.
1893
+ * @example "inherit"
1894
+ */
1895
+ finalize_zero_amount_invoice?: "inherit" | "skip" | "finalize";
1867
1896
  /** Configuration specific to the payment provider, utilized for billing the customer. This object contains settings and parameters necessary for processing payments and invoicing the customer. */
1868
1897
  billing_configuration?: CustomerBillingConfiguration;
1869
1898
  /** Configuration specific to the payment provider, utilized for billing the customer. This object contains settings and parameters necessary for processing payments and invoicing the customer. */
1870
1899
  shipping_address?: Address;
1871
- integration_customers?: IntegrationCustomer[];
1872
1900
  metadata?: CustomerMetadata[];
1873
- }
1901
+ } & {
1902
+ integration_customers?: IntegrationCustomer[];
1903
+ };
1874
1904
  export type CustomerObjectExtended = CustomerObject & {
1875
1905
  metadata?: CustomerMetadata[];
1876
1906
  /** List of customer taxes */
@@ -2115,6 +2145,16 @@ export interface FeeObject {
2115
2145
  * @example 100
2116
2146
  */
2117
2147
  amount_cents: number;
2148
+ /**
2149
+ * The cost of this specific fee, excluding any applicable taxes, with precision.
2150
+ * @example "1.0001"
2151
+ */
2152
+ precise_amount?: string;
2153
+ /**
2154
+ * The cost of this specific fee, including any applicable taxes, with precision.
2155
+ * @example "1.0212"
2156
+ */
2157
+ precise_total_amount?: string;
2118
2158
  /** The currency of this specific fee. It indicates the monetary unit in which the fee's cost is expressed. */
2119
2159
  amount_currency: Currency;
2120
2160
  /**
@@ -2122,6 +2162,11 @@ export interface FeeObject {
2122
2162
  * @example 20
2123
2163
  */
2124
2164
  taxes_amount_cents: number;
2165
+ /**
2166
+ * The cost of the tax associated with this specific fee, with precision.
2167
+ * @example "0.20123"
2168
+ */
2169
+ taxes_precise_amount?: string;
2125
2170
  /**
2126
2171
  * The tax rate associated with this specific fee.
2127
2172
  * @example 20
@@ -2626,7 +2671,7 @@ export interface InvoiceMetadataObject {
2626
2671
  */
2627
2672
  created_at?: string;
2628
2673
  }
2629
- export interface InvoiceObject {
2674
+ export type InvoiceObject = {
2630
2675
  /**
2631
2676
  * 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.
2632
2677
  * @format uuid
@@ -2672,18 +2717,19 @@ export interface InvoiceObject {
2672
2717
  */
2673
2718
  net_payment_term?: number;
2674
2719
  /**
2675
- * The type of invoice issued. Possible values are `subscription`, `one-off` or `credit`.
2720
+ * The type of invoice issued. Possible values are `subscription`, `one-off`, `credit` or `progressive_billing`.
2676
2721
  * @example "subscription"
2677
2722
  */
2678
- invoice_type: "subscription" | "add_on" | "credit" | "one_off";
2723
+ invoice_type: "subscription" | "add_on" | "credit" | "one_off" | "progressive_billing";
2679
2724
  /**
2680
2725
  * The status of the invoice. It indicates the current state of the invoice and can have two possible values:
2681
2726
  * - `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.
2682
2727
  * - `finalized`: the invoice has been issued and finalized. In this state, events cannot be ingested or added to the invoice anymore.
2683
2728
  * - `voided`: the invoice has been issued and subsequently voided. In this state, events cannot be ingested or added to the invoice anymore.
2729
+ * - `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.
2684
2730
  * @example "finalized"
2685
2731
  */
2686
- status: "draft" | "finalized" | "voided";
2732
+ status: "draft" | "finalized" | "voided" | "failed";
2687
2733
  /**
2688
2734
  * The status of the payment associated with the invoice. It can have one of the following values:
2689
2735
  * - `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.
@@ -2714,7 +2760,7 @@ export interface InvoiceObject {
2714
2760
  * This field depends on the version number. Here are the definitions based on the version:
2715
2761
  * - Version 1: is equal to the sum of `fees_amount_cents`, minus `coupons_amount_cents`, and minus `prepaid_credit_amount_cents`.
2716
2762
  * - Version 2: is equal to the `fees_amount_cents`.
2717
- * - Version 3: is equal to the `fees_amount_cents`, minus `coupons_amount_cents`
2763
+ * - Version 3 & 4: is equal to the `fees_amount_cents`, minus `coupons_amount_cents`
2718
2764
  * @example 100
2719
2765
  */
2720
2766
  sub_total_excluding_taxes_amount_cents: number;
@@ -2728,7 +2774,7 @@ export interface InvoiceObject {
2728
2774
  * This field depends on the version number. Here are the definitions based on the version:
2729
2775
  * - Version 1: is equal to the `total_amount_cents`.
2730
2776
  * - Version 2: is equal to the sum of `fees_amount_cents` and `taxes_amount_cents`.
2731
- * - Version 3: is equal to the sum `sub_total_excluding_taxes_amount_cents` and `taxes_amount_cents`
2777
+ * - Version 3 & 4: is equal to the sum `sub_total_excluding_taxes_amount_cents` and `taxes_amount_cents`
2732
2778
  * @example 120
2733
2779
  */
2734
2780
  sub_total_including_taxes_amount_cents: number;
@@ -2737,6 +2783,11 @@ export interface InvoiceObject {
2737
2783
  * @example 0
2738
2784
  */
2739
2785
  prepaid_credit_amount_cents: number;
2786
+ /**
2787
+ * The usage already billed in previous invoices. Only apply to `progressive_billing` and `subscription` invoices.
2788
+ * @example 0
2789
+ */
2790
+ progressive_billing_credit_amount_cents: number;
2740
2791
  /**
2741
2792
  * 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.
2742
2793
  * @example 100
@@ -2750,15 +2801,35 @@ export interface InvoiceObject {
2750
2801
  * @example "https://getlago.com/invoice/file"
2751
2802
  */
2752
2803
  file_url?: string;
2804
+ } & {
2753
2805
  /** The customer on which the invoice applies. It refers to the customer account or entity associated with the invoice. */
2754
2806
  customer?: CustomerObject;
2755
2807
  metadata?: InvoiceMetadataObject[];
2756
2808
  applied_taxes?: InvoiceAppliedTaxObject[];
2757
- }
2809
+ applied_usage_thresholds?: AppliedUsageThresholdObject[] | null;
2810
+ };
2758
2811
  export type InvoiceObjectExtended = InvoiceObject & {
2759
2812
  credits?: CreditObject[];
2760
2813
  fees?: FeeObject[];
2761
2814
  subscriptions?: SubscriptionObject[];
2815
+ error_details?: {
2816
+ /**
2817
+ * Unique identifier assigned to the error_detail within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the error's record within the Lago system.
2818
+ * @format uuid
2819
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2820
+ */
2821
+ lago_id: string | null;
2822
+ /**
2823
+ * Code that specifies part of the application / connection, where the error originally happened
2824
+ * @example "tax_error"
2825
+ */
2826
+ error_code: string;
2827
+ /**
2828
+ * Key value list of more elaborated error detail, where by the key of error_code an external service error details are stored
2829
+ * @example {"tax_error":"taxDateTooFarInFuture"}
2830
+ */
2831
+ details: object;
2832
+ }[];
2762
2833
  };
2763
2834
  export interface InvoiceOneOffCreateInput {
2764
2835
  invoice: {
@@ -2960,6 +3031,11 @@ export interface OrganizationObject {
2960
3031
  billing_configuration: OrganizationBillingConfiguration;
2961
3032
  /** List of default organization taxes */
2962
3033
  taxes?: TaxObject[];
3034
+ /**
3035
+ * Indicates whether invoices with a zero total amount should be finalized. If set to true, zero amount invoices will be finalized. If set to false, zero amount invoices will not be finalized.
3036
+ * @example false
3037
+ */
3038
+ finalize_zero_amount_invoice?: boolean;
2963
3039
  }
2964
3040
  export interface OrganizationUpdateInput {
2965
3041
  organization: {
@@ -3047,6 +3123,11 @@ export interface OrganizationUpdateInput {
3047
3123
  email_settings?: ("invoice.finalized" | "credit_note.created")[];
3048
3124
  /** The custom billing settings for your organization. */
3049
3125
  billing_configuration?: OrganizationBillingConfiguration;
3126
+ /**
3127
+ * Determines whether invoices with a zero total amount should be finalized. If set to true, zero amount invoices will be finalized. If set to false, zero amount invoices will not be finalized.
3128
+ * @example false
3129
+ */
3130
+ finalize_zero_amount_invoice?: boolean;
3050
3131
  };
3051
3132
  }
3052
3133
  export interface OverdueBalanceObject {
@@ -3221,6 +3302,8 @@ export interface PlanCreateInput {
3221
3302
  */
3222
3303
  tax_codes?: string[];
3223
3304
  }[];
3305
+ /** List of usage thresholds to apply to the plan. */
3306
+ usage_thresholds?: UsageThresholdInput[];
3224
3307
  };
3225
3308
  }
3226
3309
  /** Based plan overrides. */
@@ -3292,6 +3375,8 @@ export interface PlanOverridesObject {
3292
3375
  */
3293
3376
  tax_codes?: string[];
3294
3377
  }[];
3378
+ /** List of usage thresholds applied to the subscription. */
3379
+ usage_thresholds?: UsageThresholdObject[];
3295
3380
  }
3296
3381
  export interface PlanUpdateInput {
3297
3382
  plan: {
@@ -3419,6 +3504,8 @@ export interface PlanUpdateInput {
3419
3504
  */
3420
3505
  tax_codes?: string[];
3421
3506
  }[];
3507
+ /** List of usage thresholds to apply to the plan. */
3508
+ usage_thresholds?: UsageThresholdInput[];
3422
3509
  };
3423
3510
  }
3424
3511
  export interface PlanObject {
@@ -3499,6 +3586,8 @@ export interface PlanObject {
3499
3586
  charges?: ChargeObject[];
3500
3587
  /** All taxes applied to the plan. */
3501
3588
  taxes?: TaxObject[];
3589
+ /** List of usage thresholds applied to the plan. */
3590
+ usage_thresholds?: UsageThresholdObject[];
3502
3591
  }
3503
3592
  export interface PlansPaginated {
3504
3593
  plans: PlanObject[];
@@ -3793,6 +3882,64 @@ export interface TaxUpdateInput {
3793
3882
  }
3794
3883
  /** @example "America/Los_Angeles" */
3795
3884
  export type Timezone = "UTC" | "Africa/Algiers" | "Africa/Cairo" | "Africa/Casablanca" | "Africa/Harare" | "Africa/Johannesburg" | "Africa/Monrovia" | "Africa/Nairobi" | "America/Argentina/Buenos_Aires" | "America/Bogota" | "America/Caracas" | "America/Chicago" | "America/Chihuahua" | "America/Denver" | "America/Godthab" | "America/Guatemala" | "America/Guyana" | "America/Halifax" | "America/Indiana/Indianapolis" | "America/Juneau" | "America/La_Paz" | "America/Lima" | "America/Los_Angeles" | "America/Mazatlan" | "America/Mexico_City" | "America/Monterrey" | "America/Montevideo" | "America/New_York" | "America/Phoenix" | "America/Puerto_Rico" | "America/Regina" | "America/Santiago" | "America/Sao_Paulo" | "America/St_Johns" | "America/Tijuana" | "Asia/Almaty" | "Asia/Baghdad" | "Asia/Baku" | "Asia/Bangkok" | "Asia/Chongqing" | "Asia/Colombo" | "Asia/Dhaka" | "Asia/Hong_Kong" | "Asia/Irkutsk" | "Asia/Jakarta" | "Asia/Jerusalem" | "Asia/Kabul" | "Asia/Kamchatka" | "Asia/Karachi" | "Asia/Kathmandu" | "Asia/Kolkata" | "Asia/Krasnoyarsk" | "Asia/Kuala_Lumpur" | "Asia/Kuwait" | "Asia/Magadan" | "Asia/Muscat" | "Asia/Novosibirsk" | "Asia/Rangoon" | "Asia/Riyadh" | "Asia/Seoul" | "Asia/Shanghai" | "Asia/Singapore" | "Asia/Srednekolymsk" | "Asia/Taipei" | "Asia/Tashkent" | "Asia/Tbilisi" | "Asia/Tehran" | "Asia/Tokyo" | "Asia/Ulaanbaatar" | "Asia/Urumqi" | "Asia/Vladivostok" | "Asia/Yakutsk" | "Asia/Yekaterinburg" | "Asia/Yerevan" | "Atlantic/Azores" | "Atlantic/Cape_Verde" | "Atlantic/South_Georgia" | "Australia/Adelaide" | "Australia/Brisbane" | "Australia/Darwin" | "Australia/Hobart" | "Australia/Melbourne" | "Australia/Perth" | "Australia/Sydney" | "Europe/Amsterdam" | "Europe/Athens" | "Europe/Belgrade" | "Europe/Berlin" | "Europe/Bratislava" | "Europe/Brussels" | "Europe/Bucharest" | "Europe/Budapest" | "Europe/Copenhagen" | "Europe/Dublin" | "Europe/Helsinki" | "Europe/Istanbul" | "Europe/Kaliningrad" | "Europe/Kiev" | "Europe/Lisbon" | "Europe/Ljubljana" | "Europe/London" | "Europe/Madrid" | "Europe/Minsk" | "Europe/Moscow" | "Europe/Paris" | "Europe/Prague" | "Europe/Riga" | "Europe/Rome" | "Europe/Samara" | "Europe/Sarajevo" | "Europe/Skopje" | "Europe/Sofia" | "Europe/Stockholm" | "Europe/Tallinn" | "Europe/Vienna" | "Europe/Vilnius" | "Europe/Volgograd" | "Europe/Warsaw" | "Europe/Zagreb" | "Europe/Zurich" | "GMT+12" | "Pacific/Apia" | "Pacific/Auckland" | "Pacific/Chatham" | "Pacific/Fakaofo" | "Pacific/Fiji" | "Pacific/Guadalcanal" | "Pacific/Guam" | "Pacific/Honolulu" | "Pacific/Majuro" | "Pacific/Midway" | "Pacific/Noumea" | "Pacific/Pago_Pago" | "Pacific/Port_Moresby" | "Pacific/Tongatapu";
3885
+ export interface UsageThresholdInput {
3886
+ /**
3887
+ * Unique identifier of the usage threshold created by Lago.
3888
+ * @format uuid
3889
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3890
+ */
3891
+ id?: string | null;
3892
+ /**
3893
+ * The display name of the usage threshold.
3894
+ * @example "Threshold 1"
3895
+ */
3896
+ threshold_display_name?: string | null;
3897
+ /**
3898
+ * The amount to reach to trigger a `progressive_billing` invoice.
3899
+ * @example 10000
3900
+ */
3901
+ amount_cents: number;
3902
+ /**
3903
+ * 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.
3904
+ * @example true
3905
+ */
3906
+ recurring: boolean;
3907
+ }
3908
+ export interface UsageThresholdObject {
3909
+ /**
3910
+ * Unique identifier of the usage threshold created by Lago.
3911
+ * @format uuid
3912
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3913
+ */
3914
+ lago_id: string;
3915
+ /**
3916
+ * The display name of the usage threshold.
3917
+ * @example "Threshold 1"
3918
+ */
3919
+ threshold_display_name?: string | null;
3920
+ /**
3921
+ * The amount to reach to trigger a `progressive_billing` invoice.
3922
+ * @example 10000
3923
+ */
3924
+ amount_cents: number;
3925
+ /**
3926
+ * 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.
3927
+ * @example true
3928
+ */
3929
+ recurring: boolean;
3930
+ /**
3931
+ * The date and time when the usage threshold was created. It is expressed in UTC format according to the ISO 8601 datetime standard.
3932
+ * @format date-time
3933
+ * @example "2023-06-27T19:43:42Z"
3934
+ */
3935
+ created_at: string;
3936
+ /**
3937
+ * The date and time when the usage threshold was last updated. It is expressed in UTC format according to the ISO 8601 datetime standard.
3938
+ * @format date-time
3939
+ * @example "2023-06-27T19:43:42Z"
3940
+ */
3941
+ updated_at: string;
3942
+ }
3796
3943
  export interface Wallet {
3797
3944
  wallet: WalletObject;
3798
3945
  }
@@ -4440,7 +4587,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
4440
4587
  }
4441
4588
  /**
4442
4589
  * @title Lago API documentation
4443
- * @version 1.9.0
4590
+ * @version 1.11.0
4444
4591
  * @license AGPLv3
4445
4592
  * @baseUrl https://{region}.getlago.com/api/v1
4446
4593
  * @externalDocs https://github.com/getlago
@@ -5349,6 +5496,16 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
5349
5496
  * @secure
5350
5497
  */
5351
5498
  refreshInvoice: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiErrorUnauthorized | ApiErrorNotFound>>;
5499
+ /**
5500
+ * @description This endpoint is used for retrying to generate a failed invoice.
5501
+ *
5502
+ * @tags invoices
5503
+ * @name RetryInvoice
5504
+ * @summary Retry generation of a failed invoice
5505
+ * @request POST:/invoices/{lago_id}/retry
5506
+ * @secure
5507
+ */
5508
+ retryInvoice: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiErrorUnauthorized | ApiErrorNotFound>>;
5352
5509
  /**
5353
5510
  * @description This endpoint generates a checkout link for a specific invoice.
5354
5511
  *
@@ -5420,6 +5577,102 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
5420
5577
  */
5421
5578
  updateOrganization: (data: OrganizationUpdateInput, params?: RequestParams) => Promise<HttpResponse<Organization, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
5422
5579
  };
5580
+ paymentRequests: {
5581
+ /**
5582
+ * @description This endpoint is used to create a payment request to collect payments of overdue invoices of a given customer
5583
+ *
5584
+ * @tags payment_requests
5585
+ * @name CreatePaymentRequest
5586
+ * @summary Create a payment request
5587
+ * @request POST:/payment_requests
5588
+ * @secure
5589
+ */
5590
+ createPaymentRequest: (data: {
5591
+ payment_request: {
5592
+ /**
5593
+ * The customer external unique identifier (provided by your own application)
5594
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
5595
+ */
5596
+ customer_external_id?: string;
5597
+ /**
5598
+ * The customer's email address used for sending dunning notifications
5599
+ * @format email
5600
+ * @example "dinesh@piedpiper.test"
5601
+ */
5602
+ email: string;
5603
+ /** A list of Lago IDs for the customer's overdue invoices to start the dunning process */
5604
+ lago_invoice_ids: string[];
5605
+ };
5606
+ }, params?: RequestParams) => Promise<HttpResponse<{
5607
+ payment_request: {
5608
+ /**
5609
+ * Unique identifier of the payment request, created by Lago.
5610
+ * @format uuid
5611
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
5612
+ */
5613
+ lago_id: string;
5614
+ /**
5615
+ * The customer's email address used for sending dunning notifications
5616
+ * @format email
5617
+ * @example "dinesh@piedpiper.test"
5618
+ */
5619
+ email: string;
5620
+ /**
5621
+ * The sum of the total amounts of all the invoices included in the payment request, expressed in cents.
5622
+ * @example 100
5623
+ */
5624
+ amount_cents: number;
5625
+ /** The currency of the payment request. */
5626
+ amount_currency: Currency;
5627
+ /**
5628
+ * The status of the payment associated with the payment request. It can have one of the following values:
5629
+ * - `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.
5630
+ * - `succeeded`: the payment of the payment request has been successfully processed.
5631
+ * - `failed`: the payment of the payment request has failed or encountered an error during processing.
5632
+ * @example "succeeded"
5633
+ */
5634
+ payment_status: "pending" | "succeeded" | "failed";
5635
+ /**
5636
+ * 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.
5637
+ * @format date-time
5638
+ * @example "2022-04-29T08:59:51Z"
5639
+ */
5640
+ created_at: string;
5641
+ /** The customer on which the payment request applies. It refers to the customer account or entity associated with the payment request. */
5642
+ customer: any;
5643
+ invoices: any[];
5644
+ };
5645
+ }, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
5646
+ /**
5647
+ * @description This endpoint is used to list all existing payment requests.
5648
+ *
5649
+ * @tags payment_requests
5650
+ * @name FindAllPaymentRequests
5651
+ * @summary List all payment requests
5652
+ * @request GET:/payment_requests
5653
+ * @secure
5654
+ */
5655
+ findAllPaymentRequests: (query?: {
5656
+ /**
5657
+ * Page number.
5658
+ * @example 1
5659
+ */
5660
+ page?: number;
5661
+ /**
5662
+ * Number of records per page.
5663
+ * @example 20
5664
+ */
5665
+ per_page?: number;
5666
+ /**
5667
+ * Unique identifier assigned to the customer in your application.
5668
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
5669
+ */
5670
+ external_customer_id?: string;
5671
+ }, params?: RequestParams) => Promise<HttpResponse<{
5672
+ payment_requests: any[];
5673
+ meta: PaginationMeta;
5674
+ }, ApiErrorUnauthorized>>;
5675
+ };
5423
5676
  plans: {
5424
5677
  /**
5425
5678
  * @description This endpoint creates a plan with subscription and usage-based charges. It supports flexible billing cadence (in-advance or in-arrears) and allows for both recurring and metered charges.
@@ -148,7 +148,7 @@ export class HttpClient {
148
148
  }
149
149
  /**
150
150
  * @title Lago API documentation
151
- * @version 1.9.0
151
+ * @version 1.11.0
152
152
  * @license AGPLv3
153
153
  * @baseUrl https://{region}.getlago.com/api/v1
154
154
  * @externalDocs https://github.com/getlago
@@ -1088,6 +1088,22 @@ export class Api extends HttpClient {
1088
1088
  format: "json",
1089
1089
  ...params,
1090
1090
  }),
1091
+ /**
1092
+ * @description This endpoint is used for retrying to generate a failed invoice.
1093
+ *
1094
+ * @tags invoices
1095
+ * @name RetryInvoice
1096
+ * @summary Retry generation of a failed invoice
1097
+ * @request POST:/invoices/{lago_id}/retry
1098
+ * @secure
1099
+ */
1100
+ retryInvoice: (lagoId, params = {}) => this.request({
1101
+ path: `/invoices/${lagoId}/retry`,
1102
+ method: "POST",
1103
+ secure: true,
1104
+ format: "json",
1105
+ ...params,
1106
+ }),
1091
1107
  /**
1092
1108
  * @description This endpoint generates a checkout link for a specific invoice.
1093
1109
  *
@@ -1156,6 +1172,43 @@ export class Api extends HttpClient {
1156
1172
  ...params,
1157
1173
  }),
1158
1174
  };
1175
+ paymentRequests = {
1176
+ /**
1177
+ * @description This endpoint is used to create a payment request to collect payments of overdue invoices of a given customer
1178
+ *
1179
+ * @tags payment_requests
1180
+ * @name CreatePaymentRequest
1181
+ * @summary Create a payment request
1182
+ * @request POST:/payment_requests
1183
+ * @secure
1184
+ */
1185
+ createPaymentRequest: (data, params = {}) => this.request({
1186
+ path: `/payment_requests`,
1187
+ method: "POST",
1188
+ body: data,
1189
+ secure: true,
1190
+ type: ContentType.Json,
1191
+ format: "json",
1192
+ ...params,
1193
+ }),
1194
+ /**
1195
+ * @description This endpoint is used to list all existing payment requests.
1196
+ *
1197
+ * @tags payment_requests
1198
+ * @name FindAllPaymentRequests
1199
+ * @summary List all payment requests
1200
+ * @request GET:/payment_requests
1201
+ * @secure
1202
+ */
1203
+ findAllPaymentRequests: (query, params = {}) => this.request({
1204
+ path: `/payment_requests`,
1205
+ method: "GET",
1206
+ query: query,
1207
+ secure: true,
1208
+ format: "json",
1209
+ ...params,
1210
+ }),
1211
+ };
1159
1212
  plans = {
1160
1213
  /**
1161
1214
  * @description This endpoint creates a plan with subscription and usage-based charges. It supports flexible billing cadence (in-advance or in-arrears) and allows for both recurring and metered charges.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "main": "./script/mod.js",
4
4
  "name": "lago-javascript-client",
5
5
  "sideEffects": false,
6
- "version": "v1.9.0",
6
+ "version": "v1.11.0",
7
7
  "description": "Lago JavaScript API Client",
8
8
  "repository": {
9
9
  "type": "git",
@@ -297,6 +297,19 @@ export interface AppliedCouponsPaginated {
297
297
  applied_coupons: AppliedCouponObjectExtended[];
298
298
  meta: PaginationMeta;
299
299
  }
300
+ export interface AppliedUsageThresholdObject {
301
+ /**
302
+ * The amount of usage in cents that has been accumulated over the lifetime of the subscription.
303
+ * @example 2000
304
+ */
305
+ lifetime_usage_amount_cents: number;
306
+ /**
307
+ * The date and time when the lifetime usage was computed. It is expressed in UTC format according to the ISO 8601 datetime standard.
308
+ * @format date-time
309
+ */
310
+ created_at: string;
311
+ usage_threshold: UsageThresholdObject;
312
+ }
300
313
  export interface BaseAppliedTax {
301
314
  /**
302
315
  * Unique identifier of the applied tax, created by Lago.
@@ -1090,17 +1103,17 @@ export interface CreditObject {
1090
1103
  */
1091
1104
  lago_item_id: string;
1092
1105
  /**
1093
- * The type of credit applied. Possible values are `coupon` or `credit_note`.
1106
+ * The type of credit applied. Possible values are `coupon`, `credit_note` or `invoice` (for `progressive_billing` invoice).
1094
1107
  * @example "coupon"
1095
1108
  */
1096
- type: "coupon" | "credit_note";
1109
+ type: "coupon" | "credit_note" | "invoice";
1097
1110
  /**
1098
- * The code of the credit applied. It can be the code of the coupon attached to the credit or the credit note's number.
1111
+ * The code of the credit applied. It can be the code of the coupon attached to the credit, the credit note's number or the `progressive_billing` invoice number.
1099
1112
  * @example "startup_deal"
1100
1113
  */
1101
1114
  code: string;
1102
1115
  /**
1103
- * The name of the credit applied. It can be the name of the coupon attached to the credit or the initial invoice's number linked to the credit note.
1116
+ * The name of the credit applied. It can be the name of the coupon attached to the credit, the initial invoice's number linked to the credit note or the `progressive_billing` invoice number.
1104
1117
  * @example "Startup Deal"
1105
1118
  */
1106
1119
  name: string;
@@ -1409,7 +1422,7 @@ export interface CustomerBillingConfiguration {
1409
1422
  */
1410
1423
  document_locale?: string;
1411
1424
  /**
1412
- * Specifies the available payment methods that can be used for this customer when `payment_provider` is set to `stripe`. The `provider_payment_methods` field is an array that allows multiple payment options to be defined. If this field is not explicitly set, the payment methods will be set to `[card]`. For now, possible values are `card`, `sepa_debit`, `us_bank_account`, `bacs_debit` and `link`. Note that when `link` is selected, `card` should also be provided in the array.
1425
+ * Specifies the available payment methods that can be used for this customer when `payment_provider` is set to `stripe`. The `provider_payment_methods` field is an array that allows multiple payment options to be defined. If this field is not explicitly set, the payment methods will be set to `card`. For now, possible values are `card`, `sepa_debit`, `us_bank_account`, `bacs_debit` and `link`. Note that when `link` is selected, `card` should also be provided in the array.
1413
1426
  * @example ["card","sepa_debit"]
1414
1427
  */
1415
1428
  provider_payment_methods?: string[] | null;
@@ -1424,10 +1437,10 @@ export interface IntegrationCustomer {
1424
1437
  lago_id?: string;
1425
1438
  /**
1426
1439
  * The integration type used for accounting and tax syncs.
1427
- * Accepted values: `netsuite`.
1440
+ * Accepted values: `netsuite, anrok`.
1428
1441
  * @example "netsuite"
1429
1442
  */
1430
- type?: "netsuite";
1443
+ type?: "netsuite" | "anrok";
1431
1444
  /**
1432
1445
  * Unique code used to identify an integration connection.
1433
1446
  * @example "netsuite-eu-1"
@@ -1657,6 +1670,14 @@ export interface CustomerCreateInput {
1657
1670
  * @example 30
1658
1671
  */
1659
1672
  net_payment_term?: number | null;
1673
+ /**
1674
+ * Specifies how invoices with a zero total amount should be handled:
1675
+ * - `inherit`: (Default) Follows the organization-level configuration.
1676
+ * - `finalize`: Invoices are issued and finalized even if the total amount is zero.
1677
+ * - `skip`: Invoices with a total amount of zero are not finalized.
1678
+ * @example "inherit"
1679
+ */
1680
+ finalize_zero_amount_invoice?: "inherit" | "skip" | "finalize";
1660
1681
  /** Configuration specific to the payment provider, utilized for billing the customer. This object contains settings and parameters necessary for processing payments and invoicing the customer. */
1661
1682
  billing_configuration?: CustomerBillingConfiguration;
1662
1683
  /** Configuration specific to the payment provider, utilized for billing the customer. This object contains settings and parameters necessary for processing payments and invoicing the customer. */
@@ -1670,10 +1691,10 @@ export interface CustomerCreateInput {
1670
1691
  id?: string;
1671
1692
  /**
1672
1693
  * The integration type used for accounting and tax syncs.
1673
- * Accepted values: `netsuite`.
1694
+ * Accepted values: `netsuite, anrok, xero`.
1674
1695
  * @example "netsuite"
1675
1696
  */
1676
- integration_type?: "netsuite";
1697
+ integration_type?: "netsuite" | "anrok" | "xero";
1677
1698
  /**
1678
1699
  * Unique code used to identify an integration connection.
1679
1700
  * @example "netsuite-eu-1"
@@ -1751,7 +1772,7 @@ export interface CustomerMetadata {
1751
1772
  */
1752
1773
  created_at: string;
1753
1774
  }
1754
- export interface CustomerObject {
1775
+ export type CustomerObject = {
1755
1776
  /**
1756
1777
  * 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
1757
1778
  * @format uuid
@@ -1864,13 +1885,22 @@ export interface CustomerObject {
1864
1885
  * @example "2022-04-29T08:59:51Z"
1865
1886
  */
1866
1887
  updated_at?: string;
1888
+ /**
1889
+ * Specifies how invoices with a zero total amount should be handled:
1890
+ * - `inherit`: (Default) Follows the organization-level configuration.
1891
+ * - `finalize`: Invoices are issued and finalized even if the total amount is zero.
1892
+ * - `skip`: Invoices with a total amount of zero are not finalized.
1893
+ * @example "inherit"
1894
+ */
1895
+ finalize_zero_amount_invoice?: "inherit" | "skip" | "finalize";
1867
1896
  /** Configuration specific to the payment provider, utilized for billing the customer. This object contains settings and parameters necessary for processing payments and invoicing the customer. */
1868
1897
  billing_configuration?: CustomerBillingConfiguration;
1869
1898
  /** Configuration specific to the payment provider, utilized for billing the customer. This object contains settings and parameters necessary for processing payments and invoicing the customer. */
1870
1899
  shipping_address?: Address;
1871
- integration_customers?: IntegrationCustomer[];
1872
1900
  metadata?: CustomerMetadata[];
1873
- }
1901
+ } & {
1902
+ integration_customers?: IntegrationCustomer[];
1903
+ };
1874
1904
  export type CustomerObjectExtended = CustomerObject & {
1875
1905
  metadata?: CustomerMetadata[];
1876
1906
  /** List of customer taxes */
@@ -2115,6 +2145,16 @@ export interface FeeObject {
2115
2145
  * @example 100
2116
2146
  */
2117
2147
  amount_cents: number;
2148
+ /**
2149
+ * The cost of this specific fee, excluding any applicable taxes, with precision.
2150
+ * @example "1.0001"
2151
+ */
2152
+ precise_amount?: string;
2153
+ /**
2154
+ * The cost of this specific fee, including any applicable taxes, with precision.
2155
+ * @example "1.0212"
2156
+ */
2157
+ precise_total_amount?: string;
2118
2158
  /** The currency of this specific fee. It indicates the monetary unit in which the fee's cost is expressed. */
2119
2159
  amount_currency: Currency;
2120
2160
  /**
@@ -2122,6 +2162,11 @@ export interface FeeObject {
2122
2162
  * @example 20
2123
2163
  */
2124
2164
  taxes_amount_cents: number;
2165
+ /**
2166
+ * The cost of the tax associated with this specific fee, with precision.
2167
+ * @example "0.20123"
2168
+ */
2169
+ taxes_precise_amount?: string;
2125
2170
  /**
2126
2171
  * The tax rate associated with this specific fee.
2127
2172
  * @example 20
@@ -2626,7 +2671,7 @@ export interface InvoiceMetadataObject {
2626
2671
  */
2627
2672
  created_at?: string;
2628
2673
  }
2629
- export interface InvoiceObject {
2674
+ export type InvoiceObject = {
2630
2675
  /**
2631
2676
  * 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.
2632
2677
  * @format uuid
@@ -2672,18 +2717,19 @@ export interface InvoiceObject {
2672
2717
  */
2673
2718
  net_payment_term?: number;
2674
2719
  /**
2675
- * The type of invoice issued. Possible values are `subscription`, `one-off` or `credit`.
2720
+ * The type of invoice issued. Possible values are `subscription`, `one-off`, `credit` or `progressive_billing`.
2676
2721
  * @example "subscription"
2677
2722
  */
2678
- invoice_type: "subscription" | "add_on" | "credit" | "one_off";
2723
+ invoice_type: "subscription" | "add_on" | "credit" | "one_off" | "progressive_billing";
2679
2724
  /**
2680
2725
  * The status of the invoice. It indicates the current state of the invoice and can have two possible values:
2681
2726
  * - `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.
2682
2727
  * - `finalized`: the invoice has been issued and finalized. In this state, events cannot be ingested or added to the invoice anymore.
2683
2728
  * - `voided`: the invoice has been issued and subsequently voided. In this state, events cannot be ingested or added to the invoice anymore.
2729
+ * - `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.
2684
2730
  * @example "finalized"
2685
2731
  */
2686
- status: "draft" | "finalized" | "voided";
2732
+ status: "draft" | "finalized" | "voided" | "failed";
2687
2733
  /**
2688
2734
  * The status of the payment associated with the invoice. It can have one of the following values:
2689
2735
  * - `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.
@@ -2714,7 +2760,7 @@ export interface InvoiceObject {
2714
2760
  * This field depends on the version number. Here are the definitions based on the version:
2715
2761
  * - Version 1: is equal to the sum of `fees_amount_cents`, minus `coupons_amount_cents`, and minus `prepaid_credit_amount_cents`.
2716
2762
  * - Version 2: is equal to the `fees_amount_cents`.
2717
- * - Version 3: is equal to the `fees_amount_cents`, minus `coupons_amount_cents`
2763
+ * - Version 3 & 4: is equal to the `fees_amount_cents`, minus `coupons_amount_cents`
2718
2764
  * @example 100
2719
2765
  */
2720
2766
  sub_total_excluding_taxes_amount_cents: number;
@@ -2728,7 +2774,7 @@ export interface InvoiceObject {
2728
2774
  * This field depends on the version number. Here are the definitions based on the version:
2729
2775
  * - Version 1: is equal to the `total_amount_cents`.
2730
2776
  * - Version 2: is equal to the sum of `fees_amount_cents` and `taxes_amount_cents`.
2731
- * - Version 3: is equal to the sum `sub_total_excluding_taxes_amount_cents` and `taxes_amount_cents`
2777
+ * - Version 3 & 4: is equal to the sum `sub_total_excluding_taxes_amount_cents` and `taxes_amount_cents`
2732
2778
  * @example 120
2733
2779
  */
2734
2780
  sub_total_including_taxes_amount_cents: number;
@@ -2737,6 +2783,11 @@ export interface InvoiceObject {
2737
2783
  * @example 0
2738
2784
  */
2739
2785
  prepaid_credit_amount_cents: number;
2786
+ /**
2787
+ * The usage already billed in previous invoices. Only apply to `progressive_billing` and `subscription` invoices.
2788
+ * @example 0
2789
+ */
2790
+ progressive_billing_credit_amount_cents: number;
2740
2791
  /**
2741
2792
  * 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.
2742
2793
  * @example 100
@@ -2750,15 +2801,35 @@ export interface InvoiceObject {
2750
2801
  * @example "https://getlago.com/invoice/file"
2751
2802
  */
2752
2803
  file_url?: string;
2804
+ } & {
2753
2805
  /** The customer on which the invoice applies. It refers to the customer account or entity associated with the invoice. */
2754
2806
  customer?: CustomerObject;
2755
2807
  metadata?: InvoiceMetadataObject[];
2756
2808
  applied_taxes?: InvoiceAppliedTaxObject[];
2757
- }
2809
+ applied_usage_thresholds?: AppliedUsageThresholdObject[] | null;
2810
+ };
2758
2811
  export type InvoiceObjectExtended = InvoiceObject & {
2759
2812
  credits?: CreditObject[];
2760
2813
  fees?: FeeObject[];
2761
2814
  subscriptions?: SubscriptionObject[];
2815
+ error_details?: {
2816
+ /**
2817
+ * Unique identifier assigned to the error_detail within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the error's record within the Lago system.
2818
+ * @format uuid
2819
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2820
+ */
2821
+ lago_id: string | null;
2822
+ /**
2823
+ * Code that specifies part of the application / connection, where the error originally happened
2824
+ * @example "tax_error"
2825
+ */
2826
+ error_code: string;
2827
+ /**
2828
+ * Key value list of more elaborated error detail, where by the key of error_code an external service error details are stored
2829
+ * @example {"tax_error":"taxDateTooFarInFuture"}
2830
+ */
2831
+ details: object;
2832
+ }[];
2762
2833
  };
2763
2834
  export interface InvoiceOneOffCreateInput {
2764
2835
  invoice: {
@@ -2960,6 +3031,11 @@ export interface OrganizationObject {
2960
3031
  billing_configuration: OrganizationBillingConfiguration;
2961
3032
  /** List of default organization taxes */
2962
3033
  taxes?: TaxObject[];
3034
+ /**
3035
+ * Indicates whether invoices with a zero total amount should be finalized. If set to true, zero amount invoices will be finalized. If set to false, zero amount invoices will not be finalized.
3036
+ * @example false
3037
+ */
3038
+ finalize_zero_amount_invoice?: boolean;
2963
3039
  }
2964
3040
  export interface OrganizationUpdateInput {
2965
3041
  organization: {
@@ -3047,6 +3123,11 @@ export interface OrganizationUpdateInput {
3047
3123
  email_settings?: ("invoice.finalized" | "credit_note.created")[];
3048
3124
  /** The custom billing settings for your organization. */
3049
3125
  billing_configuration?: OrganizationBillingConfiguration;
3126
+ /**
3127
+ * Determines whether invoices with a zero total amount should be finalized. If set to true, zero amount invoices will be finalized. If set to false, zero amount invoices will not be finalized.
3128
+ * @example false
3129
+ */
3130
+ finalize_zero_amount_invoice?: boolean;
3050
3131
  };
3051
3132
  }
3052
3133
  export interface OverdueBalanceObject {
@@ -3221,6 +3302,8 @@ export interface PlanCreateInput {
3221
3302
  */
3222
3303
  tax_codes?: string[];
3223
3304
  }[];
3305
+ /** List of usage thresholds to apply to the plan. */
3306
+ usage_thresholds?: UsageThresholdInput[];
3224
3307
  };
3225
3308
  }
3226
3309
  /** Based plan overrides. */
@@ -3292,6 +3375,8 @@ export interface PlanOverridesObject {
3292
3375
  */
3293
3376
  tax_codes?: string[];
3294
3377
  }[];
3378
+ /** List of usage thresholds applied to the subscription. */
3379
+ usage_thresholds?: UsageThresholdObject[];
3295
3380
  }
3296
3381
  export interface PlanUpdateInput {
3297
3382
  plan: {
@@ -3419,6 +3504,8 @@ export interface PlanUpdateInput {
3419
3504
  */
3420
3505
  tax_codes?: string[];
3421
3506
  }[];
3507
+ /** List of usage thresholds to apply to the plan. */
3508
+ usage_thresholds?: UsageThresholdInput[];
3422
3509
  };
3423
3510
  }
3424
3511
  export interface PlanObject {
@@ -3499,6 +3586,8 @@ export interface PlanObject {
3499
3586
  charges?: ChargeObject[];
3500
3587
  /** All taxes applied to the plan. */
3501
3588
  taxes?: TaxObject[];
3589
+ /** List of usage thresholds applied to the plan. */
3590
+ usage_thresholds?: UsageThresholdObject[];
3502
3591
  }
3503
3592
  export interface PlansPaginated {
3504
3593
  plans: PlanObject[];
@@ -3793,6 +3882,64 @@ export interface TaxUpdateInput {
3793
3882
  }
3794
3883
  /** @example "America/Los_Angeles" */
3795
3884
  export type Timezone = "UTC" | "Africa/Algiers" | "Africa/Cairo" | "Africa/Casablanca" | "Africa/Harare" | "Africa/Johannesburg" | "Africa/Monrovia" | "Africa/Nairobi" | "America/Argentina/Buenos_Aires" | "America/Bogota" | "America/Caracas" | "America/Chicago" | "America/Chihuahua" | "America/Denver" | "America/Godthab" | "America/Guatemala" | "America/Guyana" | "America/Halifax" | "America/Indiana/Indianapolis" | "America/Juneau" | "America/La_Paz" | "America/Lima" | "America/Los_Angeles" | "America/Mazatlan" | "America/Mexico_City" | "America/Monterrey" | "America/Montevideo" | "America/New_York" | "America/Phoenix" | "America/Puerto_Rico" | "America/Regina" | "America/Santiago" | "America/Sao_Paulo" | "America/St_Johns" | "America/Tijuana" | "Asia/Almaty" | "Asia/Baghdad" | "Asia/Baku" | "Asia/Bangkok" | "Asia/Chongqing" | "Asia/Colombo" | "Asia/Dhaka" | "Asia/Hong_Kong" | "Asia/Irkutsk" | "Asia/Jakarta" | "Asia/Jerusalem" | "Asia/Kabul" | "Asia/Kamchatka" | "Asia/Karachi" | "Asia/Kathmandu" | "Asia/Kolkata" | "Asia/Krasnoyarsk" | "Asia/Kuala_Lumpur" | "Asia/Kuwait" | "Asia/Magadan" | "Asia/Muscat" | "Asia/Novosibirsk" | "Asia/Rangoon" | "Asia/Riyadh" | "Asia/Seoul" | "Asia/Shanghai" | "Asia/Singapore" | "Asia/Srednekolymsk" | "Asia/Taipei" | "Asia/Tashkent" | "Asia/Tbilisi" | "Asia/Tehran" | "Asia/Tokyo" | "Asia/Ulaanbaatar" | "Asia/Urumqi" | "Asia/Vladivostok" | "Asia/Yakutsk" | "Asia/Yekaterinburg" | "Asia/Yerevan" | "Atlantic/Azores" | "Atlantic/Cape_Verde" | "Atlantic/South_Georgia" | "Australia/Adelaide" | "Australia/Brisbane" | "Australia/Darwin" | "Australia/Hobart" | "Australia/Melbourne" | "Australia/Perth" | "Australia/Sydney" | "Europe/Amsterdam" | "Europe/Athens" | "Europe/Belgrade" | "Europe/Berlin" | "Europe/Bratislava" | "Europe/Brussels" | "Europe/Bucharest" | "Europe/Budapest" | "Europe/Copenhagen" | "Europe/Dublin" | "Europe/Helsinki" | "Europe/Istanbul" | "Europe/Kaliningrad" | "Europe/Kiev" | "Europe/Lisbon" | "Europe/Ljubljana" | "Europe/London" | "Europe/Madrid" | "Europe/Minsk" | "Europe/Moscow" | "Europe/Paris" | "Europe/Prague" | "Europe/Riga" | "Europe/Rome" | "Europe/Samara" | "Europe/Sarajevo" | "Europe/Skopje" | "Europe/Sofia" | "Europe/Stockholm" | "Europe/Tallinn" | "Europe/Vienna" | "Europe/Vilnius" | "Europe/Volgograd" | "Europe/Warsaw" | "Europe/Zagreb" | "Europe/Zurich" | "GMT+12" | "Pacific/Apia" | "Pacific/Auckland" | "Pacific/Chatham" | "Pacific/Fakaofo" | "Pacific/Fiji" | "Pacific/Guadalcanal" | "Pacific/Guam" | "Pacific/Honolulu" | "Pacific/Majuro" | "Pacific/Midway" | "Pacific/Noumea" | "Pacific/Pago_Pago" | "Pacific/Port_Moresby" | "Pacific/Tongatapu";
3885
+ export interface UsageThresholdInput {
3886
+ /**
3887
+ * Unique identifier of the usage threshold created by Lago.
3888
+ * @format uuid
3889
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3890
+ */
3891
+ id?: string | null;
3892
+ /**
3893
+ * The display name of the usage threshold.
3894
+ * @example "Threshold 1"
3895
+ */
3896
+ threshold_display_name?: string | null;
3897
+ /**
3898
+ * The amount to reach to trigger a `progressive_billing` invoice.
3899
+ * @example 10000
3900
+ */
3901
+ amount_cents: number;
3902
+ /**
3903
+ * 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.
3904
+ * @example true
3905
+ */
3906
+ recurring: boolean;
3907
+ }
3908
+ export interface UsageThresholdObject {
3909
+ /**
3910
+ * Unique identifier of the usage threshold created by Lago.
3911
+ * @format uuid
3912
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3913
+ */
3914
+ lago_id: string;
3915
+ /**
3916
+ * The display name of the usage threshold.
3917
+ * @example "Threshold 1"
3918
+ */
3919
+ threshold_display_name?: string | null;
3920
+ /**
3921
+ * The amount to reach to trigger a `progressive_billing` invoice.
3922
+ * @example 10000
3923
+ */
3924
+ amount_cents: number;
3925
+ /**
3926
+ * 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.
3927
+ * @example true
3928
+ */
3929
+ recurring: boolean;
3930
+ /**
3931
+ * The date and time when the usage threshold was created. It is expressed in UTC format according to the ISO 8601 datetime standard.
3932
+ * @format date-time
3933
+ * @example "2023-06-27T19:43:42Z"
3934
+ */
3935
+ created_at: string;
3936
+ /**
3937
+ * The date and time when the usage threshold was last updated. It is expressed in UTC format according to the ISO 8601 datetime standard.
3938
+ * @format date-time
3939
+ * @example "2023-06-27T19:43:42Z"
3940
+ */
3941
+ updated_at: string;
3942
+ }
3796
3943
  export interface Wallet {
3797
3944
  wallet: WalletObject;
3798
3945
  }
@@ -4440,7 +4587,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
4440
4587
  }
4441
4588
  /**
4442
4589
  * @title Lago API documentation
4443
- * @version 1.9.0
4590
+ * @version 1.11.0
4444
4591
  * @license AGPLv3
4445
4592
  * @baseUrl https://{region}.getlago.com/api/v1
4446
4593
  * @externalDocs https://github.com/getlago
@@ -5349,6 +5496,16 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
5349
5496
  * @secure
5350
5497
  */
5351
5498
  refreshInvoice: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiErrorUnauthorized | ApiErrorNotFound>>;
5499
+ /**
5500
+ * @description This endpoint is used for retrying to generate a failed invoice.
5501
+ *
5502
+ * @tags invoices
5503
+ * @name RetryInvoice
5504
+ * @summary Retry generation of a failed invoice
5505
+ * @request POST:/invoices/{lago_id}/retry
5506
+ * @secure
5507
+ */
5508
+ retryInvoice: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiErrorUnauthorized | ApiErrorNotFound>>;
5352
5509
  /**
5353
5510
  * @description This endpoint generates a checkout link for a specific invoice.
5354
5511
  *
@@ -5420,6 +5577,102 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
5420
5577
  */
5421
5578
  updateOrganization: (data: OrganizationUpdateInput, params?: RequestParams) => Promise<HttpResponse<Organization, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
5422
5579
  };
5580
+ paymentRequests: {
5581
+ /**
5582
+ * @description This endpoint is used to create a payment request to collect payments of overdue invoices of a given customer
5583
+ *
5584
+ * @tags payment_requests
5585
+ * @name CreatePaymentRequest
5586
+ * @summary Create a payment request
5587
+ * @request POST:/payment_requests
5588
+ * @secure
5589
+ */
5590
+ createPaymentRequest: (data: {
5591
+ payment_request: {
5592
+ /**
5593
+ * The customer external unique identifier (provided by your own application)
5594
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
5595
+ */
5596
+ customer_external_id?: string;
5597
+ /**
5598
+ * The customer's email address used for sending dunning notifications
5599
+ * @format email
5600
+ * @example "dinesh@piedpiper.test"
5601
+ */
5602
+ email: string;
5603
+ /** A list of Lago IDs for the customer's overdue invoices to start the dunning process */
5604
+ lago_invoice_ids: string[];
5605
+ };
5606
+ }, params?: RequestParams) => Promise<HttpResponse<{
5607
+ payment_request: {
5608
+ /**
5609
+ * Unique identifier of the payment request, created by Lago.
5610
+ * @format uuid
5611
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
5612
+ */
5613
+ lago_id: string;
5614
+ /**
5615
+ * The customer's email address used for sending dunning notifications
5616
+ * @format email
5617
+ * @example "dinesh@piedpiper.test"
5618
+ */
5619
+ email: string;
5620
+ /**
5621
+ * The sum of the total amounts of all the invoices included in the payment request, expressed in cents.
5622
+ * @example 100
5623
+ */
5624
+ amount_cents: number;
5625
+ /** The currency of the payment request. */
5626
+ amount_currency: Currency;
5627
+ /**
5628
+ * The status of the payment associated with the payment request. It can have one of the following values:
5629
+ * - `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.
5630
+ * - `succeeded`: the payment of the payment request has been successfully processed.
5631
+ * - `failed`: the payment of the payment request has failed or encountered an error during processing.
5632
+ * @example "succeeded"
5633
+ */
5634
+ payment_status: "pending" | "succeeded" | "failed";
5635
+ /**
5636
+ * 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.
5637
+ * @format date-time
5638
+ * @example "2022-04-29T08:59:51Z"
5639
+ */
5640
+ created_at: string;
5641
+ /** The customer on which the payment request applies. It refers to the customer account or entity associated with the payment request. */
5642
+ customer: any;
5643
+ invoices: any[];
5644
+ };
5645
+ }, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
5646
+ /**
5647
+ * @description This endpoint is used to list all existing payment requests.
5648
+ *
5649
+ * @tags payment_requests
5650
+ * @name FindAllPaymentRequests
5651
+ * @summary List all payment requests
5652
+ * @request GET:/payment_requests
5653
+ * @secure
5654
+ */
5655
+ findAllPaymentRequests: (query?: {
5656
+ /**
5657
+ * Page number.
5658
+ * @example 1
5659
+ */
5660
+ page?: number;
5661
+ /**
5662
+ * Number of records per page.
5663
+ * @example 20
5664
+ */
5665
+ per_page?: number;
5666
+ /**
5667
+ * Unique identifier assigned to the customer in your application.
5668
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
5669
+ */
5670
+ external_customer_id?: string;
5671
+ }, params?: RequestParams) => Promise<HttpResponse<{
5672
+ payment_requests: any[];
5673
+ meta: PaginationMeta;
5674
+ }, ApiErrorUnauthorized>>;
5675
+ };
5423
5676
  plans: {
5424
5677
  /**
5425
5678
  * @description This endpoint creates a plan with subscription and usage-based charges. It supports flexible billing cadence (in-advance or in-arrears) and allows for both recurring and metered charges.
@@ -152,7 +152,7 @@ class HttpClient {
152
152
  exports.HttpClient = HttpClient;
153
153
  /**
154
154
  * @title Lago API documentation
155
- * @version 1.9.0
155
+ * @version 1.11.0
156
156
  * @license AGPLv3
157
157
  * @baseUrl https://{region}.getlago.com/api/v1
158
158
  * @externalDocs https://github.com/getlago
@@ -1092,6 +1092,22 @@ class Api extends HttpClient {
1092
1092
  format: "json",
1093
1093
  ...params,
1094
1094
  }),
1095
+ /**
1096
+ * @description This endpoint is used for retrying to generate a failed invoice.
1097
+ *
1098
+ * @tags invoices
1099
+ * @name RetryInvoice
1100
+ * @summary Retry generation of a failed invoice
1101
+ * @request POST:/invoices/{lago_id}/retry
1102
+ * @secure
1103
+ */
1104
+ retryInvoice: (lagoId, params = {}) => this.request({
1105
+ path: `/invoices/${lagoId}/retry`,
1106
+ method: "POST",
1107
+ secure: true,
1108
+ format: "json",
1109
+ ...params,
1110
+ }),
1095
1111
  /**
1096
1112
  * @description This endpoint generates a checkout link for a specific invoice.
1097
1113
  *
@@ -1160,6 +1176,43 @@ class Api extends HttpClient {
1160
1176
  ...params,
1161
1177
  }),
1162
1178
  };
1179
+ paymentRequests = {
1180
+ /**
1181
+ * @description This endpoint is used to create a payment request to collect payments of overdue invoices of a given customer
1182
+ *
1183
+ * @tags payment_requests
1184
+ * @name CreatePaymentRequest
1185
+ * @summary Create a payment request
1186
+ * @request POST:/payment_requests
1187
+ * @secure
1188
+ */
1189
+ createPaymentRequest: (data, params = {}) => this.request({
1190
+ path: `/payment_requests`,
1191
+ method: "POST",
1192
+ body: data,
1193
+ secure: true,
1194
+ type: ContentType.Json,
1195
+ format: "json",
1196
+ ...params,
1197
+ }),
1198
+ /**
1199
+ * @description This endpoint is used to list all existing payment requests.
1200
+ *
1201
+ * @tags payment_requests
1202
+ * @name FindAllPaymentRequests
1203
+ * @summary List all payment requests
1204
+ * @request GET:/payment_requests
1205
+ * @secure
1206
+ */
1207
+ findAllPaymentRequests: (query, params = {}) => this.request({
1208
+ path: `/payment_requests`,
1209
+ method: "GET",
1210
+ query: query,
1211
+ secure: true,
1212
+ format: "json",
1213
+ ...params,
1214
+ }),
1215
+ };
1163
1216
  plans = {
1164
1217
  /**
1165
1218
  * @description This endpoint creates a plan with subscription and usage-based charges. It supports flexible billing cadence (in-advance or in-arrears) and allows for both recurring and metered charges.