lago-javascript-client 0.48.0-beta → 0.51.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.
@@ -4,6 +4,11 @@ export interface AddOnBaseInput {
4
4
  * @example "Setup Fee"
5
5
  */
6
6
  name?: string;
7
+ /**
8
+ * 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.
9
+ * @example "Setup Fee (SF1)"
10
+ */
11
+ invoice_display_name?: string;
7
12
  /**
8
13
  * Unique code used to identify the add-on.
9
14
  * @example "setup_fee"
@@ -42,6 +47,11 @@ export interface AddOnObject {
42
47
  * @example "Setup Fee"
43
48
  */
44
49
  name: string;
50
+ /**
51
+ * 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.
52
+ * @example "Setup Fee (SF1)"
53
+ */
54
+ invoice_display_name?: string;
45
55
  /**
46
56
  * Unique code used to identify the add-on.
47
57
  * @example "setup_fee"
@@ -380,10 +390,10 @@ export interface BillableMetricObject {
380
390
  */
381
391
  field_name?: string | null;
382
392
  /**
383
- * Aggregation method used to compute usage for this billable metric. Possible values are `count_agg`, `sum_agg`, `max_agg` or `unique_count_agg`.
393
+ * Aggregation method used to compute usage for this billable metric.
384
394
  * @example "sum_agg"
385
395
  */
386
- aggregation_type: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg" | "weighted_sum_agg";
396
+ aggregation_type: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg" | "weighted_sum_agg" | "latest_agg";
387
397
  /**
388
398
  * Parameter exclusively utilized in conjunction with the `weighted_sum` aggregation type. It serves to adjust the aggregation result by assigning weights and proration to the result based on time intervals. When this field is not provided, the default time interval is assumed to be in `seconds`.
389
399
  * @example "seconds"
@@ -438,10 +448,10 @@ export interface BillableMetricBaseInput {
438
448
  */
439
449
  field_name?: string | null;
440
450
  /**
441
- * Aggregation method used to compute usage for this billable metric. Possible values are `count_agg`, `sum_agg`, `max_agg` or `unique_count_agg`.
451
+ * Aggregation method used to compute usage for this billable metric.
442
452
  * @example "sum_agg"
443
453
  */
444
- aggregation_type?: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg" | "weighted_sum_agg";
454
+ aggregation_type?: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg" | "weighted_sum_agg" | "latest_agg";
445
455
  /**
446
456
  * Parameter exclusively utilized in conjunction with the `weighted_sum` aggregation type. It serves to adjust the aggregation result by assigning weights and proration to the result based on time intervals. When this field is not provided, the default time interval is assumed to be in `seconds`.
447
457
  * @example "seconds"
@@ -502,6 +512,11 @@ export interface ChargeObject {
502
512
  * @example "requests"
503
513
  */
504
514
  billable_metric_code: string;
515
+ /**
516
+ * 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.
517
+ * @example "Setup"
518
+ */
519
+ invoice_display_name?: string;
505
520
  /**
506
521
  * The date and time when the charge was created. It is expressed in UTC format according to the ISO 8601 datetime standard.
507
522
  * @format date-time
@@ -884,6 +899,131 @@ export interface CouponsPaginated {
884
899
  export interface CouponUpdateInput {
885
900
  coupon: CouponBaseInput;
886
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
+ }
887
1027
  export interface CreditObject {
888
1028
  /**
889
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.
@@ -1071,7 +1211,7 @@ export interface CreditNoteObject {
1071
1211
  * The pro-rated amount of the coupons applied to the source invoice.
1072
1212
  * @example 20
1073
1213
  */
1074
- coupons_adjustement_amount_cents: number;
1214
+ coupons_adjustment_amount_cents: number;
1075
1215
  /**
1076
1216
  * The date when the credit note was created. It is expressed in Coordinated Universal Time (UTC).
1077
1217
  * @format date-time
@@ -1208,6 +1348,11 @@ export interface CustomerChargeUsageObject {
1208
1348
  * @example "1.0"
1209
1349
  */
1210
1350
  units: string;
1351
+ /**
1352
+ * The quantity of usage events that have been recorded for a particular charge during the specified time period. These events may also be referred to as the number of transactions in some contexts.
1353
+ * @example 10
1354
+ */
1355
+ events_count: number;
1211
1356
  /**
1212
1357
  * The amount in cents, tax excluded, consumed by the customer for a specific charge item.
1213
1358
  * @example 123
@@ -1277,6 +1422,11 @@ export interface CustomerChargeUsageObject {
1277
1422
  * @example "0.9"
1278
1423
  */
1279
1424
  units?: string;
1425
+ /**
1426
+ * The quantity of usage events that have been recorded for a particular charge during the specified time period. These events may also be referred to as the number of transactions in some contexts.
1427
+ * @example 10
1428
+ */
1429
+ events_count?: number;
1280
1430
  /**
1281
1431
  * The amount in cents, tax excluded, consumed for a specific group related to a charge item.
1282
1432
  * @example 1000
@@ -1553,6 +1703,10 @@ export type CustomerObjectExtended = CustomerObject & {
1553
1703
  /** List of customer taxes */
1554
1704
  taxes?: TaxObject[];
1555
1705
  };
