lago-javascript-client 0.49.0-beta → 0.53.0-beta

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.
@@ -899,6 +899,131 @@ export interface CouponsPaginated {
899
899
  export interface CouponUpdateInput {
900
900
  coupon: CouponBaseInput;
901
901
  }
902
+ export interface CreditNoteEstimateInput {
903
+ credit_note: {
904
+ /**
905
+ * The invoice unique identifier, created by Lago.
906
+ * @format uuid
907
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
908
+ */
909
+ invoice_id: string;
910
+ /**
911
+ * The list of credit note’s items.
912
+ * @example [{"fee_id":"1a901a90-1a90-1a90-1a90-1a901a901a90","amount_cents":10},{"fee_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","amount_cents":5}]
913
+ */
914
+ items: {
915
+ /**
916
+ * The fee unique identifier, created by Lago.
917
+ * @format uuid
918
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
919
+ */
920
+ fee_id: string;
921
+ /**
922
+ * The amount of the credit note item, expressed in cents.
923
+ * @example 10
924
+ */
925
+ amount_cents: number;
926
+ }[];
927
+ };
928
+ }
929
+ export interface CreditNoteEstimated {
930
+ estimated_credit_note: {
931
+ /**
932
+ * Unique identifier assigned to the invoice that the credit note belongs to
933
+ * @format uuid
934
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
935
+ */
936
+ lago_invoice_id: string;
937
+ /**
938
+ * The invoice unique number, related to the credit note.
939
+ * @example "LAG-1234"
940
+ */
941
+ invoice_number: string;
942
+ /** The currency of the credit note. */
943
+ currency: Currency;
944
+ /**
945
+ * The tax amount of the credit note, expressed in cents.
946
+ * @example 20
947
+ */
948
+ taxes_amount_cents: number;
949
+ /**
950
+ * The tax rate associated with this specific credit note.
951
+ * @example 20
952
+ */
953
+ taxes_rate: number;
954
+ /**
955
+ * The subtotal of the credit note excluding any applicable taxes, expressed in cents.
956
+ * @example 100
957
+ */
958
+ sub_total_excluding_taxes_amount_cents: number;
959
+ /**
960
+ * The credited amount of the credit note, expressed in cents.
961
+ * @example 100
962
+ */
963
+ max_creditable_amount_cents: number;
964
+ /**
965
+ * The refunded amount of the credit note, expressed in cents.
966
+ * @example 0
967
+ */
968
+ max_refundable_amount_cents: number;
969
+ /**
970
+ * The pro-rated amount of the coupons applied to the source invoice.
971
+ * @example 20
972
+ */
973
+ coupons_adjustment_amount_cents: number;
974
+ /** Array of credit note’s items. */
975
+ items: {
976
+ /**
977
+ * The credit note’s item amount, expressed in cents.
978
+ * @example 100
979
+ */
980
+ amount_cents: number;
981
+ /**
982
+ * Unique identifier assigned to the fee within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the fee’s record within the Lago system.
983
+ * @format uuid
984
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
985
+ */
986
+ lago_fee_id: string | null;
987
+ }[];
988
+ applied_taxes?: {
989
+ /**
990
+ * Unique identifier of the tax, created by Lago.
991
+ * @format uuid
992
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
993
+ */
994
+ lago_tax_id?: string;
995
+ /**
996
+ * Name of the tax.
997
+ * @example "TVA"
998
+ */
999
+ tax_name?: string;
1000
+ /**
1001
+ * Unique code used to identify the tax associated with the API request.
1002
+ * @example "french_standard_vat"
1003
+ */
1004
+ tax_code?: string;
1005
+ /**
1006
+ * The percentage rate of the tax
1007
+ * @example 20
1008
+ */
1009
+ tax_rate?: number;
1010
+ /**
1011
+ * Internal description of the taxe
1012
+ * @example "French standard VAT"
1013
+ */
1014
+ tax_description?: string;
1015
+ /** @example 100 */
1016
+ base_amount_cents?: number;
1017
+ /**
1018
+ * Amount of the tax
1019
+ * @example 2000
1020
+ */
1021
+ amount_cents?: number;
1022
+ /** Currency of the tax */
1023
+ amount_currency?: Currency;
1024
+ }[];
1025
+ };
1026
+ }
902
1027
  export interface CreditObject {
903
1028
  /**
904
1029
  * Unique identifier assigned to the credit within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the credit’s item record within the Lago system.
@@ -1086,7 +1211,7 @@ export interface CreditNoteObject {
1086
1211
  * The pro-rated amount of the coupons applied to the source invoice.
1087
1212
  * @example 20
1088
1213
  */
1089
- coupons_adjustement_amount_cents: number;
1214
+ coupons_adjustment_amount_cents: number;
1090
1215
  /**
1091
1216
  * The date when the credit note was created. It is expressed in Coordinated Universal Time (UTC).
1092
1217
  * @format date-time
@@ -1248,6 +1373,11 @@ export interface CustomerChargeUsageObject {
1248
1373
  * @example "graduated"
1249
1374
  */
1250
1375
  charge_model: "standard" | "graduated" | "package" | "percentage" | "volume";
1376
+ /**
1377
+ * 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.
1378
+ * @example "Setup"
1379
+ */
1380
+ invoice_display_name?: string;
1251
1381
  };
1252
1382
  /** The related billable metric object. */
1253
1383
  billable_metric: {
@@ -1749,12 +1879,12 @@ export interface EventObject {
1749
1879
  * @format uuid
1750
1880
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1751
1881
  */
1752
- lago_customer_id: string;
1882
+ lago_customer_id: string | null;
1753
1883
  /**
1754
1884
  * The customer external unique identifier (provided by your own application). This field is optional if you send the `external_subscription_id`, targeting a specific subscription.
1755
1885
  * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
1756
1886
  */
1757
- external_customer_id: string;
1887
+ external_customer_id: string | null;
1758
1888
  /**
1759
1889
  * 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.
1760
1890
  * @example "storage"
@@ -1780,12 +1910,12 @@ export interface EventObject {
1780
1910
  * @format uuid
1781
1911
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1782
1912
  */
1783
- lago_subscription_id: string;
1913
+ lago_subscription_id: string | null;
1784
1914
  /**
1785
1915
  * The unique identifier of the subscription within your application. It is a mandatory field when the customer possesses multiple subscriptions or when the `external_customer_id` is not provided.
1786
1916
  * @example "sub_1234567890"
1787
1917
  */
1788
- external_subscription_id: string;
1918
+ external_subscription_id: string | null;
1789
1919
  /**
1790
1920
  * The creation date of the event's record in the Lago application, presented in the ISO 8601 datetime format, specifically in Coordinated Universal Time (UTC). It provides the precise timestamp of when the event's record was created within the Lago application
1791
1921
  * @format date-time
@@ -1836,24 +1966,24 @@ export interface FeeObject {
1836
1966
  */
1837
1967
  lago_true_up_parent_fee_id?: string | null;
1838
1968
  /**
1839
- * Unique identifier assigned to the subscription, created by Lago. This field is specifically displayed when the fee type is charge and the payment for the fee is made in advance (`pay_in_advance` is set to true).
1969
+ * Unique identifier assigned to the subscription, created by Lago. This field is specifically displayed when the fee type is charge or subscription.
1840
1970
  * @format uuid
1841
1971
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1842
1972
  */
1843
1973
  lago_subscription_id?: string | null;
1844
1974
  /**
1845
- * Unique identifier assigned to the customer, created by Lago. This field is specifically displayed when the fee type is charge and the payment for the fee is made in advance (`pay_in_advance` is set to true).
1975
+ * Unique identifier assigned to the customer, created by Lago. This field is specifically displayed when the fee type is charge or subscription.
1846
1976
  * @format uuid
1847
1977
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1848
1978
  */
1849
1979
  lago_customer_id?: string | null;
1850
1980
  /**
1851
- * Unique identifier assigned to the customer in your application. This field is specifically displayed when the fee type is charge and the payment for the fee is made in advance (`pay_in_advance` is set to true).
1981
+ * Unique identifier assigned to the customer in your application. This field is specifically displayed when the fee type is charge or subscription.
1852
1982
  * @example "external_id"
1853
1983
  */
1854
1984
  external_customer_id?: string | null;
1855
1985
  /**
1856
- * Unique identifier assigned to the subscription in your application. This field is specifically displayed when the fee type is charge and the payment for the fee is made in advance (`pay_in_advance` is set to true).
1986
+ * Unique identifier assigned to the subscription in your application. This field is specifically displayed when the fee type is charge or subscription.
1857
1987
  * @example "external_id"
1858
1988
  */
1859
1989
  external_subscription_id?: string | null;
@@ -1884,6 +2014,11 @@ export interface FeeObject {
1884
2014
  * @example "0.32"
1885
2015
  */
1886
2016
  units: string;
2017
+ /**
2018
+ * The unit amount of the fee per unit, with precision.
2019
+ * @example "312.5"
2020
+ */
2021
+ precise_unit_amount: string;
1887
2022
  /**
1888
2023
  * The cost of this specific fee, including any applicable taxes.
1889
2024
  * @example 120
@@ -1952,6 +2087,176 @@ export interface FeeObject {
1952
2087
  * @example "transaction_1234567890"
1953
2088
  */
1954
2089
  event_transaction_id?: string | null;
2090
+ /** List of all unit amount details for calculating the fee. */
2091
+ amount_details?: {
2092
+ /** Graduated ranges, used for a `graduated` charge model. */
2093
+ graduated_ranges?: {
2094
+ /**
2095
+ * Total units received in Lago.
2096
+ * @pattern ^[0-9]+.?[0-9]*$
2097
+ * @example "10.0"
2098
+ */
2099
+ units: string;
2100
+ /**
2101
+ * Lower value of a tier. It is either 0 or the previous range's `to_value + 1`.
2102
+ * @example 0
2103
+ */
2104
+ from_value: number;
2105
+ /**
2106
+ * Highest value of a tier.
2107
+ * - This value is higher than the from_value of the same tier.
2108
+ * - This value is null for the last tier.
2109
+ * @example 10
2110
+ */
2111
+ to_value: number | null;
2112
+ /**
2113
+ * Flat unit amount within a specified tier.
2114
+ * @example "1.0"
2115
+ */
2116
+ flat_unit_amount: string;
2117
+ /**
2118
+ * Amount per unit within a specified tier.
2119
+ * @example "1.0"
2120
+ */
2121
+ per_unit_amount: string;
2122
+ /**
2123
+ * Total amount of received units to be charged within a specified tier.
2124
+ * @example "10.0"
2125
+ */
2126
+ per_unit_total_amount: string;
2127
+ /**
2128
+ * Total amount to be charged for a specific tier, taking into account the flat_unit_amount and the per_unit_total_amount.
2129
+ * @example "11.0"
2130
+ */
2131
+ total_with_flat_amount: string;
2132
+ }[];
2133
+ /** Graduated percentage ranges, used for a `graduated_percentage` charge model. */
2134
+ graduated_percentage_ranges?: {
2135
+ /**
2136
+ * Total units received in Lago.
2137
+ * @pattern ^[0-9]+.?[0-9]*$
2138
+ * @example "10.0"
2139
+ */
2140
+ units: string;
2141
+ /**
2142
+ * Lower value of a tier. It is either 0 or the previous range's `to_value + 1`.
2143
+ * @example 0
2144
+ */
2145
+ from_value: number;
2146
+ /**
2147
+ * Highest value of a tier.
2148
+ * - This value is higher than the from_value of the same tier.
2149
+ * - This value is null for the last tier.
2150
+ * @example 10
2151
+ */
2152
+ to_value: number | null;
2153
+ /**
2154
+ * Flat unit amount within a specified tier.
2155
+ * @example "1.0"
2156
+ */
2157
+ flat_unit_amount: string;
2158
+ /**
2159
+ * Amount per unit within a specified tier.
2160
+ * @example "1.0"
2161
+ */
2162
+ per_unit_amount: string;
2163
+ /**
2164
+ * Total amount of received units to be charged within a specified tier.
2165
+ * @example "10.0"
2166
+ */
2167
+ per_unit_total_amount: string;
2168
+ /**
2169
+ * Total amount to be charged for a specific tier, taking into account the flat_unit_amount and the per_unit_total_amount.
2170
+ * @example "11.0"
2171
+ */
2172
+ total_with_flat_amount: string;
2173
+ }[];
2174
+ /**
2175
+ * The quantity of units that are provided free of charge for each billing period in a `package` charge model.
2176
+ * @pattern ^[0-9]+.?[0-9]*$
2177
+ * @example "10.0"
2178
+ */
2179
+ free_units?: string;
2180
+ /**
2181
+ * The quantity of units that are not provided free of charge for each billing period in a `package` charge model.
2182
+ * @pattern ^[0-9]+.?[0-9]*$
2183
+ * @example "40.0"
2184
+ */
2185
+ paid_units?: string;
2186
+ /**
2187
+ * The quantity of units included, defined for Package or Percentage charge model.
2188
+ * @example 1000
2189
+ */
2190
+ per_package_size?: number;
2191
+ /**
2192
+ * Total amount to charge for received paid_units, defined for Package or Percentage charge model.
2193
+ * @pattern ^[0-9]+.?[0-9]*$
2194
+ * @example "0.5"
2195
+ */
2196
+ per_package_unit_amount?: string;
2197
+ /**
2198
+ * The total units received in Lago for the Percentage charge model.
2199
+ * @pattern ^[0-9]+.?[0-9]*$
2200
+ * @example "20.0"
2201
+ */
2202
+ units?: string;
2203
+ /**
2204
+ * Total number of free events allowed for the Percentage charge model.
2205
+ * @example 10
2206
+ */
2207
+ free_events?: number;
2208
+ /**
2209
+ * Amount per unit for the Percentage charge model.
2210
+ * @example "1.0"
2211
+ */
2212
+ per_unit_amount?: string;
2213
+ /**
2214
+ * Total amount of received units to be charged for the Percentage charge model.
2215
+ * @example "10.0"
2216
+ */
2217
+ per_unit_total_amount?: string;
2218
+ /**
2219
+ * Total number of paid events for the Percentage charge model.
2220
+ * @example 20
2221
+ */
2222
+ paid_events?: number;
2223
+ /**
2224
+ * Fixed fee unit price per received paid_event for the Percentage charge model.
2225
+ * @example "1.0"
2226
+ */
2227
+ fixed_fee_unit_amount?: string;
2228
+ /**
2229
+ * Total amount to charge for received paid_events for the Percentage charge model.
2230
+ * @example "20.0"
2231
+ */
2232
+ fixed_fee_total_amount?: string;
2233
+ /**
2234
+ * Total adjustment amount linked to minimum and maximum spending per transaction for the Percentage charge model.
2235
+ * @example "20.0"
2236
+ */
2237
+ min_max_adjustment_total_amount?: string;
2238
+ /** Volume ranges, used for a `volume` charge model. */
2239
+ volume_ranges?: {
2240
+ /**
2241
+ * The flat amount for a whole tier, excluding tax, for a `volume` charge model.
2242
+ * @pattern ^[0-9]+.?[0-9]*$
2243
+ * @example "0.5"
2244
+ */
2245
+ per_unit_amount: string;
2246
+ /**
2247
+ * The unit price, excluding tax, for a specific tier of a `volume` charge model.
2248
+ * @pattern ^[0-9]+.?[0-9]*$
2249
+ * @example "10.0"
2250
+ */
2251
+ flat_unit_amount: string;
2252
+ /**
2253
+ * Total amount of received units to be charged.
2254
+ * @pattern ^[0-9]+.?[0-9]*$
2255
+ * @example "10.0"
2256
+ */
2257
+ per_unit_total_amount: string;
2258
+ }[];
2259
+ };
1955
2260
  /** Item attached to the fee */
1956
2261
  item: {
1957
2262
  /**
@@ -1974,6 +2279,11 @@ export interface FeeObject {
1974
2279
  * @example "Setup Fee (SF1)"
1975
2280
  */
1976
2281
  invoice_display_name?: string;
2282
+ /**
2283
+ * 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.
2284
+ * @example "Transactions - ACH"
2285
+ */
2286
+ group_invoice_display_name?: string;
1977
2287
  /**
1978
2288
  * Unique identifier of the fee item, created by Lago. It can be the identifier of the `add-on`, the identifier of the `charge`, the identifier of the `credit` or the identifier of the `subscription`.
1979
2289
  * @format uuid
@@ -2004,6 +2314,23 @@ export interface FeeUpdateInput {
2004
2314
  payment_status: "pending" | "succeeded" | "failed" | "refunded";
2005
2315
  };
2006
2316
  }
2317
+ export interface GrossRevenueObject {
2318
+ /**
2319
+ * Identifies the month to analyze revenue.
2320
+ * @example "2023-11-01T00:00:00.000Z"
2321
+ */
2322
+ month: string;
2323
+ /**
2324
+ * The total amount of revenue for a period, expressed in cents.
2325
+ * @example 50000
2326
+ */
2327
+ amount_cents?: number;
2328
+ /** The currency of revenue analytics. Format must be ISO 4217. */
2329
+ currency?: Currency;
2330
+ }
2331
+ export interface GrossRevenues {
2332
+ gross_revenues: GrossRevenueObject[];
2333
+ }
2007
2334
  export interface GroupObject {
2008
2335
  /**
2009
2336
  * Unique identifier of a specific group associated with the billable metric.
@@ -2041,6 +2368,23 @@ export interface GroupsPaginated {
2041
2368
  groups: GroupObject[];
2042
2369
  meta: PaginationMeta;
2043
2370
  }
2371
+ export interface MrrObject {
2372
+ /**
2373
+ * Identifies the month to analyze MRR.
2374
+ * @example "2023-11-01T00:00:00.000Z"
2375
+ */
2376
+ month: string;
2377
+ /**
2378
+ * The total amount of MRR, expressed in cents.
2379
+ * @example 50000
2380
+ */
2381
+ amount_cents?: number;
2382
+ /** The currency of MRR analytics. Format must be ISO 4217. */
2383
+ currency?: Currency;
2384
+ }
2385
+ export interface Mrrs {
2386
+ mrrs: MrrObject[];
2387
+ }
2044
2388
  export interface Invoice {
2045
2389
  invoice: InvoiceObjectExtended;
2046
2390
  }
@@ -2057,6 +2401,55 @@ export type InvoiceAppliedTaxObject = BaseAppliedTax & {
2057
2401
  */
2058
2402
  fees_amount_cents?: number;
2059
2403
  };
2404
+ export interface InvoiceCollectionObject {
2405
+ /**
2406
+ * Identifies the month to analyze revenue.
2407
+ * @example "2023-11-01T00:00:00.000Z"
2408
+ */
2409
+ month: string;
2410
+ /**
2411
+ * The payment status of the invoices.
2412
+ * @example "succeeded"
2413
+ */
2414
+ payment_status?: "pending" | "succeeded" | "failed";
2415
+ /**
2416
+ * Contains invoices count.
2417
+ * @example 10
2418
+ */
2419
+ invoices_count: number;
2420
+ /**
2421
+ * The total amount of revenue for a period, expressed in cents.
2422
+ * @example 50000
2423
+ */
2424
+ amount_cents: number;
2425
+ /** The currency of revenue analytics. Format must be ISO 4217. */
2426
+ currency?: Currency;
2427
+ }
2428
+ export interface InvoiceCollections {
2429
+ invoice_collections: InvoiceCollectionObject[];
2430
+ }
2431
+ export interface InvoicedUsageObject {
2432
+ /**
2433
+ * Identifies the month to analyze revenue.
2434
+ * @example "2023-11-01T00:00:00.000Z"
2435
+ */
2436
+ month: string;
2437
+ /**
2438
+ * The code of the usage-based billable metrics.
2439
+ * @example "code1"
2440
+ */
2441
+ code?: string;
2442
+ /**
2443
+ * The total amount of revenue for a period, expressed in cents.
2444
+ * @example 50000
2445
+ */
2446
+ amount_cents: number;
2447
+ /** The currency of revenue analytics. Format must be ISO 4217. */
2448
+ currency: Currency;
2449
+ }
2450
+ export interface InvoicedUsages {
2451
+ invoiced_usages: InvoicedUsageObject[];
2452
+ }
2060
2453
  export interface InvoiceMetadataObject {
2061
2454
  /**
2062
2455
  * Unique identifier assigned to the invoice metadata within the Lago application.
@@ -2329,6 +2722,8 @@ export interface OrganizationObject {
2329
2722
  webhook_urls?: string[] | null;
2330
2723
  /** The country of your organization. */
2331
2724
  country?: Country;
2725
+ /** The default currency of an organization. */
2726
+ default_currency?: Currency;
2332
2727
  /**
2333
2728
  * The first line of your organization’s billing address.
2334
2729
  * @example "100 Brex Street"
@@ -2370,6 +2765,21 @@ export interface OrganizationObject {
2370
2765
  * @example null
2371
2766
  */
2372
2767
  legal_number?: string | null;
2768
+ /**
2769
+ * This parameter configures the method of incrementing invoice numbers for your customers.
2770
+ *
2771
+ * - `per_customer`: Invoice numbers are incremented individually for each customer. This means every customer will have their own unique sequence of invoice numbers, separate from other customers. It ensures that each customer's invoice numbers follow a distinct and isolated numbering pattern.
2772
+ * - `per_organization`: Invoice number incrementation is made across your entire organization. Rather than individual sequences for each customer, all invoices within the organization follow a single, unified numbering system. This creates a continuous and organization-wide sequence for all invoice numbers. Invoices are incremented per month (dynamic value used is YYYYMM), and invoice numbers are reset at the end of each month.
2773
+ *
2774
+ * The default value for `document_numbering` is set to `per_customer`, meaning that, unless changed, invoice numbers will increment uniquely for each customer.
2775
+ * @example "per_customer"
2776
+ */
2777
+ document_numbering: "per_customer" | "per_organization";
2778
+ /**
2779
+ * Sets the prefix for invoices and credit notes. Default is the first three letters of your organization name plus the last four digits of your organization ID. Customizable within 1-10 characters, and automatically capitalized by Lago.
2780
+ * @example "ORG-1234"
2781
+ */
2782
+ document_number_prefix: string;
2373
2783
  /**
2374
2784
  * The net payment term, expressed in days, specifies the duration within which a customer is expected to remit payment after the invoice is finalized.
2375
2785
  * @example 30
@@ -2396,6 +2806,8 @@ export interface OrganizationUpdateInput {
2396
2806
  webhook_url?: string | null;
2397
2807
  /** The country of your organization. */
2398
2808
  country?: Country;
2809
+ /** The default currency of an organization. */
2810
+ default_currency?: Currency;
2399
2811
  /**
2400
2812
  * The first line of your organization’s billing address.
2401
2813
  * @example "100 Brex Street"
@@ -2437,6 +2849,21 @@ export interface OrganizationUpdateInput {
2437
2849
  * @example null
2438
2850
  */
2439
2851
  legal_number?: string | null;
2852
+ /**
2853
+ * This parameter configures the method of incrementing invoice numbers for your customers.
2854
+ *
2855
+ * - `per_customer`: Invoice numbers are incremented individually for each customer. This means every customer will have their own unique sequence of invoice numbers, separate from other customers. It ensures that each customer's invoice numbers follow a distinct and isolated numbering pattern.
2856
+ * - `per_organization`: Invoice number incrementation is made across your entire organization. Rather than individual sequences for each customer, all invoices within the organization follow a single, unified numbering system. This creates a continuous and organization-wide sequence for all invoice numbers. Invoices are incremented per month (dynamic value used is YYYYMM), and invoice numbers are reset at the end of each month.
2857
+ *
2858
+ * The default value for `document_numbering` is set to `per_customer`, meaning that, unless changed, invoice numbers will increment uniquely for each customer.
2859
+ * @example "per_customer"
2860
+ */
2861
+ document_numbering?: "per_customer" | "per_organization";
2862
+ /**
2863
+ * Sets the prefix for invoices and credit notes. Default is the first three letters of your organization name plus the last four digits of your organization ID. Customizable within 1-10 characters, and automatically capitalized by Lago.
2864
+ * @example "ORG-1234"
2865
+ */
2866
+ document_number_prefix?: string;
2440
2867
  /**
2441
2868
  * The net payment term, expressed in days, specifies the duration within which a customer is expected to remit payment after the invoice is finalized.
2442
2869
  * @example 30
@@ -2607,6 +3034,83 @@ export interface PlanCreateInput {
2607
3034
  }[];
2608
3035
  };
2609
3036
  }
3037
+ /** Based plan overrides. */
3038
+ export interface PlanOverridesObject {
3039
+ /**
3040
+ * The base cost of the plan, excluding any applicable taxes, that is billed on a recurring basis. This value is defined at 0 if your plan is a pay-as-you-go plan.
3041
+ * @example 10000
3042
+ */
3043
+ amount_cents?: number;
3044
+ /** The currency of the plan. It indicates the monetary unit in which the plan's cost, including taxes and usage-based charges, is expressed. */
3045
+ amount_currency?: Currency;
3046
+ /**
3047
+ * The description on the plan.
3048
+ * @example "Plan for early stage startups."
3049
+ */
3050
+ description?: string;
3051
+ /**
3052
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the plan will be used as the default display name.
3053
+ * @example "Startup plan"
3054
+ */
3055
+ invoice_display_name?: string;
3056
+ /**
3057
+ * The name of the plan.
3058
+ * @example "Startup"
3059
+ */
3060
+ name?: string;
3061
+ /**
3062
+ * List of unique code used to identify the taxes.
3063
+ * @example ["french_standard_vat"]
3064
+ */
3065
+ tax_codes?: string[];
3066
+ /**
3067
+ * The duration in days during which the base cost of the plan is offered for free.
3068
+ * @example 5
3069
+ */
3070
+ trial_period?: number;
3071
+ /** Additional usage-based charges for this plan. */
3072
+ charges?: {
3073
+ /**
3074
+ * Unique identifier of the charge created by Lago.
3075
+ * @format uuid
3076
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3077
+ */
3078
+ id?: string;
3079
+ /**
3080
+ * Unique identifier of the billable metric created by Lago.
3081
+ * @format uuid
3082
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3083
+ */
3084
+ billable_metric_id?: string;
3085
+ /**
3086
+ * 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.
3087
+ * @example "Setup"
3088
+ */
3089
+ invoice_display_name?: string;
3090
+ /**
3091
+ * The minimum spending amount required for the charge, measured in cents and excluding any applicable taxes. It indicates the minimum amount that needs to be charged for each billing period.
3092
+ * @example 0
3093
+ */
3094
+ min_amount_cents?: number;
3095
+ /** List of all thresholds utilized for calculating the charge. */
3096
+ properties?: ChargeProperties;
3097
+ /** All charge information, sorted by groups. */
3098
+ group_properties?: {
3099
+ /**
3100
+ * Unique identifier of a billable metric group, created by Lago.
3101
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3102
+ */
3103
+ group_id: string;
3104
+ /** List of all thresholds utilized for calculating a charge, scoped by groups used as dimensions for a single charge. */
3105
+ values: ChargeProperties;
3106
+ }[];
3107
+ /**
3108
+ * List of unique code used to identify the taxes.
3109
+ * @example ["french_standard_vat"]
3110
+ */
3111
+ tax_codes?: string[];
3112
+ }[];
3113
+ }
2610
3114
  export interface PlanUpdateInput {
2611
3115
  plan: {
2612
3116
  /**
@@ -2815,7 +3319,7 @@ export interface PlansPaginated {
2815
3319
  meta: PaginationMeta;
2816
3320
  }
2817
3321
  export interface Subscription {
2818
- subscription: SubscriptionObject;
3322
+ subscription: SubscriptionObjectExtended;
2819
3323
  }
2820
3324
  export interface SubscriptionCreateInput {
2821
3325
  subscription: {
@@ -2856,9 +3360,16 @@ export interface SubscriptionCreateInput {
2856
3360
  * @example "2022-08-08T00:00:00Z"
2857
3361
  */
2858
3362
  subscription_at?: string;
3363
+ /** Based plan overrides. */
3364
+ plan_overrides?: PlanOverridesObject;
2859
3365
  };
2860
3366
  }
2861
3367
  export interface SubscriptionUpdateInput {
3368
+ /**
3369
+ * If the field is not defined and multiple `active` and `pending` subscriptions exists, Lago will update the `active` subscription. However, if you wish to update a `pending` subscription, please ensure that you include the `status` attribute with the `pending` value in your request body.
3370
+ * @example "active"
3371
+ */
3372
+ status?: "active" | "pending";
2862
3373
  subscription: {
2863
3374
  /**
2864
3375
  * The display name of the subscription on an invoice. This field allows for customization of the subscription's name for billing purposes, especially useful when a single customer has multiple subscriptions using the same plan.
@@ -2877,6 +3388,8 @@ export interface SubscriptionUpdateInput {
2877
3388
  * @example "2022-08-08T00:00:00Z"
2878
3389
  */
2879
3390
  subscription_at?: string;
3391
+ /** Based plan overrides. */
3392
+ plan_overrides?: PlanOverridesObject;
2880
3393
  };
2881
3394
  }
2882
3395
  export interface SubscriptionObject {
@@ -2974,11 +3487,14 @@ export interface SubscriptionObject {
2974
3487
  next_plan_code?: string | null;
2975
3488
  /**
2976
3489
  * The date when the plan will be downgraded, represented in ISO 8601 date format.
2977
- * @format date-time
2978
- * @example null
3490
+ * @format date
3491
+ * @example "2022-04-30"
2979
3492
  */
2980
3493
  downgrade_plan_date?: string | null;
2981
3494
  }
3495
+ export type SubscriptionObjectExtended = SubscriptionObject & {
3496
+ plan?: PlanObject;
3497
+ };
2982
3498
  export interface SubscriptionsPaginated {
2983
3499
  subscriptions: SubscriptionObject[];
2984
3500
  meta: PaginationMeta;
@@ -3126,6 +3642,25 @@ export interface WalletCreateInput {
3126
3642
  * @example "2022-07-07T23:59:59Z"
3127
3643
  */
3128
3644
  expiration_at?: string | null;
3645
+ /** List of recurring transaction rules. Currently, we only allow one recurring rule per wallet. */
3646
+ recurring_transaction_rules?: {
3647
+ /**
3648
+ * The rule type. Possible values are `interval` or `threshold`.
3649
+ * @example "interval"
3650
+ */
3651
+ rule_type: "interval" | "threshold";
3652
+ /**
3653
+ * The interval used for recurring top-up. It represents the frequency at which automatic top-up occurs. The interval can be one of the following values: `weekly`, `monthly`, `quarterly` or `yearly`. Required only when rule type is `interval`.
3654
+ * @example "monthly"
3655
+ */
3656
+ interval?: "weekly" | "monthly" | "quarterly" | "yearly";
3657
+ /**
3658
+ * The threshold for recurring top-ups is the value at which an automatic top-up is triggered. For example, if this threshold is set at 10 credits, an automatic top-up will occur whenever the wallet balance falls to or below 10 credits. Required only when rule type is set to `threshold`.
3659
+ * @pattern ^[0-9]+.?[0-9]*$
3660
+ * @example "20.0"
3661
+ */
3662
+ threshold_credits?: string;
3663
+ }[];
3129
3664
  };
3130
3665
  }
3131
3666
  export interface WalletObject {
@@ -3211,6 +3746,49 @@ export interface WalletObject {
3211
3746
  * @example "2022-09-14T16:35:31Z"
3212
3747
  */
3213
3748
  terminated_at?: string | null;
3749
+ /** List of recurring transaction rules. Currently, we only allow one recurring rule per wallet. */
3750
+ recurring_transaction_rules?: {
3751
+ /**
3752
+ * A unique identifier for the recurring transaction rule in the Lago application. Can be used to update a recurring transaction rule.
3753
+ * @format uuid
3754
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3755
+ */
3756
+ lago_id: string;
3757
+ /**
3758
+ * The rule type. Possible values are `interval` or `threshold`.
3759
+ * @example "interval"
3760
+ */
3761
+ rule_type: "interval" | "threshold";
3762
+ /**
3763
+ * The interval used for recurring top-up. It represents the frequency at which automatic top-up occurs. The interval can be one of the following values: `weekly`, `monthly`, `quarterly` or `yearly`. Required only if rule type is set to `interval`.
3764
+ * @example "monthly"
3765
+ */
3766
+ interval?: "weekly" | "monthly" | "quarterly" | "yearly";
3767
+ /**
3768
+ * The threshold for recurring top-ups is the value at which an automatic top-up is triggered. For example, if this threshold is set at 10 credits, an automatic top-up will occur whenever the wallet balance falls to or below 10 credits. Required only when rule type is set to `threshold`.
3769
+ * @pattern ^[0-9]+.?[0-9]*$
3770
+ * @example "20.0"
3771
+ */
3772
+ threshold_credits?: string;
3773
+ /**
3774
+ * The number of paid credits. Required only if there is no granted credits.
3775
+ * @pattern ^[0-9]+.?[0-9]*$
3776
+ * @example "20.0"
3777
+ */
3778
+ paid_credits: string;
3779
+ /**
3780
+ * The number of free granted credits. Required only if there is no paid credits.
3781
+ * @pattern ^[0-9]+.?[0-9]*$
3782
+ * @example "10.0"
3783
+ */
3784
+ granted_credits: string;
3785
+ /**
3786
+ * The date of the metadata object creation, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC). The creation_date provides a standardized and internationally recognized timestamp for when the metadata object was created
3787
+ * @format date-time
3788
+ * @example "2022-04-29T08:59:51Z"
3789
+ */
3790
+ created_at: string;
3791
+ }[];
3214
3792
  }
3215
3793
  export interface WalletsPaginated {
3216
3794
  wallets: WalletObject[];
@@ -3305,6 +3883,43 @@ export interface WalletUpdateInput {
3305
3883
  * @example "2022-07-07T23:59:59Z"
3306
3884
  */
3307
3885
  expiration_at?: string | null;
3886
+ /** List of recurring transaction rules. Currently, we only allow one recurring rule per wallet. */
3887
+ recurring_transaction_rules?: {
3888
+ /**
3889
+ * A unique identifier for the recurring transaction rule in the Lago application. Can be used to update a recurring transaction rule.
3890
+ * @format uuid
3891
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3892
+ */
3893
+ lago_id?: string;
3894
+ /**
3895
+ * The rule type. Possible values are `interval` or `threshold`.
3896
+ * @example "interval"
3897
+ */
3898
+ rule_type?: "interval" | "threshold";
3899
+ /**
3900
+ * The interval used for recurring top-up. It represents the frequency at which automatic top-up occurs. The interval can be one of the following values: `weekly`, `monthly`, `quarterly` or `yearly`. Required only when rule type is set to `interval`.
3901
+ * @example "monthly"
3902
+ */
3903
+ interval?: "weekly" | "monthly" | "quarterly" | "yearly";
3904
+ /**
3905
+ * The threshold for recurring top-ups is the value at which an automatic top-up is triggered. For example, if this threshold is set at 10 credits, an automatic top-up will occur whenever the wallet balance falls to or below 10 credits. Required only when rule type is set to `threshold`.
3906
+ * @pattern ^[0-9]+.?[0-9]*$
3907
+ * @example "20.0"
3908
+ */
3909
+ threshold_credits?: string;
3910
+ /**
3911
+ * The number of paid credits. Required only if there is no granted credits.
3912
+ * @pattern ^[0-9]+.?[0-9]*$
3913
+ * @example "20.0"
3914
+ */
3915
+ paid_credits?: string;
3916
+ /**
3917
+ * The number of free granted credits. Required only if there is no paid credits.
3918
+ * @pattern ^[0-9]+.?[0-9]*$
3919
+ * @example "10.0"
3920
+ */
3921
+ granted_credits?: string;
3922
+ }[];
3308
3923
  };
3309
3924
  }
3310
3925
  export interface WebhookEndpoint {
@@ -3432,7 +4047,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
3432
4047
  }
3433
4048
  /**
3434
4049
  * @title Lago API documentation
3435
- * @version 0.49.0-beta
4050
+ * @version 0.53.0-beta
3436
4051
  * @license AGPLv3
3437
4052
  * @baseUrl https://api.getlago.com/api/v1
3438
4053
  * @externalDocs https://github.com/getlago
@@ -3504,6 +4119,77 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
3504
4119
  */
3505
4120
  destroyAddOn: (code: string, params?: RequestParams) => Promise<HttpResponse<AddOn, ApiErrorUnauthorized | ApiErrorNotFound>>;
3506
4121
  };
4122
+ analytics: {
4123
+ /**
4124
+ * @description Gross revenue is the sum of monthly `finalized` invoice payments and fees paid in advance that are not invoiceable. This total is calculated after deducting taxes and discounts.
4125
+ *
4126
+ * @tags analytics
4127
+ * @name FindAllGrossRevenues
4128
+ * @summary List gross revenue
4129
+ * @request GET:/analytics/gross_revenue
4130
+ * @secure
4131
+ */
4132
+ findAllGrossRevenues: (query?: {
4133
+ /** Currency of revenue analytics. Format must be ISO 4217. */
4134
+ currency?: Currency;
4135
+ /**
4136
+ * The customer external unique identifier (provided by your own application). Use it to filter revenue analytics at the customer level.
4137
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4138
+ */
4139
+ external_customer_id?: string;
4140
+ }, params?: RequestParams) => Promise<HttpResponse<GrossRevenues, ApiErrorUnauthorized>>;
4141
+ /**
4142
+ * @description Represents a monthly aggregation, detailing both the total count and the cumulative amount of invoices that have been marked as `finalized`. This report sorts invoices categorically based on their `payment_status`.
4143
+ *
4144
+ * @tags analytics
4145
+ * @name FindAllInvoiceCollections
4146
+ * @summary List of finalized invoices
4147
+ * @request GET:/analytics/invoice_collection
4148
+ * @secure
4149
+ */
4150
+ findAllInvoiceCollections: (query?: {
4151
+ /** The currency of revenue analytics. Format must be ISO 4217. */
4152
+ currency?: Currency;
4153
+ }, params?: RequestParams) => Promise<HttpResponse<InvoiceCollections, ApiErrorUnauthorized>>;
4154
+ /**
4155
+ * @description Reports a monthly analysis focused on the revenue generated from all usage-based fees. It exclusively accounts for revenue that has been formally invoiced. Importantly, this report does not include revenue related to the usage in the current billing period, limiting its scope to previously invoiced amounts.
4156
+ *
4157
+ * @tags analytics
4158
+ * @name FindAllInvoicedUsages
4159
+ * @summary List usage revenue
4160
+ * @request GET:/analytics/invoiced_usage
4161
+ * @secure
4162
+ */
4163
+ findAllInvoicedUsages: (query?: {
4164
+ /** The currency of invoiced usage analytics. Format must be ISO 4217. */
4165
+ currency?: Currency;
4166
+ }, params?: RequestParams) => Promise<HttpResponse<InvoicedUsages, ApiErrorUnauthorized>>;
4167
+ /**
4168
+ * @description This endpoint is used to list MRR.
4169
+ *
4170
+ * @tags analytics
4171
+ * @name FindAllMrrs
4172
+ * @summary List MRR
4173
+ * @request GET:/analytics/mrr
4174
+ * @secure
4175
+ */
4176
+ findAllMrrs: (query?: {
4177
+ /**
4178
+ * Quantifies the revenue generated from `subscription` fees on a monthly basis. This figure is calculated post-application of applicable taxes and deduction of any applicable discounts. The method of calculation varies based on the subscription billing cycle:
4179
+ *
4180
+ * - Revenue from `monthly` subscription invoices is included in the MRR for the month in which the invoice is issued.
4181
+ * - Revenue from `quarterly` subscription invoices is distributed evenly over three months. This distribution applies to fees paid in advance (allocated to the next remaining months depending on calendar or anniversary billing) as well as to fees paid in arrears (allocated to the preceding months depending on calendar or anniversary billing).
4182
+ * - Revenue from `yearly` subscription invoices is distributed evenly over twelve months. This allocation is applicable for fees paid in advance (spread over the next remaining months depending on calendar or anniversary billing) and for fees paid in arrears (spread over the previous months depending on calendar or anniversary billing).
4183
+ * - Revenue from `weekly` subscription invoices, the total revenue from all invoices issued within a month is summed up. This total is then divided by the number of invoices issued during that month, and the result is multiplied by 4.33, representing the average number of weeks in a month.
4184
+ */
4185
+ currency?: Currency;
4186
+ /**
4187
+ * Show data only for given number of months.
4188
+ * @example 12
4189
+ */
4190
+ months?: number;
4191
+ }, params?: RequestParams) => Promise<HttpResponse<Mrrs, ApiErrorUnauthorized>>;
4192
+ };
3507
4193
  appliedCoupons: {
3508
4194
  /**
3509
4195
  * @description This endpoint is used to apply a specific coupon to a customer, before or during a subscription.
@@ -3761,6 +4447,16 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
3761
4447
  * @secure
3762
4448
  */
3763
4449
  downloadCreditNote: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<CreditNote, ApiErrorUnauthorized | ApiErrorNotFound>>;
4450
+ /**
4451
+ * @description This endpoint allows you to retrieve amounts for a new credit note creation.
4452
+ *
4453
+ * @tags credit_notes
4454
+ * @name EstimateCreditNote
4455
+ * @summary Estimate amounts for a new credit note
4456
+ * @request POST:/credit_notes/estimate
4457
+ * @secure
4458
+ */
4459
+ estimateCreditNote: (data: CreditNoteEstimateInput, params?: RequestParams) => Promise<HttpResponse<CreditNoteEstimated, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
3764
4460
  /**
3765
4461
  * @description This endpoint voids an existing credit note.
3766
4462
  *
@@ -3904,6 +4600,37 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
3904
4600
  */
3905
4601
  periods_count?: number;
3906
4602
  }, params?: RequestParams) => Promise<HttpResponse<CustomerPastUsage, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
4603
+ /**
4604
+ * @description This endpoint regenerates the Payment Provider Checkout URL of a Customer.
4605
+ *
4606
+ * @tags customers
4607
+ * @name GenerateCustomerCheckoutUrl
4608
+ * @summary Generate a Customer Payment Provider Checkout URL
4609
+ * @request POST:/customers/{external_customer_id}/checkout_url
4610
+ * @secure
4611
+ */
4612
+ generateCustomerCheckoutUrl: (externalCustomerId: string, params?: RequestParams) => Promise<HttpResponse<{
4613
+ /**
4614
+ * Unique identifier assigned to the customer within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the customer's record within the Lago system
4615
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4616
+ */
4617
+ lago_customer_id?: string | undefined;
4618
+ /**
4619
+ * The customer external unique identifier (provided by your own application)
4620
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4621
+ */
4622
+ external_customer_id?: string | undefined;
4623
+ /**
4624
+ * The Payment Provider name linked to the Customer.
4625
+ * @example "stripe"
4626
+ */
4627
+ payment_provider?: string | undefined;
4628
+ /**
4629
+ * The new generated Payment Provider Checkout URL for the Customer.
4630
+ * @example "https://foo.bar"
4631
+ */
4632
+ checkout_url?: string | undefined;
4633
+ }, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
3907
4634
  };
3908
4635
  events: {
3909
4636
  /**
@@ -3915,7 +4642,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
3915
4642
  * @request POST:/events
3916
4643
  * @secure
3917
4644
  */
3918
- createEvent: (data: EventInput, params?: RequestParams) => Promise<HttpResponse<void, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
4645
+ createEvent: (data: EventInput, params?: RequestParams) => Promise<HttpResponse<Event, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
3919
4646
  /**
3920
4647
  * @description This endpoint is used for transmitting a batch of usage measurement events to multiple subscriptions for a single customer.
3921
4648
  *
@@ -4179,6 +4906,16 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
4179
4906
  * @secure
4180
4907
  */
4181
4908
  retryPayment: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<void, ApiErrorUnauthorized | ApiErrorNotAllowed | ApiErrorNotFound>>;
4909
+ /**
4910
+ * @description This endpoint is used for voiding an invoice. You can void an invoice only when it's in a `finalized` status, and the payment status is not `succeeded`.
4911
+ *
4912
+ * @tags invoices
4913
+ * @name VoidInvoice
4914
+ * @summary Void an invoice
4915
+ * @request POST:/invoices/{lago_id}/void
4916
+ * @secure
4917
+ */
4918
+ voidInvoice: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiErrorUnauthorized | ApiErrorNotFound>>;
4182
4919
  };
4183
4920
  organizations: {
4184
4921
  /**