lago-javascript-client 1.7.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.
@@ -559,6 +572,15 @@ export interface ChargeObject {
559
572
  * @example true
560
573
  */
561
574
  invoiceable?: boolean;
575
+ /**
576
+ * This setting can only be configured if `pay_in_advance` is `true` and `invoiceable` is `false`.
577
+ * This field determines whether and when the charge fee should be included in
578
+ * the invoice. If `null`, no invoice will be issued for this charge fee.
579
+ * If `invoice`, an invoice will be generated at the end of the period,
580
+ * consolidating all charge fees with a succeeded payment status.
581
+ * @example "invoice"
582
+ */
583
+ regroup_paid_fees?: "invoice" | null;
562
584
  /**
563
585
  * Specifies whether a charge is prorated based on the remaining number of days in the billing period or billed fully.
564
586
  *
@@ -1081,17 +1103,17 @@ export interface CreditObject {
1081
1103
  */
1082
1104
  lago_item_id: string;
1083
1105
  /**
1084
- * 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).
1085
1107
  * @example "coupon"
1086
1108
  */
1087
- type: "coupon" | "credit_note";
1109
+ type: "coupon" | "credit_note" | "invoice";
1088
1110
  /**
1089
- * 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.
1090
1112
  * @example "startup_deal"
1091
1113
  */
1092
1114
  code: string;
1093
1115
  /**
1094
- * 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.
1095
1117
  * @example "Startup Deal"
1096
1118
  */
1097
1119
  name: string;
@@ -1400,7 +1422,7 @@ export interface CustomerBillingConfiguration {
1400
1422
  */
1401
1423
  document_locale?: string;
1402
1424
  /**
1403
- * 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.
1404
1426
  * @example ["card","sepa_debit"]
1405
1427
  */
1406
1428
  provider_payment_methods?: string[] | null;
@@ -1927,7 +1949,26 @@ export interface Event {
1927
1949
  event: EventObject;
1928
1950
  }
1929
1951
  export interface EventBatchInput {
1930
- events: {
1952
+ events: any[];
1953
+ }
1954
+ export interface EventEstimateFeesInput {
1955
+ event: {
1956
+ /**
1957
+ * The code that identifies a targeted billable metric. It is essential that this code matches the `code` property of one of your active billable metrics. If the provided code does not correspond to any active billable metric, it will be ignored during the process.
1958
+ * @example "storage"
1959
+ */
1960
+ code: string;
1961
+ /**
1962
+ * The unique identifier of the subscription within your application.
1963
+ * @example "sub_1234567890"
1964
+ */
1965
+ external_subscription_id: string;
1966
+ /** This field represents additional properties associated with the event, which are utilized in the calculation of the final fee. This object becomes mandatory when the targeted billable metric employs a `sum_agg`, `max_agg`, or `unique_count_agg` aggregation method. However, when using a simple `count_agg`, this object is not required. */
1967
+ properties?: object;
1968
+ };
1969
+ }
1970
+ export interface EventInput {
1971
+ event: {
1931
1972
  /**
1932
1973
  * This field represents a unique identifier for the event. It is crucial for ensuring idempotency, meaning that each event can be uniquely identified and processed without causing any unintended side effects.
1933
1974
  * @example "transaction_1234567890"
@@ -1955,27 +1996,8 @@ export interface EventBatchInput {
1955
1996
  * @example {"gb":10}
1956
1997
  */
1957
1998
  properties?: Record<string, string | number>;
1958
- }[];
1959
- }
1960
- export interface EventEstimateFeesInput {
1961
- event: {
1962
- /**
1963
- * The code that identifies a targeted billable metric. It is essential that this code matches the `code` property of one of your active billable metrics. If the provided code does not correspond to any active billable metric, it will be ignored during the process.
1964
- * @example "storage"
1965
- */
1966
- code: string;
1967
- /**
1968
- * The unique identifier of the subscription within your application.
1969
- * @example "sub_1234567890"
1970
- */
1971
- external_subscription_id: string;
1972
- /** This field represents additional properties associated with the event, which are utilized in the calculation of the final fee. This object becomes mandatory when the targeted billable metric employs a `sum_agg`, `max_agg`, or `unique_count_agg` aggregation method. However, when using a simple `count_agg`, this object is not required. */
1973
- properties?: object;
1974
1999
  };
1975
2000
  }
1976
- export interface EventInput {
1977
- event: any;
1978
- }
1979
2001
  export interface EventObject {
1980
2002
  /**
1981
2003
  * Unique identifier assigned to the event within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the event's record within the Lago system
@@ -2663,18 +2685,19 @@ export interface InvoiceObject {
2663
2685
  */
2664
2686
  net_payment_term?: number;
2665
2687
  /**
2666
- * 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`.
2667
2689
  * @example "subscription"
2668
2690
  */
2669
- invoice_type: "subscription" | "add_on" | "credit" | "one_off";
2691
+ invoice_type: "subscription" | "add_on" | "credit" | "one_off" | "progressive_billing";
2670
2692
  /**
2671
2693
  * The status of the invoice. It indicates the current state of the invoice and can have two possible values:
2672
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.
2673
2695
  * - `finalized`: the invoice has been issued and finalized. In this state, events cannot be ingested or added to the invoice anymore.
2674
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.
2675
2698
  * @example "finalized"
2676
2699
  */
2677
- status: "draft" | "finalized" | "voided";
2700
+ status: "draft" | "finalized" | "voided" | "failed";
2678
2701
  /**
2679
2702
  * The status of the payment associated with the invoice. It can have one of the following values:
2680
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.
@@ -2705,7 +2728,7 @@ export interface InvoiceObject {
2705
2728
  * This field depends on the version number. Here are the definitions based on the version:
2706
2729
  * - Version 1: is equal to the sum of `fees_amount_cents`, minus `coupons_amount_cents`, and minus `prepaid_credit_amount_cents`.
2707
2730
  * - Version 2: is equal to the `fees_amount_cents`.
2708
- * - 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`
2709
2732
  * @example 100
2710
2733
  */
2711
2734
  sub_total_excluding_taxes_amount_cents: number;
@@ -2719,7 +2742,7 @@ export interface InvoiceObject {
2719
2742
  * This field depends on the version number. Here are the definitions based on the version:
2720
2743
  * - Version 1: is equal to the `total_amount_cents`.
2721
2744
  * - Version 2: is equal to the sum of `fees_amount_cents` and `taxes_amount_cents`.
2722
- * - 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`
2723
2746
  * @example 120
2724
2747
  */
2725
2748
  sub_total_including_taxes_amount_cents: number;
@@ -2728,6 +2751,11 @@ export interface InvoiceObject {
2728
2751
  * @example 0
2729
2752
  */
2730
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;
2731
2759
  /**
2732
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.
2733
2761
  * @example 100
@@ -2745,11 +2773,30 @@ export interface InvoiceObject {
2745
2773
  customer?: CustomerObject;
2746
2774
  metadata?: InvoiceMetadataObject[];
2747
2775
  applied_taxes?: InvoiceAppliedTaxObject[];
2776
+ applied_usage_thresholds?: AppliedUsageThresholdObject[] | null;
2748
2777
  }
2749
2778
  export type InvoiceObjectExtended = InvoiceObject & {
2750
2779
  credits?: CreditObject[];
2751
2780
  fees?: FeeObject[];
2752
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
+ }[];
2753
2800
  };
2754
2801
  export interface InvoiceOneOffCreateInput {
2755
2802
  invoice: {
@@ -3150,7 +3197,7 @@ export interface PlanCreateInput {
3150
3197
  minimum_commitment?: MinimumCommitmentInput;
3151
3198
  /**
3152
3199
  * Additional usage-based charges for this plan.
3153
- * @example [{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","charge_model":"package","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"tax_codes":["french_standard_vat"]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","charge_model":"graduated","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"to_value":10,"from_value":0,"flat_amount":"10","per_unit_amount":"0.5"},{"to_value":null,"from_value":11,"flat_amount":"0","per_unit_amount":"0.4"}]}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","charge_model":"standard","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","charge_model":"volume","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","charge_model":"percentage","invoiceable":false,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"}}]
3200
+ * @example [{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","charge_model":"package","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"regroup_paid_fees":null,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"tax_codes":["french_standard_vat"]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","charge_model":"graduated","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"to_value":10,"from_value":0,"flat_amount":"10","per_unit_amount":"0.5"},{"to_value":null,"from_value":11,"flat_amount":"0","per_unit_amount":"0.4"}]}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","charge_model":"standard","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","charge_model":"volume","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","charge_model":"percentage","invoiceable":false,"invoice_display_name":"Setup","pay_in_advance":true,"regroup_paid_fees":"invoice","prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"}}]
3154
3201
  */
3155
3202
  charges?: {
3156
3203
  /**
@@ -3174,6 +3221,15 @@ export interface PlanCreateInput {
3174
3221
  * @example true
3175
3222
  */
3176
3223
  invoiceable?: boolean;
3224
+ /**
3225
+ * This setting can only be configured if `pay_in_advance` is `true` and `invoiceable` is `false`.
3226
+ * This field determines whether and when the charge fee should be included in
3227
+ * the invoice. If `null`, no invoice will be issued for this charge fee.
3228
+ * If `invoice`, an invoice will be generated at the end of the period,
3229
+ * consolidating all charge fees with a succeeded payment status.
3230
+ * @example "invoice"
3231
+ */
3232
+ regroup_paid_fees?: "invoice" | null;
3177
3233
  /**
3178
3234
  * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
3179
3235
  * @example "Setup"
@@ -3203,6 +3259,8 @@ export interface PlanCreateInput {
3203
3259
  */
3204
3260
  tax_codes?: string[];
3205
3261
  }[];
3262
+ /** List of usage thresholds to apply to the plan. */
3263
+ usage_thresholds?: UsageThresholdInput[];
3206
3264
  };
3207
3265
  }
3208
3266
  /** Based plan overrides. */
@@ -3274,6 +3332,8 @@ export interface PlanOverridesObject {
3274
3332
  */
3275
3333
  tax_codes?: string[];
3276
3334
  }[];
3335
+ /** List of usage thresholds applied to the subscription. */
3336
+ usage_thresholds?: UsageThresholdObject[];
3277
3337
  }
3278
3338
  export interface PlanUpdateInput {
3279
3339
  plan: {
@@ -3333,7 +3393,7 @@ export interface PlanUpdateInput {
3333
3393
  minimum_commitment?: MinimumCommitmentInput;
3334
3394
  /**
3335
3395
  * Additional usage-based charges for this plan.
3336
- * @example [{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","charge_model":"package","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"tax_codes":["french_standard_vat"]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","charge_model":"graduated","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"to_value":10,"from_value":0,"flat_amount":"10","per_unit_amount":"0.5"},{"to_value":null,"from_value":11,"flat_amount":"0","per_unit_amount":"0.4"}]}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","charge_model":"standard","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","charge_model":"volume","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","charge_model":"percentage","invoiceable":false,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"}}]
3396
+ * @example [{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","charge_model":"package","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"tax_codes":["french_standard_vat"]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","charge_model":"graduated","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"to_value":10,"from_value":0,"flat_amount":"10","per_unit_amount":"0.5"},{"to_value":null,"from_value":11,"flat_amount":"0","per_unit_amount":"0.4"}]}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","charge_model":"standard","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":true,"regroup_paid_fees":null,"prorated":false,"min_amount_cents":0,"properties":{}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","charge_model":"volume","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","charge_model":"percentage","invoiceable":false,"invoice_display_name":"Setup","pay_in_advance":true,"regroup_paid_fees":"invoice","prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"}}]
3337
3397
  */
3338
3398
  charges?: {
3339
3399
  /**
@@ -3363,6 +3423,15 @@ export interface PlanUpdateInput {
3363
3423
  * @example true
3364
3424
  */
3365
3425
  invoiceable?: boolean;
3426
+ /**
3427
+ * This setting can only be configured if `pay_in_advance` is `true` and `invoiceable` is `false`.
3428
+ * This field determines whether and when the charge fee should be included in
3429
+ * the invoice. If `null`, no invoice will be issued for this charge fee.
3430
+ * If `invoice`, an invoice will be generated at the end of the period,
3431
+ * consolidating all charge fees with a succeeded payment status.
3432
+ * @example "invoice"
3433
+ */
3434
+ regroup_paid_fees?: "invoice" | null;
3366
3435
  /**
3367
3436
  * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
3368
3437
  * @example "Setup"
@@ -3392,6 +3461,8 @@ export interface PlanUpdateInput {
3392
3461
  */
3393
3462
  tax_codes?: string[];
3394
3463
  }[];
3464
+ /** List of usage thresholds to apply to the plan. */
3465
+ usage_thresholds?: UsageThresholdInput[];
3395
3466
  };
3396
3467
  }
3397
3468
  export interface PlanObject {
@@ -3467,11 +3538,13 @@ export interface PlanObject {
3467
3538
  minimum_commitment?: MinimumCommitmentObject;
3468
3539
  /**
3469
3540
  * Additional usage-based charges for this plan.
3470
- * @example [{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","billable_metric_code":"requests","created_at":"2023-06-27T19:43:42Z","charge_model":"package","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"filters":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","billable_metric_code":"cpu","created_at":"2023-06-27T19:43:42Z","charge_model":"graduated","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"from_value":0,"to_value":10,"flat_amount":"10","per_unit_amount":"0.5"},{"from_value":11,"to_value":null,"flat_amount":"0","per_unit_amount":"0.4"}]},"filters":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","billable_metric_code":"seats","created_at":"2023-06-27T19:43:42Z","charge_model":"standard","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{},"filters":[{"invoice_display_name":"Europe","properties":{"amount":"10"},"values":{"region":["Europe"]}},{"invoice_display_name":"USA","properties":{"amount":"5"},"values":{"region":["USA"]}},{"invoice_display_name":"Africa","properties":{"amount":"8"},"values":{"region":["Africa"]}}]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","billable_metric_code":"storage","created_at":"2023-06-27T19:43:42Z","charge_model":"volume","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]},"filters":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","billable_metric_code":"payments","created_at":"2023-06-27T19:43:42Z","charge_model":"percentage","invoiceable":false,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"},"filters":[]}]
3541
+ * @example [{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","billable_metric_code":"requests","created_at":"2023-06-27T19:43:42Z","charge_model":"package","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"regroup_paid_fees":null,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"filters":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","billable_metric_code":"cpu","created_at":"2023-06-27T19:43:42Z","charge_model":"graduated","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"from_value":0,"to_value":10,"flat_amount":"10","per_unit_amount":"0.5"},{"from_value":11,"to_value":null,"flat_amount":"0","per_unit_amount":"0.4"}]},"filters":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","billable_metric_code":"seats","created_at":"2023-06-27T19:43:42Z","charge_model":"standard","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{},"filters":[{"invoice_display_name":"Europe","properties":{"amount":"10"},"values":{"region":["Europe"]}},{"invoice_display_name":"USA","properties":{"amount":"5"},"values":{"region":["USA"]}},{"invoice_display_name":"Africa","properties":{"amount":"8"},"values":{"region":["Africa"]}}]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","billable_metric_code":"storage","created_at":"2023-06-27T19:43:42Z","charge_model":"volume","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]},"filters":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","billable_metric_code":"payments","created_at":"2023-06-27T19:43:42Z","charge_model":"percentage","invoiceable":false,"invoice_display_name":"Setup","pay_in_advance":true,"regroup_paid_fees":"invoice","prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"},"filters":[]}]
3471
3542
  */
3472
3543
  charges?: ChargeObject[];
3473
3544
  /** All taxes applied to the plan. */
3474
3545
  taxes?: TaxObject[];
3546
+ /** List of usage thresholds applied to the plan. */
3547
+ usage_thresholds?: UsageThresholdObject[];
3475
3548
  }
3476
3549
  export interface PlansPaginated {
3477
3550
  plans: PlanObject[];
@@ -3766,6 +3839,64 @@ export interface TaxUpdateInput {
3766
3839
  }
3767
3840
  /** @example "America/Los_Angeles" */
3768
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
+ }
3769
3900
  export interface Wallet {
3770
3901
  wallet: WalletObject;
3771
3902
  }
@@ -3807,6 +3938,21 @@ export interface WalletCreateInput {
3807
3938
  * @example "2022-07-07T23:59:59Z"
3808
3939
  */
3809
3940
  expiration_at?: string | null;
3941
+ /**
3942
+ * A boolean setting that, when set to true, delays issuing an invoice for a wallet top-up until a successful payment is made; if false, the invoice is issued immediately upon wallet top-up, regardless of the payment status. Default value of false.
3943
+ * @example false
3944
+ */
3945
+ invoice_requires_successful_payment?: boolean;
3946
+ /**
3947
+ * This optional field allows you to store a list of key-value pairs that provide additional information or custom attributes. These key-value pairs will be included in the metadata of wallet transactions generated during the wallet creation process.
3948
+ * @example [{"key":"example_key","value":"example_value"},{"key":"another_key","value":"another_value"}]
3949
+ */
3950
+ transaction_metadata?: {
3951
+ /** The unique identifier for the attribute. */
3952
+ key?: string;
3953
+ /** The corresponding value for the key. */
3954
+ value?: string;
3955
+ }[];
3810
3956
  /** List of recurring transaction rules. Currently, we only allow one recurring rule per wallet. */
3811
3957
  recurring_transaction_rules?: {
3812
3958
  /**
@@ -3854,6 +4000,21 @@ export interface WalletCreateInput {
3854
4000
  * @example "200.0"
3855
4001
  */
3856
4002
  target_ongoing_balance?: string;
4003
+ /**
4004
+ * A boolean setting that, when set to true, delays issuing an invoice for a wallet top-up until a successful payment is made; if false, the invoice is issued immediately upon wallet top-up, regardless of the payment status. Default value of false.
4005
+ * @example false
4006
+ */
4007
+ invoice_requires_successful_payment?: boolean;
4008
+ /**
4009
+ * This optional field allows you to store a list of key-value pairs containing additional information or custom attributes. These key-value pairs will populate the metadata of the wallet transactions triggered by this rule.
4010
+ * @example [{"key":"example_key","value":"example_value"},{"key":"another_key","value":"another_value"}]
4011
+ */
4012
+ transaction_metadata?: {
4013
+ /** The unique identifier for the attribute. */
4014
+ key?: string;
4015
+ /** The value associated with the key. */
4016
+ value?: string;
4017
+ }[];
3857
4018
  }[];
3858
4019
  };
3859
4020
  }
@@ -3940,6 +4101,11 @@ export interface WalletObject {
3940
4101
  * @example "2022-09-14T16:35:31Z"
3941
4102
  */
3942
4103
  terminated_at?: string | null;
4104
+ /**
4105
+ * A boolean setting that, when set to true, delays issuing an invoice for a wallet top-up until a successful payment is made; if false, the invoice is issued immediately upon wallet top-up, regardless of the payment status. Default value of false.
4106
+ * @example false
4107
+ */
4108
+ invoice_requires_successful_payment?: boolean;
3943
4109
  /** List of recurring transaction rules. Currently, we only allow one recurring rule per wallet. */
3944
4110
  recurring_transaction_rules?: {
3945
4111
  /**
@@ -3999,6 +4165,21 @@ export interface WalletObject {
3999
4165
  * @example "2022-04-29T08:59:51Z"
4000
4166
  */
4001
4167
  created_at: string;
4168
+ /**
4169
+ * A boolean setting that, when set to true, delays issuing an invoice for a wallet top-up until a successful payment is made; if false, the invoice is issued immediately upon wallet top-up, regardless of the payment status. Default value of false.
4170
+ * @example false
4171
+ */
4172
+ invoice_requires_successful_payment?: boolean;
4173
+ /**
4174
+ * This field allows you to store a list of key-value pairs containing additional information or custom attributes. These key-value pairs will populate the metadata of the wallet transactions triggered by this rule.
4175
+ * @example [{"key":"example_key","value":"example_value"},{"key":"another_key","value":"another_value"}]
4176
+ */
4177
+ transaction_metadata?: {
4178
+ /** The unique identifier for the attribute. */
4179
+ key?: string;
4180
+ /** The value associated with the key. */
4181
+ value?: string;
4182
+ }[];
4002
4183
  }[];
4003
4184
  /**
4004
4185
  * The wallet ongoing balance expressed in cents.
@@ -4053,6 +4234,21 @@ export interface WalletTransactionCreateInput {
4053
4234
  * @example "5.0"
4054
4235
  */
4055
4236
  voided_credits?: string;
4237
+ /**
4238
+ * A boolean setting that, when set to true, delays issuing an invoice for a wallet top-up until a successful payment is made; if false, the invoice is issued immediately upon wallet top-up, regardless of the payment status. Default value of false.
4239
+ * @example false
4240
+ */
4241
+ invoice_requires_successful_payment?: boolean;
4242
+ /**
4243
+ * This optional field allows you to store a list of key-value pairs that hold additional information or custom attributes related to the data.
4244
+ * @example [{"key":"example key","value":"example value"},{"key":"another key","value":"another value"}]
4245
+ */
4246
+ metadata?: {
4247
+ /** The unique identifier for the attribute. */
4248
+ key?: string;
4249
+ /** The value associated with the key. */
4250
+ value?: string;
4251
+ }[];
4056
4252
  };
4057
4253
  }
4058
4254
  export interface WalletTransactionObject {
@@ -4073,6 +4269,11 @@ export interface WalletTransactionObject {
4073
4269
  * @example "settled"
4074
4270
  */
4075
4271
  status: "pending" | "settled";
4272
+ /**
4273
+ * The source field represents the origin or trigger of the wallet transaction. Possible values are `manual`, `interval`. `threshold`
4274
+ * @example "manual"
4275
+ */
4276
+ source?: "manual" | "interval" | "threshold";
4076
4277
  /**
4077
4278
  * The transaction status of the wallet transaction. Possible values are `purchased` (with pending or settled status), `granted` (without invoice_id), `voided` or `invoiced`.
4078
4279
  * @example "purchased"
@@ -4095,6 +4296,21 @@ export interface WalletTransactionObject {
4095
4296
  * @example "100.0"
4096
4297
  */
4097
4298
  credit_amount: string;
4299
+ /**
4300
+ * A boolean setting that, when set to true, delays issuing an invoice for a wallet top-up until a successful payment is made; if false, the invoice is issued immediately upon wallet top-up, regardless of the payment status. Default value of false.
4301
+ * @example false
4302
+ */
4303
+ invoice_requires_successful_payment?: boolean;
4304
+ /**
4305
+ * This field allows you to store a list of key-value pairs that hold additional information or custom attributes related to the data.
4306
+ * @example [{"key":"example key","value":"example value"},{"key":"another key","value":"another value"}]
4307
+ */
4308
+ metadata?: {
4309
+ /** The unique identifier for the attribute. */
4310
+ key?: string;
4311
+ /** The value associated with the key. */
4312
+ value?: string;
4313
+ }[];
4098
4314
  /**
4099
4315
  * The date when wallet transaction is settled, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
4100
4316
  * @format date-time
@@ -4127,6 +4343,11 @@ export interface WalletUpdateInput {
4127
4343
  * @example "2022-07-07T23:59:59Z"
4128
4344
  */
4129
4345
  expiration_at?: string | null;
4346
+ /**
4347
+ * A boolean setting that, when set to true, delays issuing an invoice for a wallet top-up until a successful payment is made; if false, the invoice is issued immediately upon wallet top-up, regardless of the payment status. Default value of false.
4348
+ * @example false
4349
+ */
4350
+ invoice_requires_successful_payment?: boolean;
4130
4351
  /** List of recurring transaction rules. Currently, we only allow one recurring rule per wallet. */
4131
4352
  recurring_transaction_rules?: {
4132
4353
  /**
@@ -4180,6 +4401,21 @@ export interface WalletUpdateInput {
4180
4401
  * @example "200.0"
4181
4402
  */
4182
4403
  target_ongoing_balance?: string;
4404
+ /**
4405
+ * A boolean setting that, when set to true, delays issuing an invoice for a wallet top-up until a successful payment is made; if false, the invoice is issued immediately upon wallet top-up, regardless of the payment status. Default value of false.
4406
+ * @example false
4407
+ */
4408
+ invoice_requires_successful_payment?: boolean;
4409
+ /**
4410
+ * This optional field allows you to store a list of key-value pairs containing additional information or custom attributes. These key-value pairs will populate the metadata of the wallet transactions triggered by this rule.
4411
+ * @example [{"key":"example_key","value":"example_value"},{"key":"another_key","value":"another_value"}]
4412
+ */
4413
+ transaction_metadata?: {
4414
+ /** The unique identifier for the attribute. */
4415
+ key?: string;
4416
+ /** The value associated with the key. */
4417
+ value?: string;
4418
+ }[];
4183
4419
  }[];
4184
4420
  };
4185
4421
  }
@@ -4308,7 +4544,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
4308
4544
  }
4309
4545
  /**
4310
4546
  * @title Lago API documentation
4311
- * @version 1.7.0
4547
+ * @version 1.10.0
4312
4548
  * @license AGPLv3
4313
4549
  * @baseUrl https://{region}.getlago.com/api/v1
4314
4550
  * @externalDocs https://github.com/getlago
@@ -5217,6 +5453,16 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
5217
5453
  * @secure
5218
5454
  */
5219
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>>;
5220
5466
  /**
5221
5467
  * @description This endpoint generates a checkout link for a specific invoice.
5222
5468
  *
@@ -148,7 +148,7 @@ export class HttpClient {
148
148
  }
149
149
  /**
150
150
  * @title Lago API documentation
151
- * @version 1.7.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.7.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.
@@ -559,6 +572,15 @@ export interface ChargeObject {
559
572
  * @example true
560
573
  */
561
574
  invoiceable?: boolean;
575
+ /**
576
+ * This setting can only be configured if `pay_in_advance` is `true` and `invoiceable` is `false`.
577
+ * This field determines whether and when the charge fee should be included in
578
+ * the invoice. If `null`, no invoice will be issued for this charge fee.
579
+ * If `invoice`, an invoice will be generated at the end of the period,
580
+ * consolidating all charge fees with a succeeded payment status.
581
+ * @example "invoice"
582
+ */
583
+ regroup_paid_fees?: "invoice" | null;
562
584
  /**
563
585
  * Specifies whether a charge is prorated based on the remaining number of days in the billing period or billed fully.
564
586
  *
@@ -1081,17 +1103,17 @@ export interface CreditObject {
1081
1103
  */
1082
1104
  lago_item_id: string;
1083
1105
  /**
1084
- * 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).
1085
1107
  * @example "coupon"
1086
1108
  */
1087
- type: "coupon" | "credit_note";
1109
+ type: "coupon" | "credit_note" | "invoice";
1088
1110
  /**
1089
- * 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.
1090
1112
  * @example "startup_deal"
1091
1113
  */
1092
1114
  code: string;
1093
1115
  /**
1094
- * 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.
1095
1117
  * @example "Startup Deal"
1096
1118
  */
1097
1119
  name: string;
@@ -1400,7 +1422,7 @@ export interface CustomerBillingConfiguration {
1400
1422
  */
1401
1423
  document_locale?: string;
1402
1424
  /**
1403
- * 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.
1404
1426
  * @example ["card","sepa_debit"]
1405
1427
  */
1406
1428
  provider_payment_methods?: string[] | null;
@@ -1927,7 +1949,26 @@ export interface Event {
1927
1949
  event: EventObject;
1928
1950
  }
1929
1951
  export interface EventBatchInput {
1930
- events: {
1952
+ events: any[];
1953
+ }
1954
+ export interface EventEstimateFeesInput {
1955
+ event: {
1956
+ /**
1957
+ * The code that identifies a targeted billable metric. It is essential that this code matches the `code` property of one of your active billable metrics. If the provided code does not correspond to any active billable metric, it will be ignored during the process.
1958
+ * @example "storage"
1959
+ */
1960
+ code: string;
1961
+ /**
1962
+ * The unique identifier of the subscription within your application.
1963
+ * @example "sub_1234567890"
1964
+ */
1965
+ external_subscription_id: string;
1966
+ /** This field represents additional properties associated with the event, which are utilized in the calculation of the final fee. This object becomes mandatory when the targeted billable metric employs a `sum_agg`, `max_agg`, or `unique_count_agg` aggregation method. However, when using a simple `count_agg`, this object is not required. */
1967
+ properties?: object;
1968
+ };
1969
+ }
1970
+ export interface EventInput {
1971
+ event: {
1931
1972
  /**
1932
1973
  * This field represents a unique identifier for the event. It is crucial for ensuring idempotency, meaning that each event can be uniquely identified and processed without causing any unintended side effects.
1933
1974
  * @example "transaction_1234567890"
@@ -1955,27 +1996,8 @@ export interface EventBatchInput {
1955
1996
  * @example {"gb":10}
1956
1997
  */
1957
1998
  properties?: Record<string, string | number>;
1958
- }[];
1959
- }
1960
- export interface EventEstimateFeesInput {
1961
- event: {
1962
- /**
1963
- * The code that identifies a targeted billable metric. It is essential that this code matches the `code` property of one of your active billable metrics. If the provided code does not correspond to any active billable metric, it will be ignored during the process.
1964
- * @example "storage"
1965
- */
1966
- code: string;
1967
- /**
1968
- * The unique identifier of the subscription within your application.
1969
- * @example "sub_1234567890"
1970
- */
1971
- external_subscription_id: string;
1972
- /** This field represents additional properties associated with the event, which are utilized in the calculation of the final fee. This object becomes mandatory when the targeted billable metric employs a `sum_agg`, `max_agg`, or `unique_count_agg` aggregation method. However, when using a simple `count_agg`, this object is not required. */
1973
- properties?: object;
1974
1999
  };
1975
2000
  }
1976
- export interface EventInput {
1977
- event: any;
1978
- }
1979
2001
  export interface EventObject {
1980
2002
  /**
1981
2003
  * Unique identifier assigned to the event within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the event's record within the Lago system
@@ -2663,18 +2685,19 @@ export interface InvoiceObject {
2663
2685
  */
2664
2686
  net_payment_term?: number;
2665
2687
  /**
2666
- * 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`.
2667
2689
  * @example "subscription"
2668
2690
  */
2669
- invoice_type: "subscription" | "add_on" | "credit" | "one_off";
2691
+ invoice_type: "subscription" | "add_on" | "credit" | "one_off" | "progressive_billing";
2670
2692
  /**
2671
2693
  * The status of the invoice. It indicates the current state of the invoice and can have two possible values:
2672
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.
2673
2695
  * - `finalized`: the invoice has been issued and finalized. In this state, events cannot be ingested or added to the invoice anymore.
2674
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.
2675
2698
  * @example "finalized"
2676
2699
  */
2677
- status: "draft" | "finalized" | "voided";
2700
+ status: "draft" | "finalized" | "voided" | "failed";
2678
2701
  /**
2679
2702
  * The status of the payment associated with the invoice. It can have one of the following values:
2680
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.
@@ -2705,7 +2728,7 @@ export interface InvoiceObject {
2705
2728
  * This field depends on the version number. Here are the definitions based on the version:
2706
2729
  * - Version 1: is equal to the sum of `fees_amount_cents`, minus `coupons_amount_cents`, and minus `prepaid_credit_amount_cents`.
2707
2730
  * - Version 2: is equal to the `fees_amount_cents`.
2708
- * - 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`
2709
2732
  * @example 100
2710
2733
  */
2711
2734
  sub_total_excluding_taxes_amount_cents: number;
@@ -2719,7 +2742,7 @@ export interface InvoiceObject {
2719
2742
  * This field depends on the version number. Here are the definitions based on the version:
2720
2743
  * - Version 1: is equal to the `total_amount_cents`.
2721
2744
  * - Version 2: is equal to the sum of `fees_amount_cents` and `taxes_amount_cents`.
2722
- * - 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`
2723
2746
  * @example 120
2724
2747
  */
2725
2748
  sub_total_including_taxes_amount_cents: number;
@@ -2728,6 +2751,11 @@ export interface InvoiceObject {
2728
2751
  * @example 0
2729
2752
  */
2730
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;
2731
2759
  /**
2732
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.
2733
2761
  * @example 100
@@ -2745,11 +2773,30 @@ export interface InvoiceObject {
2745
2773
  customer?: CustomerObject;
2746
2774
  metadata?: InvoiceMetadataObject[];
2747
2775
  applied_taxes?: InvoiceAppliedTaxObject[];
2776
+ applied_usage_thresholds?: AppliedUsageThresholdObject[] | null;
2748
2777
  }
2749
2778
  export type InvoiceObjectExtended = InvoiceObject & {
2750
2779
  credits?: CreditObject[];
2751
2780
  fees?: FeeObject[];
2752
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
+ }[];
2753
2800
  };
2754
2801
  export interface InvoiceOneOffCreateInput {
2755
2802
  invoice: {
@@ -3150,7 +3197,7 @@ export interface PlanCreateInput {
3150
3197
  minimum_commitment?: MinimumCommitmentInput;
3151
3198
  /**
3152
3199
  * Additional usage-based charges for this plan.
3153
- * @example [{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","charge_model":"package","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"tax_codes":["french_standard_vat"]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","charge_model":"graduated","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"to_value":10,"from_value":0,"flat_amount":"10","per_unit_amount":"0.5"},{"to_value":null,"from_value":11,"flat_amount":"0","per_unit_amount":"0.4"}]}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","charge_model":"standard","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","charge_model":"volume","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","charge_model":"percentage","invoiceable":false,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"}}]
3200
+ * @example [{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","charge_model":"package","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"regroup_paid_fees":null,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"tax_codes":["french_standard_vat"]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","charge_model":"graduated","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"to_value":10,"from_value":0,"flat_amount":"10","per_unit_amount":"0.5"},{"to_value":null,"from_value":11,"flat_amount":"0","per_unit_amount":"0.4"}]}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","charge_model":"standard","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","charge_model":"volume","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","charge_model":"percentage","invoiceable":false,"invoice_display_name":"Setup","pay_in_advance":true,"regroup_paid_fees":"invoice","prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"}}]
3154
3201
  */
3155
3202
  charges?: {
3156
3203
  /**
@@ -3174,6 +3221,15 @@ export interface PlanCreateInput {
3174
3221
  * @example true
3175
3222
  */
3176
3223
  invoiceable?: boolean;
3224
+ /**
3225
+ * This setting can only be configured if `pay_in_advance` is `true` and `invoiceable` is `false`.
3226
+ * This field determines whether and when the charge fee should be included in
3227
+ * the invoice. If `null`, no invoice will be issued for this charge fee.
3228
+ * If `invoice`, an invoice will be generated at the end of the period,
3229
+ * consolidating all charge fees with a succeeded payment status.
3230
+ * @example "invoice"
3231
+ */
3232
+ regroup_paid_fees?: "invoice" | null;
3177
3233
  /**
3178
3234
  * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
3179
3235
  * @example "Setup"
@@ -3203,6 +3259,8 @@ export interface PlanCreateInput {
3203
3259
  */
3204
3260
  tax_codes?: string[];
3205
3261
  }[];
3262
+ /** List of usage thresholds to apply to the plan. */
3263
+ usage_thresholds?: UsageThresholdInput[];
3206
3264
  };
3207
3265
  }
3208
3266
  /** Based plan overrides. */
@@ -3274,6 +3332,8 @@ export interface PlanOverridesObject {
3274
3332
  */
3275
3333
  tax_codes?: string[];
3276
3334
  }[];
3335
+ /** List of usage thresholds applied to the subscription. */
3336
+ usage_thresholds?: UsageThresholdObject[];
3277
3337
  }
3278
3338
  export interface PlanUpdateInput {
3279
3339
  plan: {
@@ -3333,7 +3393,7 @@ export interface PlanUpdateInput {
3333
3393
  minimum_commitment?: MinimumCommitmentInput;
3334
3394
  /**
3335
3395
  * Additional usage-based charges for this plan.
3336
- * @example [{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","charge_model":"package","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"tax_codes":["french_standard_vat"]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","charge_model":"graduated","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"to_value":10,"from_value":0,"flat_amount":"10","per_unit_amount":"0.5"},{"to_value":null,"from_value":11,"flat_amount":"0","per_unit_amount":"0.4"}]}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","charge_model":"standard","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","charge_model":"volume","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","charge_model":"percentage","invoiceable":false,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"}}]
3396
+ * @example [{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","charge_model":"package","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"tax_codes":["french_standard_vat"]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","charge_model":"graduated","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"to_value":10,"from_value":0,"flat_amount":"10","per_unit_amount":"0.5"},{"to_value":null,"from_value":11,"flat_amount":"0","per_unit_amount":"0.4"}]}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","charge_model":"standard","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":true,"regroup_paid_fees":null,"prorated":false,"min_amount_cents":0,"properties":{}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","charge_model":"volume","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]}},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","charge_model":"percentage","invoiceable":false,"invoice_display_name":"Setup","pay_in_advance":true,"regroup_paid_fees":"invoice","prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"}}]
3337
3397
  */
3338
3398
  charges?: {
3339
3399
  /**
@@ -3363,6 +3423,15 @@ export interface PlanUpdateInput {
3363
3423
  * @example true
3364
3424
  */
3365
3425
  invoiceable?: boolean;
3426
+ /**
3427
+ * This setting can only be configured if `pay_in_advance` is `true` and `invoiceable` is `false`.
3428
+ * This field determines whether and when the charge fee should be included in
3429
+ * the invoice. If `null`, no invoice will be issued for this charge fee.
3430
+ * If `invoice`, an invoice will be generated at the end of the period,
3431
+ * consolidating all charge fees with a succeeded payment status.
3432
+ * @example "invoice"
3433
+ */
3434
+ regroup_paid_fees?: "invoice" | null;
3366
3435
  /**
3367
3436
  * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
3368
3437
  * @example "Setup"
@@ -3392,6 +3461,8 @@ export interface PlanUpdateInput {
3392
3461
  */
3393
3462
  tax_codes?: string[];
3394
3463
  }[];
3464
+ /** List of usage thresholds to apply to the plan. */
3465
+ usage_thresholds?: UsageThresholdInput[];
3395
3466
  };
3396
3467
  }
3397
3468
  export interface PlanObject {
@@ -3467,11 +3538,13 @@ export interface PlanObject {
3467
3538
  minimum_commitment?: MinimumCommitmentObject;
3468
3539
  /**
3469
3540
  * Additional usage-based charges for this plan.
3470
- * @example [{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","billable_metric_code":"requests","created_at":"2023-06-27T19:43:42Z","charge_model":"package","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"filters":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","billable_metric_code":"cpu","created_at":"2023-06-27T19:43:42Z","charge_model":"graduated","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"from_value":0,"to_value":10,"flat_amount":"10","per_unit_amount":"0.5"},{"from_value":11,"to_value":null,"flat_amount":"0","per_unit_amount":"0.4"}]},"filters":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","billable_metric_code":"seats","created_at":"2023-06-27T19:43:42Z","charge_model":"standard","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{},"filters":[{"invoice_display_name":"Europe","properties":{"amount":"10"},"values":{"region":["Europe"]}},{"invoice_display_name":"USA","properties":{"amount":"5"},"values":{"region":["USA"]}},{"invoice_display_name":"Africa","properties":{"amount":"8"},"values":{"region":["Africa"]}}]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","billable_metric_code":"storage","created_at":"2023-06-27T19:43:42Z","charge_model":"volume","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]},"filters":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","billable_metric_code":"payments","created_at":"2023-06-27T19:43:42Z","charge_model":"percentage","invoiceable":false,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"},"filters":[]}]
3541
+ * @example [{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","billable_metric_code":"requests","created_at":"2023-06-27T19:43:42Z","charge_model":"package","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"regroup_paid_fees":null,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"filters":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","billable_metric_code":"cpu","created_at":"2023-06-27T19:43:42Z","charge_model":"graduated","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"from_value":0,"to_value":10,"flat_amount":"10","per_unit_amount":"0.5"},{"from_value":11,"to_value":null,"flat_amount":"0","per_unit_amount":"0.4"}]},"filters":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","billable_metric_code":"seats","created_at":"2023-06-27T19:43:42Z","charge_model":"standard","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{},"filters":[{"invoice_display_name":"Europe","properties":{"amount":"10"},"values":{"region":["Europe"]}},{"invoice_display_name":"USA","properties":{"amount":"5"},"values":{"region":["USA"]}},{"invoice_display_name":"Africa","properties":{"amount":"8"},"values":{"region":["Africa"]}}]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","billable_metric_code":"storage","created_at":"2023-06-27T19:43:42Z","charge_model":"volume","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]},"filters":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","billable_metric_code":"payments","created_at":"2023-06-27T19:43:42Z","charge_model":"percentage","invoiceable":false,"invoice_display_name":"Setup","pay_in_advance":true,"regroup_paid_fees":"invoice","prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"},"filters":[]}]
3471
3542
  */
3472
3543
  charges?: ChargeObject[];
3473
3544
  /** All taxes applied to the plan. */
3474
3545
  taxes?: TaxObject[];
3546
+ /** List of usage thresholds applied to the plan. */
3547
+ usage_thresholds?: UsageThresholdObject[];
3475
3548
  }
3476
3549
  export interface PlansPaginated {
3477
3550
  plans: PlanObject[];
@@ -3766,6 +3839,64 @@ export interface TaxUpdateInput {
3766
3839
  }
3767
3840
  /** @example "America/Los_Angeles" */
3768
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
+ }
3769
3900
  export interface Wallet {
3770
3901
  wallet: WalletObject;
3771
3902
  }
@@ -3807,6 +3938,21 @@ export interface WalletCreateInput {
3807
3938
  * @example "2022-07-07T23:59:59Z"
3808
3939
  */
3809
3940
  expiration_at?: string | null;
3941
+ /**
3942
+ * A boolean setting that, when set to true, delays issuing an invoice for a wallet top-up until a successful payment is made; if false, the invoice is issued immediately upon wallet top-up, regardless of the payment status. Default value of false.
3943
+ * @example false
3944
+ */
3945
+ invoice_requires_successful_payment?: boolean;
3946
+ /**
3947
+ * This optional field allows you to store a list of key-value pairs that provide additional information or custom attributes. These key-value pairs will be included in the metadata of wallet transactions generated during the wallet creation process.
3948
+ * @example [{"key":"example_key","value":"example_value"},{"key":"another_key","value":"another_value"}]
3949
+ */
3950
+ transaction_metadata?: {
3951
+ /** The unique identifier for the attribute. */
3952
+ key?: string;
3953
+ /** The corresponding value for the key. */
3954
+ value?: string;
3955
+ }[];
3810
3956
  /** List of recurring transaction rules. Currently, we only allow one recurring rule per wallet. */
3811
3957
  recurring_transaction_rules?: {
3812
3958
  /**
@@ -3854,6 +4000,21 @@ export interface WalletCreateInput {
3854
4000
  * @example "200.0"
3855
4001
  */
3856
4002
  target_ongoing_balance?: string;
4003
+ /**
4004
+ * A boolean setting that, when set to true, delays issuing an invoice for a wallet top-up until a successful payment is made; if false, the invoice is issued immediately upon wallet top-up, regardless of the payment status. Default value of false.
4005
+ * @example false
4006
+ */
4007
+ invoice_requires_successful_payment?: boolean;
4008
+ /**
4009
+ * This optional field allows you to store a list of key-value pairs containing additional information or custom attributes. These key-value pairs will populate the metadata of the wallet transactions triggered by this rule.
4010
+ * @example [{"key":"example_key","value":"example_value"},{"key":"another_key","value":"another_value"}]
4011
+ */
4012
+ transaction_metadata?: {
4013
+ /** The unique identifier for the attribute. */
4014
+ key?: string;
4015
+ /** The value associated with the key. */
4016
+ value?: string;
4017
+ }[];
3857
4018
  }[];
3858
4019
  };
3859
4020
  }
@@ -3940,6 +4101,11 @@ export interface WalletObject {
3940
4101
  * @example "2022-09-14T16:35:31Z"
3941
4102
  */
3942
4103
  terminated_at?: string | null;
4104
+ /**
4105
+ * A boolean setting that, when set to true, delays issuing an invoice for a wallet top-up until a successful payment is made; if false, the invoice is issued immediately upon wallet top-up, regardless of the payment status. Default value of false.
4106
+ * @example false
4107
+ */
4108
+ invoice_requires_successful_payment?: boolean;
3943
4109
  /** List of recurring transaction rules. Currently, we only allow one recurring rule per wallet. */
3944
4110
  recurring_transaction_rules?: {
3945
4111
  /**
@@ -3999,6 +4165,21 @@ export interface WalletObject {
3999
4165
  * @example "2022-04-29T08:59:51Z"
4000
4166
  */
4001
4167
  created_at: string;
4168
+ /**
4169
+ * A boolean setting that, when set to true, delays issuing an invoice for a wallet top-up until a successful payment is made; if false, the invoice is issued immediately upon wallet top-up, regardless of the payment status. Default value of false.
4170
+ * @example false
4171
+ */
4172
+ invoice_requires_successful_payment?: boolean;
4173
+ /**
4174
+ * This field allows you to store a list of key-value pairs containing additional information or custom attributes. These key-value pairs will populate the metadata of the wallet transactions triggered by this rule.
4175
+ * @example [{"key":"example_key","value":"example_value"},{"key":"another_key","value":"another_value"}]
4176
+ */
4177
+ transaction_metadata?: {
4178
+ /** The unique identifier for the attribute. */
4179
+ key?: string;
4180
+ /** The value associated with the key. */
4181
+ value?: string;
4182
+ }[];
4002
4183
  }[];
4003
4184
  /**
4004
4185
  * The wallet ongoing balance expressed in cents.
@@ -4053,6 +4234,21 @@ export interface WalletTransactionCreateInput {
4053
4234
  * @example "5.0"
4054
4235
  */
4055
4236
  voided_credits?: string;
4237
+ /**
4238
+ * A boolean setting that, when set to true, delays issuing an invoice for a wallet top-up until a successful payment is made; if false, the invoice is issued immediately upon wallet top-up, regardless of the payment status. Default value of false.
4239
+ * @example false
4240
+ */
4241
+ invoice_requires_successful_payment?: boolean;
4242
+ /**
4243
+ * This optional field allows you to store a list of key-value pairs that hold additional information or custom attributes related to the data.
4244
+ * @example [{"key":"example key","value":"example value"},{"key":"another key","value":"another value"}]
4245
+ */
4246
+ metadata?: {
4247
+ /** The unique identifier for the attribute. */
4248
+ key?: string;
4249
+ /** The value associated with the key. */
4250
+ value?: string;
4251
+ }[];
4056
4252
  };
4057
4253
  }
4058
4254
  export interface WalletTransactionObject {
@@ -4073,6 +4269,11 @@ export interface WalletTransactionObject {
4073
4269
  * @example "settled"
4074
4270
  */
4075
4271
  status: "pending" | "settled";
4272
+ /**
4273
+ * The source field represents the origin or trigger of the wallet transaction. Possible values are `manual`, `interval`. `threshold`
4274
+ * @example "manual"
4275
+ */
4276
+ source?: "manual" | "interval" | "threshold";
4076
4277
  /**
4077
4278
  * The transaction status of the wallet transaction. Possible values are `purchased` (with pending or settled status), `granted` (without invoice_id), `voided` or `invoiced`.
4078
4279
  * @example "purchased"
@@ -4095,6 +4296,21 @@ export interface WalletTransactionObject {
4095
4296
  * @example "100.0"
4096
4297
  */
4097
4298
  credit_amount: string;
4299
+ /**
4300
+ * A boolean setting that, when set to true, delays issuing an invoice for a wallet top-up until a successful payment is made; if false, the invoice is issued immediately upon wallet top-up, regardless of the payment status. Default value of false.
4301
+ * @example false
4302
+ */
4303
+ invoice_requires_successful_payment?: boolean;
4304
+ /**
4305
+ * This field allows you to store a list of key-value pairs that hold additional information or custom attributes related to the data.
4306
+ * @example [{"key":"example key","value":"example value"},{"key":"another key","value":"another value"}]
4307
+ */
4308
+ metadata?: {
4309
+ /** The unique identifier for the attribute. */
4310
+ key?: string;
4311
+ /** The value associated with the key. */
4312
+ value?: string;
4313
+ }[];
4098
4314
  /**
4099
4315
  * The date when wallet transaction is settled, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
4100
4316
  * @format date-time
@@ -4127,6 +4343,11 @@ export interface WalletUpdateInput {
4127
4343
  * @example "2022-07-07T23:59:59Z"
4128
4344
  */
4129
4345
  expiration_at?: string | null;
4346
+ /**
4347
+ * A boolean setting that, when set to true, delays issuing an invoice for a wallet top-up until a successful payment is made; if false, the invoice is issued immediately upon wallet top-up, regardless of the payment status. Default value of false.
4348
+ * @example false
4349
+ */
4350
+ invoice_requires_successful_payment?: boolean;
4130
4351
  /** List of recurring transaction rules. Currently, we only allow one recurring rule per wallet. */
4131
4352
  recurring_transaction_rules?: {
4132
4353
  /**
@@ -4180,6 +4401,21 @@ export interface WalletUpdateInput {
4180
4401
  * @example "200.0"
4181
4402
  */
4182
4403
  target_ongoing_balance?: string;
4404
+ /**
4405
+ * A boolean setting that, when set to true, delays issuing an invoice for a wallet top-up until a successful payment is made; if false, the invoice is issued immediately upon wallet top-up, regardless of the payment status. Default value of false.
4406
+ * @example false
4407
+ */
4408
+ invoice_requires_successful_payment?: boolean;
4409
+ /**
4410
+ * This optional field allows you to store a list of key-value pairs containing additional information or custom attributes. These key-value pairs will populate the metadata of the wallet transactions triggered by this rule.
4411
+ * @example [{"key":"example_key","value":"example_value"},{"key":"another_key","value":"another_value"}]
4412
+ */
4413
+ transaction_metadata?: {
4414
+ /** The unique identifier for the attribute. */
4415
+ key?: string;
4416
+ /** The value associated with the key. */
4417
+ value?: string;
4418
+ }[];
4183
4419
  }[];
4184
4420
  };
4185
4421
  }
@@ -4308,7 +4544,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
4308
4544
  }
4309
4545
  /**
4310
4546
  * @title Lago API documentation
4311
- * @version 1.7.0
4547
+ * @version 1.10.0
4312
4548
  * @license AGPLv3
4313
4549
  * @baseUrl https://{region}.getlago.com/api/v1
4314
4550
  * @externalDocs https://github.com/getlago
@@ -5217,6 +5453,16 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
5217
5453
  * @secure
5218
5454
  */
5219
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>>;
5220
5466
  /**
5221
5467
  * @description This endpoint generates a checkout link for a specific invoice.
5222
5468
  *
@@ -152,7 +152,7 @@ class HttpClient {
152
152
  exports.HttpClient = HttpClient;
153
153
  /**
154
154
  * @title Lago API documentation
155
- * @version 1.7.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
  *