1706
+ export interface CustomerPastUsage {
1707
+ usage_periods: CustomerUsage[];
1708
+ meta: PaginationMeta;
1709
+ }
1556
1710
  export interface CustomersPaginated {
1557
1711
  customers: CustomerObjectExtended[];
1558
1712
  meta: PaginationMeta;
@@ -1579,6 +1733,12 @@ export interface CustomerUsageObject {
1579
1733
  * @example "2022-08-01T23:59:59Z"
1580
1734
  */
1581
1735
  issuing_date: string;
1736
+ /**
1737
+ * A unique identifier associated with the invoice related to this particular usage record.
1738
+ * @format uuid
1739
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1740
+ */
1741
+ lago_invoice_id?: string | null;
1582
1742
  /** The currency of the customer’s current usage. */
1583
1743
  currency?: Currency;
1584
1744
  /**
@@ -1714,12 +1874,12 @@ export interface EventObject {
1714
1874
  * @format uuid
1715
1875
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1716
1876
  */
1717
- lago_customer_id: string;
1877
+ lago_customer_id: string | null;
1718
1878
  /**
1719
1879
  * 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.
1720
1880
  * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
1721
1881
  */
1722
- external_customer_id: string;
1882
+ external_customer_id: string | null;
1723
1883
  /**
1724
1884
  * 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.
1725
1885
  * @example "storage"
@@ -1745,12 +1905,12 @@ export interface EventObject {
1745
1905
  * @format uuid
1746
1906
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1747
1907
  */
1748
- lago_subscription_id: string;
1908
+ lago_subscription_id: string | null;
1749
1909
  /**
1750
1910
  * 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.
1751
1911
  * @example "sub_1234567890"
1752
1912
  */
1753
- external_subscription_id: string;
1913
+ external_subscription_id: string | null;
1754
1914
  /**
1755
1915
  * 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
1756
1916
  * @format date-time
@@ -1822,6 +1982,11 @@ export interface FeeObject {
1822
1982
  * @example "external_id"
1823
1983
  */
1824
1984
  external_subscription_id?: string | null;
1985
+ /**
1986
+ * 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.
1987
+ * @example "Setup Fee (SF1)"
1988
+ */
1989
+ invoice_display_name?: string;
1825
1990
  /**
1826
1991
  * The cost of this specific fee, excluding any applicable taxes.
1827
1992
  * @example 100
@@ -1844,6 +2009,11 @@ export interface FeeObject {
1844
2009
  * @example "0.32"
1845
2010
  */
1846
2011
  units: string;
2012
+ /**
2013
+ * The unit amount of the fee per unit, with precision.
2014
+ * @example "312.5"
2015
+ */
2016
+ precise_unit_amount: string;
1847
2017
  /**
1848
2018
  * The cost of this specific fee, including any applicable taxes.
1849
2019
  * @example 120
@@ -1929,6 +2099,16 @@ export interface FeeObject {
1929
2099
  * @example "Startup"
1930
2100
  */
1931
2101
  name: string;
2102
+ /**
2103
+ * 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.
2104
+ * @example "Setup Fee (SF1)"
2105
+ */
2106
+ invoice_display_name?: string;
2107
+ /**
2108
+ * 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.
2109
+ * @example "Transactions - ACH"
2110
+ */
2111
+ group_invoice_display_name?: string;
1932
2112
  /**
1933
2113
  * 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`.
1934
2114
  * @format uuid
@@ -1984,6 +2164,11 @@ export interface GroupPropertiesObject {
1984
2164
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1985
2165
  */
1986
2166
  group_id: string;
2167
+ /**
2168
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual group will be used as the default display name.
2169
+ * @example "AWS"
2170
+ */
2171
+ invoice_display_name?: string;
1987
2172
  /** List of all thresholds utilized for calculating a charge, scoped by groups used as dimensions for a single charge. */
1988
2173
  values: ChargeProperties;
1989
2174
  }
@@ -2168,6 +2353,11 @@ export interface InvoiceOneOffCreateInput {
2168
2353
  * @example "setup_fee"
2169
2354
  */
2170
2355
  add_on_code: string;
2356
+ /**
2357
+ * 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.
2358
+ * @example "Setup Fee (SF1)"
2359
+ */
2360
+ invoice_display_name?: string;
2171
2361
  /**
2172
2362
  * The amount of the fee per unit, expressed in cents. By default, the amount of the add-on is used.
2173
2363
  * @example 12000
@@ -2440,6 +2630,11 @@ export interface PlanCreateInput {
2440
2630
  * @example "Startup"
2441
2631
  */
2442
2632
  name?: string;
2633
+ /**
2634
+ * 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.
2635
+ * @example "Startup plan"
2636
+ */
2637
+ invoice_display_name?: string;
2443
2638
  /**
2444
2639
  * The code of the plan. It serves as a unique identifier associated with a particular plan. The code is typically used for internal or system-level identification purposes, like assigning a subscription, for instance.
2445
2640
  * @example "startup"
@@ -2484,7 +2679,7 @@ export interface PlanCreateInput {
2484
2679
  tax_codes?: string[];
2485
2680
  /**
2486
2681
  * Additional usage-based charges for this plan.
2487
- * @example [{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","charge_model":"package","invoiceable":true,"pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"group_properties":[],"tax_codes":["french_standard_vat"]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","charge_model":"graduated","invoiceable":true,"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"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","charge_model":"standard","invoiceable":true,"pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{},"group_properties":[{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a01","values":{"amount":"10"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a02","values":{"amount":"5"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a03","values":{"amount":"8"}}]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","charge_model":"volume","invoiceable":true,"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"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","charge_model":"percentage","invoiceable":false,"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"},"group_properties":[]}]
2682
+ * @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},"group_properties":[],"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"}]},"group_properties":[]},{"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":{},"group_properties":[{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a01","invoice_display_name":"Europe","values":{"amount":"10"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a02","invoice_display_name":"USA","values":{"amount":"5"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a03","invoice_display_name":"Africa","values":{"amount":"8"}}]},{"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"}]},"group_properties":[]},{"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"},"group_properties":[]}]
2488
2683
  */
2489
2684
  charges?: {
2490
2685
  /**
@@ -2508,6 +2703,11 @@ export interface PlanCreateInput {
2508
2703
  * @example true
2509
2704
  */
2510
2705
  invoiceable?: boolean;
2706
+ /**
2707
+ * 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.
2708
+ * @example "Setup"
2709
+ */
2710
+ invoice_display_name?: string;
2511
2711
  /**
2512
2712
  * Specifies whether a charge is prorated based on the remaining number of days in the billing period or billed fully.
2513
2713
  *
@@ -2542,6 +2742,77 @@ export interface PlanCreateInput {
2542
2742
  }[];
2543
2743
  };
2544
2744
  }
2745
+ /** Based plan overrides. */
2746
+ export interface PlanOverridesObject {
2747
+ /**
2748
+ * 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.
2749
+ * @example 10000
2750
+ */
2751
+ amount_cents?: number;
2752
+ /** The currency of the plan. It indicates the monetary unit in which the plan's cost, including taxes and usage-based charges, is expressed. */
2753
+ amount_currency?: Currency;
2754
+ /**
2755
+ * The description on the plan.
2756
+ * @example "Plan for early stage startups."
2757
+ */
2758
+ description?: string;
2759
+ /**
2760
+ * 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.
2761
+ * @example "Startup plan"
2762
+ */
2763
+ invoice_display_name?: string;
2764
+ /**
2765
+ * The name of the plan.
2766
+ * @example "Startup"
2767
+ */
2768
+ name?: string;
2769
+ /**
2770
+ * List of unique code used to identify the taxes.
2771
+ * @example ["french_standard_vat"]
2772
+ */
2773
+ tax_codes?: string[];
2774
+ /**
2775
+ * The duration in days during which the base cost of the plan is offered for free.
2776
+ * @example 5
2777
+ */
2778
+ trial_period?: number;
2779
+ /** Additional usage-based charges for this plan. */
2780
+ charges?: {
2781
+ /**
2782
+ * Unique identifier of the charge created by Lago.
2783
+ * @format uuid
2784
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2785
+ */
2786
+ id?: string;
2787
+ /**
2788
+ * 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.
2789
+ * @example "Setup"
2790
+ */
2791
+ invoice_display_name?: string;
2792
+ /**
2793
+ * 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.
2794
+ * @example 0
2795
+ */
2796
+ min_amount_cents?: number;
2797
+ /** List of all thresholds utilized for calculating the charge. */
2798
+ properties?: ChargeProperties;
2799
+ /** All charge information, sorted by groups. */
2800
+ group_properties?: {
2801
+ /**
2802
+ * Unique identifier of a billable metric group, created by Lago.
2803
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2804
+ */
2805
+ group_id: string;
2806
+ /** List of all thresholds utilized for calculating a charge, scoped by groups used as dimensions for a single charge. */
2807
+ values: ChargeProperties;
2808
+ }[];
2809
+ /**
2810
+ * List of unique code used to identify the taxes.
2811
+ * @example ["french_standard_vat"]
2812
+ */
2813
+ tax_codes?: string[];
2814
+ }[];
2815
+ }
2545
2816
  export interface PlanUpdateInput {
2546
2817
  plan: {
2547
2818
  /**
@@ -2549,6 +2820,11 @@ export interface PlanUpdateInput {
2549
2820
  * @example "Startup"
2550
2821
  */
2551
2822
  name?: string;
2823
+ /**
2824
+ * 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.
2825
+ * @example "Startup plan"
2826
+ */
2827
+ invoice_display_name?: string;
2552
2828
  /**
2553
2829
  * The code of the plan. It serves as a unique identifier associated with a particular plan. The code is typically used for internal or system-level identification purposes, like assigning a subscription, for instance.
2554
2830
  * @example "startup"
@@ -2593,7 +2869,7 @@ export interface PlanUpdateInput {
2593
2869
  tax_codes?: string[];
2594
2870
  /**
2595
2871
  * Additional usage-based charges for this plan.
2596
- * @example [{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","charge_model":"package","invoiceable":true,"pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"group_properties":[],"tax_codes":["french_standard_vat"]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","charge_model":"graduated","invoiceable":true,"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"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","charge_model":"standard","invoiceable":true,"pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{},"group_properties":[{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a01","values":{"amount":"10"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a02","values":{"amount":"5"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a03","values":{"amount":"8"}}]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","charge_model":"volume","invoiceable":true,"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"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","charge_model":"percentage","invoiceable":false,"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"},"group_properties":[]}]
2872
+ * @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},"group_properties":[],"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"}]},"group_properties":[]},{"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":{},"group_properties":[{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a01","invoice_display_name":"Europe","values":{"amount":"10"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a02","invoice_display_name":"USA","values":{"amount":"5"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a03","invoice_display_name":"Africa","values":{"amount":"8"}}]},{"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"}]},"group_properties":[]},{"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"},"group_properties":[]}]
2597
2873
  */
2598
2874
  charges?: {
2599
2875
  /**
@@ -2623,6 +2899,11 @@ export interface PlanUpdateInput {
2623
2899
  * @example true
2624
2900
  */
2625
2901
  invoiceable?: boolean;
2902
+ /**
2903
+ * 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.
2904
+ * @example "Setup"
2905
+ */
2906
+ invoice_display_name?: string;
2626
2907
  /**
2627
2908
  * Specifies whether a charge is prorated based on the remaining number of days in the billing period or billed fully.
2628
2909
  *
@@ -2669,6 +2950,11 @@ export interface PlanObject {
2669
2950
  * @example "Startup"
2670
2951
  */
2671
2952
  name: string;
2953
+ /**
2954
+ * 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.
2955
+ * @example "Startup plan"
2956
+ */
2957
+ invoice_display_name?: string;
2672
2958
  /**
2673
2959
  * The date and time when the plan was created. It is expressed in UTC format according to the ISO 8601 datetime standard. This field provides the timestamp for the exact moment when the plan was initially created.
2674
2960
  * @format date-time
@@ -2724,7 +3010,7 @@ export interface PlanObject {
2724
3010
  draft_invoices_count: number;
2725
3011
  /**
2726
3012
  * Additional usage-based charges for this plan.
2727
- * @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,"pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"group_properties":[]},{"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,"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"}]},"group_properties":[]},{"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,"pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{},"group_properties":[{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a01","values":{"amount":"10"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a02","values":{"amount":"5"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a03","values":{"amount":"8"}}]},{"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,"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"}]},"group_properties":[]},{"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,"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"},"group_properties":[]}]
3013
+ * @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},"group_properties":[]},{"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"}]},"group_properties":[]},{"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":{},"group_properties":[{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a01","invoice_display_name":"Europe","values":{"amount":"10"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a02","invoice_display_name":"USA","values":{"amount":"5"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a03","invoice_display_name":"Africa","values":{"amount":"8"}}]},{"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"}]},"group_properties":[]},{"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"},"group_properties":[]}]
2728
3014
  */
2729
3015
  charges?: ChargeObject[];
2730
3016
  /** All taxes applied to the plan. */
@@ -2735,7 +3021,7 @@ export interface PlansPaginated {
2735
3021
  meta: PaginationMeta;
2736
3022
  }
2737
3023
  export interface Subscription {
2738
- subscription: SubscriptionObject;
3024
+ subscription: SubscriptionObjectExtended;
2739
3025
  }
2740
3026
  export interface SubscriptionCreateInput {
2741
3027
  subscription: {
@@ -2776,6 +3062,8 @@ export interface SubscriptionCreateInput {
2776
3062
  * @example "2022-08-08T00:00:00Z"
2777
3063
  */
2778
3064
  subscription_at?: string;
3065
+ /** Based plan overrides. */
3066
+ plan_overrides?: PlanOverridesObject;
2779
3067
  };
2780
3068
  }
2781
3069
  export interface SubscriptionUpdateInput {
@@ -2797,6 +3085,8 @@ export interface SubscriptionUpdateInput {
2797
3085
  * @example "2022-08-08T00:00:00Z"
2798
3086
  */
2799
3087
  subscription_at?: string;
3088
+ /** Based plan overrides. */
3089
+ plan_overrides?: PlanOverridesObject;
2800
3090
  };
2801
3091
  }
2802
3092
  export interface SubscriptionObject {
@@ -2899,6 +3189,9 @@ export interface SubscriptionObject {
2899
3189
  */
2900
3190
  downgrade_plan_date?: string | null;
2901
3191
  }
3192
+ export type SubscriptionObjectExtended = SubscriptionObject & {
3193
+ plan?: PlanObject;
3194
+ };
2902
3195
  export interface SubscriptionsPaginated {
2903
3196
  subscriptions: SubscriptionObject[];
2904
3197
  meta: PaginationMeta;
@@ -3352,7 +3645,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
3352
3645
  }
3353
3646
  /**
3354
3647
  * @title Lago API documentation
3355
- * @version 0.48.0-beta
3648
+ * @version 0.49.0-beta
3356
3649
  * @license AGPLv3
3357
3650
  * @baseUrl https://api.getlago.com/api/v1
3358
3651
  * @externalDocs https://github.com/getlago
@@ -3681,6 +3974,16 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
3681
3974
  * @secure
3682
3975
  */
3683
3976
  downloadCreditNote: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<CreditNote, ApiErrorUnauthorized | ApiErrorNotFound>>;
3977
+ /**
3978
+ * @description This endpoint allows you to retrieve amounts for a new credit note creation.
3979
+ *
3980
+ * @tags credit_notes
3981
+ * @name EstimateCreditNote
3982
+ * @summary Estimate amounts for a new credit note
3983
+ * @request POST:/credit_notes/estimate
3984
+ * @secure
3985
+ */
3986
+ estimateCreditNote: (data: CreditNoteEstimateInput, params?: RequestParams) => Promise<HttpResponse<CreditNoteEstimated, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
3684
3987
  /**
3685
3988
  * @description This endpoint voids an existing credit note.
3686
3989
  *
@@ -3788,6 +4091,42 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
3788
4091
  */
3789
4092
  external_subscription_id: string;
3790
4093
  }, params?: RequestParams) => Promise<HttpResponse<CustomerUsage, ApiErrorUnauthorized | ApiErrorNotFound>>;
4094
+ /**
4095
+ * @description This endpoint enables the retrieval of the usage-based billing data for a customer within past periods.
4096
+ *
4097
+ * @tags customers
4098
+ * @name FindAllCustomerPastUsage
4099
+ * @summary Retrieve customer past usage
4100
+ * @request GET:/customers/{external_customer_id}/past_usage
4101
+ * @secure
4102
+ */
4103
+ findAllCustomerPastUsage: (externalCustomerId: string, query: {
4104
+ /**
4105
+ * Page number.
4106
+ * @example 1
4107
+ */
4108
+ page?: number;
4109
+ /**
4110
+ * Number of records per page.
4111
+ * @example 20
4112
+ */
4113
+ per_page?: number;
4114
+ /**
4115
+ * The unique identifier of the subscription within your application.
4116
+ * @example "sub_1234567890"
4117
+ */
4118
+ external_subscription_id: string;
4119
+ /**
4120
+ * Billable metric code filter to apply to the charge usage
4121
+ * @example "cpu"
4122
+ */
4123
+ billable_metric_code?: string;
4124
+ /**
4125
+ * Number of past billing period to returns in the result
4126
+ * @example 5
4127
+ */
4128
+ periods_count?: number;
4129
+ }, params?: RequestParams) => Promise<HttpResponse<CustomerPastUsage, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
3791
4130
  };
3792
4131
  events: {
3793
4132
  /**
@@ -3799,7 +4138,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
3799
4138
  * @request POST:/events
3800
4139
  * @secure
3801
4140
  */
3802
- createEvent: (data: EventInput, params?: RequestParams) => Promise<HttpResponse<void, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
4141
+ createEvent: (data: EventInput, params?: RequestParams) => Promise<HttpResponse<Event, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
3803
4142
  /**
3804
4143
  * @description This endpoint is used for transmitting a batch of usage measurement events to multiple subscriptions for a single customer.
3805
4144
  *
@@ -3807,6 +4146,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
3807
4146
  * @name CreateBatchEvents
3808
4147
  * @summary Batch multiple events
3809
4148
  * @request POST:/events/batch
4149
+ * @deprecated
3810
4150
  * @secure
3811
4151
  */
3812
4152
  createBatchEvents: (data: EventBatchInput, params?: RequestParams) => Promise<HttpResponse<void, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
@@ -4185,6 +4525,16 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
4185
4525
  */
4186
4526
  status?: ("pending" | "canceled" | "terminated" | "active")[];
4187
4527
  }, params?: RequestParams) => Promise<HttpResponse<SubscriptionsPaginated, ApiErrorUnauthorized | ApiErrorNotFound>>;
4528
+ /**
4529
+ * @description This endpoint retrieves a specific subscription.
4530
+ *
4531
+ * @tags subscriptions
4532
+ * @name FindSubscription
4533
+ * @summary Retrieve a subscription
4534
+ * @request GET:/subscriptions/{external_id}
4535
+ * @secure
4536
+ */
4537
+ findSubscription: (externalId: string, params?: RequestParams) => Promise<HttpResponse<Subscription, ApiErrorUnauthorized | ApiErrorNotFound>>;
4188
4538
  /**
4189
4539
  * @description This endpoint allows you to update a subscription.
4190
4540
  *