lago-javascript-client 1.9.0 → 1.10.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;
@@ -2672,18 +2685,19 @@ export interface InvoiceObject {
2672
2685
  */
2673
2686
  net_payment_term?: number;
2674
2687
  /**
2675
- * The type of invoice issued. Possible values are `subscription`, `one-off` or `credit`.
2688
+ * The type of invoice issued. Possible values are `subscription`, `one-off`, `credit` or `progressive_billing`.
2676
2689
  * @example "subscription"
2677
2690
  */
2678
- invoice_type: "subscription" | "add_on" | "credit" | "one_off";
2691
+ invoice_type: "subscription" | "add_on" | "credit" | "one_off" | "progressive_billing";
2679
2692
  /**
2680
2693
  * The status of the invoice. It indicates the current state of the invoice and can have two possible values:
2681
2694
  * - `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
2695
  * - `finalized`: the invoice has been issued and finalized. In this state, events cannot be ingested or added to the invoice anymore.
2683
2696
  * - `voided`: the invoice has been issued and subsequently voided. In this state, events cannot be ingested or added to the invoice anymore.
2697
+ * - `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
2698
  * @example "finalized"
2685
2699
  */
2686
- status: "draft" | "finalized" | "voided";
2700
+ status: "draft" | "finalized" | "voided" | "failed";
2687
2701
  /**
2688
2702
  * The status of the payment associated with the invoice. It can have one of the following values:
2689
2703
  * - `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 +2728,7 @@ export interface InvoiceObject {
2714
2728
  * This field depends on the version number. Here are the definitions based on the version:
2715
2729
  * - Version 1: is equal to the sum of `fees_amount_cents`, minus `coupons_amount_cents`, and minus `prepaid_credit_amount_cents`.
2716
2730
  * - Version 2: is equal to the `fees_amount_cents`.
2717
- * - Version 3: is equal to the `fees_amount_cents`, minus `coupons_amount_cents`
2731
+ * - Version 3 & 4: is equal to the `fees_amount_cents`, minus `coupons_amount_cents`
2718
2732
  * @example 100
2719
2733
  */
2720
2734
  sub_total_excluding_taxes_amount_cents: number;
@@ -2728,7 +2742,7 @@ export interface InvoiceObject {
2728
2742
  * This field depends on the version number. Here are the definitions based on the version:
2729
2743
  * - Version 1: is equal to the `total_amount_cents`.
2730
2744
  * - 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`
2745
+ * - Version 3 & 4: is equal to the sum `sub_total_excluding_taxes_amount_cents` and `taxes_amount_cents`
2732
2746
  * @example 120
2733
2747
  */
2734
2748
  sub_total_including_taxes_amount_cents: number;
@@ -2737,6 +2751,11 @@ export interface InvoiceObject {
2737
2751
  * @example 0
2738
2752
  */
2739
2753
  prepaid_credit_amount_cents: number;
2754
+ /**
2755
+ * The usage already billed in previous invoices. Only apply to `progressive_billing` and `subscription` invoices.
2756
+ * @example 0
2757
+ */
2758
+ progressive_billing_credit_amount_cents: number;
2740
2759
  /**
2741
2760
  * 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
2761
  * @example 100
@@ -2754,11 +2773,30 @@ export interface InvoiceObject {
2754
2773
  customer?: CustomerObject;
2755
2774
  metadata?: InvoiceMetadataObject[];
2756
2775
  applied_taxes?: InvoiceAppliedTaxObject[];
2776
+ applied_usage_thresholds?: AppliedUsageThresholdObject[] | null;
2757
2777
  }
2758
2778
  export type InvoiceObjectExtended = InvoiceObject & {
2759
2779
  credits?: CreditObject[];
2760
2780
  fees?: FeeObject[];
2761
2781
  subscriptions?: SubscriptionObject[];
2782
+ error_details?: {
2783
+ /**
2784
+ * 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.
2785
+ * @format uuid
2786
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2787
+ */
2788
+ lago_id: string | null;
2789
+ /**
2790
+ * Code that specifies part of the application / connection, where the error originally happened
2791
+ * @example "tax_error"
2792
+ */
2793
+ error_code: string;
2794
+ /**
2795
+ * Key value list of more elaborated error detail, where by the key of error_code an external service error details are stored
2796
+ * @example {"tax_error":"taxDateTooFarInFuture"}
2797
+ */
2798
+ details: object;
2799
+ }[];
2762
2800
  };
2763
2801
  export interface InvoiceOneOffCreateInput {
2764
2802
  invoice: {
@@ -3221,6 +3259,8 @@ export interface PlanCreateInput {
3221
3259
  */
3222
3260
  tax_codes?: string[];
3223
3261
  }[];
3262
+ /** List of usage thresholds to apply to the plan. */
3263
+ usage_thresholds?: UsageThresholdInput[];
3224
3264
  };
3225
3265
  }
3226
3266
  /** Based plan overrides. */
@@ -3292,6 +3332,8 @@ export interface PlanOverridesObject {
3292
3332
  */
3293
3333
  tax_codes?: string[];
3294
3334
  }[];
3335
+ /** List of usage thresholds applied to the subscription. */
3336
+ usage_thresholds?: UsageThresholdObject[];
3295
3337
  }
3296
3338
  export interface PlanUpdateInput {
3297
3339
  plan: {
@@ -3419,6 +3461,8 @@ export interface PlanUpdateInput {
3419
3461
  */
3420
3462
  tax_codes?: string[];
3421
3463
  }[];
3464
+ /** List of usage thresholds to apply to the plan. */
3465
+ usage_thresholds?: UsageThresholdInput[];
3422
3466
  };
3423
3467
  }
3424
3468
  export interface PlanObject {
@@ -3499,6 +3543,8 @@ export interface PlanObject {
3499
3543
  charges?: ChargeObject[];
3500
3544
  /** All taxes applied to the plan. */
3501
3545
  taxes?: TaxObject[];
3546
+ /** List of usage thresholds applied to the plan. */
3547
+ usage_thresholds?: UsageThresholdObject[];
3502
3548
  }
3503
3549
  export interface PlansPaginated {
3504
3550
  plans: PlanObject[];
@@ -3793,6 +3839,64 @@ export interface TaxUpdateInput {
3793
3839
  }
3794
3840
  /** @example "America/Los_Angeles" */
3795
3841
  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";
3842
+ export interface UsageThresholdInput {
3843
+ /**
3844
+ * Unique identifier of the usage threshold created by Lago.
3845
+ * @format uuid
3846
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3847
+ */
3848
+ id?: string | null;
3849
+ /**
3850
+ * The display name of the usage threshold.
3851
+ * @example "Threshold 1"
3852
+ */
3853
+ threshold_display_name?: string | null;
3854
+ /**
3855
+ * The amount to reach to trigger a `progressive_billing` invoice.
3856
+ * @example 10000
3857
+ */
3858
+ amount_cents: number;
3859
+ /**
3860
+ * 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.
3861
+ * @example true
3862
+ */
3863
+ recurring: boolean;
3864
+ }
3865
+ export interface UsageThresholdObject {
3866
+ /**
3867
+ * Unique identifier of the usage threshold created by Lago.
3868
+ * @format uuid
3869
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3870
+ */
3871
+ lago_id: string;
3872
+ /**
3873
+ * The display name of the usage threshold.
3874
+ * @example "Threshold 1"
3875
+ */
3876
+ threshold_display_name?: string | null;
3877
+ /**
3878
+ * The amount to reach to trigger a `progressive_billing` invoice.
3879
+ * @example 10000
3880
+ */
3881
+ amount_cents: number;
3882
+ /**
3883
+ * 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.
3884
+ * @example true
3885
+ */
3886
+ recurring: boolean;
3887
+ /**
3888
+ * The date and time when the usage threshold was created. It is expressed in UTC format according to the ISO 8601 datetime standard.
3889
+ * @format date-time
3890
+ * @example "2023-06-27T19:43:42Z"
3891
+ */
3892
+ created_at: string;
3893
+ /**
3894
+ * The date and time when the usage threshold was last updated. It is expressed in UTC format according to the ISO 8601 datetime standard.
3895
+ * @format date-time
3896
+ * @example "2023-06-27T19:43:42Z"
3897
+ */
3898
+ updated_at: string;
3899
+ }
3796
3900
  export interface Wallet {
3797
3901
  wallet: WalletObject;
3798
3902
  }
@@ -4440,7 +4544,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
4440
4544
  }
4441
4545
  /**
4442
4546
  * @title Lago API documentation
4443
- * @version 1.9.0
4547
+ * @version 1.10.0
4444
4548
  * @license AGPLv3
4445
4549
  * @baseUrl https://{region}.getlago.com/api/v1
4446
4550
  * @externalDocs https://github.com/getlago
@@ -5349,6 +5453,16 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
5349
5453
  * @secure
5350
5454
  */
5351
5455
  refreshInvoice: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiErrorUnauthorized | ApiErrorNotFound>>;
5456
+ /**
5457
+ * @description This endpoint is used for retrying to generate a failed invoice.
5458
+ *
5459
+ * @tags invoices
5460
+ * @name RetryInvoice
5461
+ * @summary Retry generation of a failed invoice
5462
+ * @request POST:/invoices/{lago_id}/retry
5463
+ * @secure
5464
+ */
5465
+ retryInvoice: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiErrorUnauthorized | ApiErrorNotFound>>;
5352
5466
  /**
5353
5467
  * @description This endpoint generates a checkout link for a specific invoice.
5354
5468
  *
@@ -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.10.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
  *
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.10.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;
@@ -2672,18 +2685,19 @@ export interface InvoiceObject {
2672
2685
  */
2673
2686
  net_payment_term?: number;
2674
2687
  /**
2675
- * The type of invoice issued. Possible values are `subscription`, `one-off` or `credit`.
2688
+ * The type of invoice issued. Possible values are `subscription`, `one-off`, `credit` or `progressive_billing`.
2676
2689
  * @example "subscription"
2677
2690
  */
2678
- invoice_type: "subscription" | "add_on" | "credit" | "one_off";
2691
+ invoice_type: "subscription" | "add_on" | "credit" | "one_off" | "progressive_billing";
2679
2692
  /**
2680
2693
  * The status of the invoice. It indicates the current state of the invoice and can have two possible values:
2681
2694
  * - `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
2695
  * - `finalized`: the invoice has been issued and finalized. In this state, events cannot be ingested or added to the invoice anymore.
2683
2696
  * - `voided`: the invoice has been issued and subsequently voided. In this state, events cannot be ingested or added to the invoice anymore.
2697
+ * - `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
2698
  * @example "finalized"
2685
2699
  */
2686
- status: "draft" | "finalized" | "voided";
2700
+ status: "draft" | "finalized" | "voided" | "failed";
2687
2701
  /**
2688
2702
  * The status of the payment associated with the invoice. It can have one of the following values:
2689
2703
  * - `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 +2728,7 @@ export interface InvoiceObject {
2714
2728
  * This field depends on the version number. Here are the definitions based on the version:
2715
2729
  * - Version 1: is equal to the sum of `fees_amount_cents`, minus `coupons_amount_cents`, and minus `prepaid_credit_amount_cents`.
2716
2730
  * - Version 2: is equal to the `fees_amount_cents`.
2717
- * - Version 3: is equal to the `fees_amount_cents`, minus `coupons_amount_cents`
2731
+ * - Version 3 & 4: is equal to the `fees_amount_cents`, minus `coupons_amount_cents`
2718
2732
  * @example 100
2719
2733
  */
2720
2734
  sub_total_excluding_taxes_amount_cents: number;
@@ -2728,7 +2742,7 @@ export interface InvoiceObject {
2728
2742
  * This field depends on the version number. Here are the definitions based on the version:
2729
2743
  * - Version 1: is equal to the `total_amount_cents`.
2730
2744
  * - 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`
2745
+ * - Version 3 & 4: is equal to the sum `sub_total_excluding_taxes_amount_cents` and `taxes_amount_cents`
2732
2746
  * @example 120
2733
2747
  */
2734
2748
  sub_total_including_taxes_amount_cents: number;
@@ -2737,6 +2751,11 @@ export interface InvoiceObject {
2737
2751
  * @example 0
2738
2752
  */
2739
2753
  prepaid_credit_amount_cents: number;
2754
+ /**
2755
+ * The usage already billed in previous invoices. Only apply to `progressive_billing` and `subscription` invoices.
2756
+ * @example 0
2757
+ */
2758
+ progressive_billing_credit_amount_cents: number;
2740
2759
  /**
2741
2760
  * 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
2761
  * @example 100
@@ -2754,11 +2773,30 @@ export interface InvoiceObject {
2754
2773
  customer?: CustomerObject;
2755
2774
  metadata?: InvoiceMetadataObject[];
2756
2775
  applied_taxes?: InvoiceAppliedTaxObject[];
2776
+ applied_usage_thresholds?: AppliedUsageThresholdObject[] | null;
2757
2777
  }
2758
2778
  export type InvoiceObjectExtended = InvoiceObject & {
2759
2779
  credits?: CreditObject[];
2760
2780
  fees?: FeeObject[];
2761
2781
  subscriptions?: SubscriptionObject[];
2782
+ error_details?: {
2783
+ /**
2784
+ * 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.
2785
+ * @format uuid
2786
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2787
+ */
2788
+ lago_id: string | null;
2789
+ /**
2790
+ * Code that specifies part of the application / connection, where the error originally happened
2791
+ * @example "tax_error"
2792
+ */
2793
+ error_code: string;
2794
+ /**
2795
+ * Key value list of more elaborated error detail, where by the key of error_code an external service error details are stored
2796
+ * @example {"tax_error":"taxDateTooFarInFuture"}
2797
+ */
2798
+ details: object;
2799
+ }[];
2762
2800
  };
2763
2801
  export interface InvoiceOneOffCreateInput {
2764
2802
  invoice: {
@@ -3221,6 +3259,8 @@ export interface PlanCreateInput {
3221
3259
  */
3222
3260
  tax_codes?: string[];
3223
3261
  }[];
3262
+ /** List of usage thresholds to apply to the plan. */
3263
+ usage_thresholds?: UsageThresholdInput[];
3224
3264
  };
3225
3265
  }
3226
3266
  /** Based plan overrides. */
@@ -3292,6 +3332,8 @@ export interface PlanOverridesObject {
3292
3332
  */
3293
3333
  tax_codes?: string[];
3294
3334
  }[];
3335
+ /** List of usage thresholds applied to the subscription. */
3336
+ usage_thresholds?: UsageThresholdObject[];
3295
3337
  }
3296
3338
  export interface PlanUpdateInput {
3297
3339
  plan: {
@@ -3419,6 +3461,8 @@ export interface PlanUpdateInput {
3419
3461
  */
3420
3462
  tax_codes?: string[];
3421
3463
  }[];
3464
+ /** List of usage thresholds to apply to the plan. */
3465
+ usage_thresholds?: UsageThresholdInput[];
3422
3466
  };
3423
3467
  }
3424
3468
  export interface PlanObject {
@@ -3499,6 +3543,8 @@ export interface PlanObject {
3499
3543
  charges?: ChargeObject[];
3500
3544
  /** All taxes applied to the plan. */
3501
3545
  taxes?: TaxObject[];
3546
+ /** List of usage thresholds applied to the plan. */
3547
+ usage_thresholds?: UsageThresholdObject[];
3502
3548
  }
3503
3549
  export interface PlansPaginated {
3504
3550
  plans: PlanObject[];
@@ -3793,6 +3839,64 @@ export interface TaxUpdateInput {
3793
3839
  }
3794
3840
  /** @example "America/Los_Angeles" */
3795
3841
  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";
3842
+ export interface UsageThresholdInput {
3843
+ /**
3844
+ * Unique identifier of the usage threshold created by Lago.
3845
+ * @format uuid
3846
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3847
+ */
3848
+ id?: string | null;
3849
+ /**
3850
+ * The display name of the usage threshold.
3851
+ * @example "Threshold 1"
3852
+ */
3853
+ threshold_display_name?: string | null;
3854
+ /**
3855
+ * The amount to reach to trigger a `progressive_billing` invoice.
3856
+ * @example 10000
3857
+ */
3858
+ amount_cents: number;
3859
+ /**
3860
+ * 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.
3861
+ * @example true
3862
+ */
3863
+ recurring: boolean;
3864
+ }
3865
+ export interface UsageThresholdObject {
3866
+ /**
3867
+ * Unique identifier of the usage threshold created by Lago.
3868
+ * @format uuid
3869
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3870
+ */
3871
+ lago_id: string;
3872
+ /**
3873
+ * The display name of the usage threshold.
3874
+ * @example "Threshold 1"
3875
+ */
3876
+ threshold_display_name?: string | null;
3877
+ /**
3878
+ * The amount to reach to trigger a `progressive_billing` invoice.
3879
+ * @example 10000
3880
+ */
3881
+ amount_cents: number;
3882
+ /**
3883
+ * 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.
3884
+ * @example true
3885
+ */
3886
+ recurring: boolean;
3887
+ /**
3888
+ * The date and time when the usage threshold was created. It is expressed in UTC format according to the ISO 8601 datetime standard.
3889
+ * @format date-time
3890
+ * @example "2023-06-27T19:43:42Z"
3891
+ */
3892
+ created_at: string;
3893
+ /**
3894
+ * The date and time when the usage threshold was last updated. It is expressed in UTC format according to the ISO 8601 datetime standard.
3895
+ * @format date-time
3896
+ * @example "2023-06-27T19:43:42Z"
3897
+ */
3898
+ updated_at: string;
3899
+ }
3796
3900
  export interface Wallet {
3797
3901
  wallet: WalletObject;
3798
3902
  }
@@ -4440,7 +4544,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
4440
4544
  }
4441
4545
  /**
4442
4546
  * @title Lago API documentation
4443
- * @version 1.9.0
4547
+ * @version 1.10.0
4444
4548
  * @license AGPLv3
4445
4549
  * @baseUrl https://{region}.getlago.com/api/v1
4446
4550
  * @externalDocs https://github.com/getlago
@@ -5349,6 +5453,16 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
5349
5453
  * @secure
5350
5454
  */
5351
5455
  refreshInvoice: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiErrorUnauthorized | ApiErrorNotFound>>;
5456
+ /**
5457
+ * @description This endpoint is used for retrying to generate a failed invoice.
5458
+ *
5459
+ * @tags invoices
5460
+ * @name RetryInvoice
5461
+ * @summary Retry generation of a failed invoice
5462
+ * @request POST:/invoices/{lago_id}/retry
5463
+ * @secure
5464
+ */
5465
+ retryInvoice: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiErrorUnauthorized | ApiErrorNotFound>>;
5352
5466
  /**
5353
5467
  * @description This endpoint generates a checkout link for a specific invoice.
5354
5468
  *
@@ -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.10.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
  *