lago-javascript-client 1.17.0 → 1.20.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.
@@ -373,7 +373,7 @@ export interface BaseAppliedTax {
373
373
  created_at?: string;
374
374
  }
375
375
  export interface BillableMetric {
376
- billable_metric: BillableMetricObjectExtended;
376
+ billable_metric: BillableMetricObject;
377
377
  }
378
378
  export interface BillableMetricObject {
379
379
  /**
@@ -443,42 +443,7 @@ export interface BillableMetricObject {
443
443
  */
444
444
  weighted_interval?: "seconds" | null;
445
445
  filters?: BillableMetricFilterObject[];
446
- /**
447
- * Number of active subscriptions using this billable metric.
448
- * @deprecated
449
- * @example 4
450
- */
451
- active_subscriptions_count: number;
452
- /**
453
- * Number of draft invoices for which this billable metric is listed as an invoice item.
454
- * @deprecated
455
- * @example 10
456
- */
457
- draft_invoices_count: number;
458
- /**
459
- * Number of plans using this billable metric.
460
- * @deprecated
461
- * @example 4
462
- */
463
- plans_count: number;
464
446
  }
465
- export type BillableMetricObjectExtended = BillableMetricObject & {
466
- /**
467
- * Number of active subscriptions using this billable metric.
468
- * @example 4
469
- */
470
- active_subscriptions_count?: number;
471
- /**
472
- * Number of draft invoices for which this billable metric is listed as an invoice item.
473
- * @example 10
474
- */
475
- draft_invoices_count?: number;
476
- /**
477
- * Number of plans using this billable metric.
478
- * @example 4
479
- */
480
- plans_count?: number;
481
- };
482
447
  export interface BillableMetricBaseInput {
483
448
  /**
484
449
  * Name of the billable metric.
@@ -1050,7 +1015,7 @@ export interface CouponObject {
1050
1015
  * @format date-time
1051
1016
  * @example "2022-08-08T23:59:59Z"
1052
1017
  */
1053
- terminated_at?: string;
1018
+ terminated_at?: string | null;
1054
1019
  }
1055
1020
  export interface CouponsPaginated {
1056
1021
  coupons: CouponObject[];
@@ -1407,6 +1372,11 @@ export interface CreditNoteObject {
1407
1372
  /** Array of credit note's items. */
1408
1373
  items?: CreditNoteItemObject[];
1409
1374
  applied_taxes?: CreditNoteAppliedTaxObject[];
1375
+ /**
1376
+ * Indicates if the credit note belongs to self-billed invoice. Self-billing is a process where an organization creates the invoice on behalf of the partner.
1377
+ * @example false
1378
+ */
1379
+ self_billed?: boolean;
1410
1380
  }
1411
1381
  export interface CreditNotes {
1412
1382
  credit_notes: CreditNoteObject[];
@@ -1472,6 +1442,44 @@ export interface CreditNoteUpdateInput {
1472
1442
  refund_status: "pending" | "succeeded" | "failed";
1473
1443
  };
1474
1444
  }
1445
+ export type CreditNoteExtendedObject = CreditNoteObject & {
1446
+ customer?: any;
1447
+ };
1448
+ export interface CreditNotePaymentProviderRefundError {
1449
+ /**
1450
+ * Unique identifier assigned to the credit note within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the credit note record within the Lago system.
1451
+ * @format uuid
1452
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1453
+ */
1454
+ lago_credit_note_id: string;
1455
+ /**
1456
+ * 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.
1457
+ * @format uuid
1458
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1459
+ */
1460
+ lago_customer_id: string;
1461
+ /**
1462
+ * The customer external unique identifier (provided by your own application)
1463
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
1464
+ */
1465
+ external_customer_id: string;
1466
+ /**
1467
+ * Unique identifier of the customer within the payment provider
1468
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
1469
+ */
1470
+ provider_customer_id?: string;
1471
+ /**
1472
+ * The type of payment provider code
1473
+ * @example "stripe"
1474
+ */
1475
+ payment_provider: "adyen" | "cashfree" | "gocardless" | "stripe";
1476
+ /**
1477
+ * Code of the payment provider
1478
+ * @example "Stripe Prod"
1479
+ */
1480
+ payment_provider_code?: string;
1481
+ provider_error?: string | Record<string, any>;
1482
+ }
1475
1483
  /** @example "USD" */
1476
1484
  export type Currency = "AED" | "AFN" | "ALL" | "AMD" | "ANG" | "AOA" | "ARS" | "AUD" | "AWG" | "AZN" | "BAM" | "BBD" | "BDT" | "BGN" | "BIF" | "BMD" | "BND" | "BOB" | "BRL" | "BSD" | "BWP" | "BYN" | "BZD" | "CAD" | "CDF" | "CHF" | "CLF" | "CLP" | "CNY" | "COP" | "CRC" | "CVE" | "CZK" | "DJF" | "DKK" | "DOP" | "DZD" | "EGP" | "ETB" | "EUR" | "FJD" | "FKP" | "GBP" | "GEL" | "GIP" | "GMD" | "GNF" | "GTQ" | "GYD" | "HKD" | "HNL" | "HRK" | "HTG" | "HUF" | "IDR" | "ILS" | "INR" | "ISK" | "JMD" | "JPY" | "KES" | "KGS" | "KHR" | "KMF" | "KRW" | "KYD" | "KZT" | "LAK" | "LBP" | "LKR" | "LRD" | "LSL" | "MAD" | "MDL" | "MGA" | "MKD" | "MMK" | "MNT" | "MOP" | "MRO" | "MUR" | "MVR" | "MWK" | "MXN" | "MYR" | "MZN" | "NAD" | "NGN" | "NIO" | "NOK" | "NPR" | "NZD" | "PAB" | "PEN" | "PGK" | "PHP" | "PKR" | "PLN" | "PYG" | "QAR" | "RON" | "RSD" | "RUB" | "RWF" | "SAR" | "SBD" | "SCR" | "SEK" | "SGD" | "SHP" | "SLL" | "SOS" | "SRD" | "STD" | "SZL" | "THB" | "TJS" | "TOP" | "TRY" | "TTD" | "TWD" | "TZS" | "UAH" | "UGX" | "USD" | "UYU" | "UZS" | "VND" | "VUV" | "WST" | "XAF" | "XCD" | "XOF" | "XPF" | "YER" | "ZAR" | "ZMW";
1477
1485
  export interface Customer {
@@ -1589,6 +1597,25 @@ export interface IntegrationCustomer {
1589
1597
  */
1590
1598
  subsidiary_id?: string;
1591
1599
  }
1600
+ export interface IntegrationProviderErrorObject {
1601
+ /**
1602
+ * Unique identifier assigned to the integration within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the integration's record within the Lago system.
1603
+ * @format uuid
1604
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1605
+ */
1606
+ lago_integration_id: string;
1607
+ /**
1608
+ * The type of integration provider
1609
+ * @example "netsuite"
1610
+ */
1611
+ provider: string;
1612
+ /**
1613
+ * Unique code used to identify an integration connection.
1614
+ * @example "netsuite-eu-1"
1615
+ */
1616
+ provider_code: string;
1617
+ provider_error: string | Record<string, any>;
1618
+ }
1592
1619
  /** Array of filter object, representing multiple dimensions for a charge item. */
1593
1620
  export type CustomerChargeFiltersUsageObject = {
1594
1621
  /**
@@ -1776,6 +1803,13 @@ export interface CustomerCreateInput {
1776
1803
  * @example "Belson"
1777
1804
  */
1778
1805
  lastname?: string | null;
1806
+ /**
1807
+ * The type of the account. It can have one of the following values:
1808
+ * - `customer`: the account is a customer, default value.
1809
+ * - `partner`: the account is a partner.
1810
+ * @example "customer"
1811
+ */
1812
+ account_type?: "customer" | "partner" | null;
1779
1813
  /**
1780
1814
  * The type of the customer. It can have one of the following values:
1781
1815
  * - `company`: the customer is a company.
@@ -1889,8 +1923,42 @@ export interface CustomerCreateInput {
1889
1923
  */
1890
1924
  display_in_invoice: boolean;
1891
1925
  }[];
1926
+ /**
1927
+ * Set to `true` to exclude all invoice custom sections from PDF generation for this customer only. False by default
1928
+ * @example false
1929
+ */
1930
+ skip_invoice_custom_sections?: boolean;
1931
+ /**
1932
+ * List of unique codes identifying the invoice custom sections.
1933
+ * @example ["eu_bank_details"]
1934
+ */
1935
+ invoice_custom_section_codes?: string[];
1892
1936
  };
1893
1937
  }
1938
+ export interface CustomerIntegratrionErrorObject {
1939
+ /**
1940
+ * 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.
1941
+ * @format uuid
1942
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1943
+ */
1944
+ lago_customer_id: string;
1945
+ /**
1946
+ * The customer external unique identifier (provided by your own application)
1947
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
1948
+ */
1949
+ external_customer_id: string;
1950
+ /**
1951
+ * The type of accounting provider code
1952
+ * @example "anrock"
1953
+ */
1954
+ accounting_provider: "anrock" | "hubspot" | "netsuite" | "okta" | "salesforce" | "xero";
1955
+ /**
1956
+ * Code of the accounting provider
1957
+ * @example "Netsuite Prod"
1958
+ */
1959
+ accounting_provider_code: string;
1960
+ provider_error: string | Record<string, any>;
1961
+ }
1894
1962
  /** Set of key-value pairs that you can attach to a customer. This can be useful for storing additional information about the customer in a structured format */
1895
1963
  export interface CustomerMetadata {
1896
1964
  /**
@@ -2006,6 +2074,13 @@ export type CustomerObject = {
2006
2074
  * @example "Belson"
2007
2075
  */
2008
2076
  lastname?: string | null;
2077
+ /**
2078
+ * The type of the account. It can have one of the following values:
2079
+ * - `customer`: the account is a customer.
2080
+ * - `partner`: the account is a partner.
2081
+ * @example "customer"
2082
+ */
2083
+ account_type?: "customer" | "partner";
2009
2084
  /**
2010
2085
  * The type of the customer. It can have one of the following values:
2011
2086
  * - `company`: the customer is a company.
@@ -2064,6 +2139,11 @@ export type CustomerObject = {
2064
2139
  * @example "inherit"
2065
2140
  */
2066
2141
  finalize_zero_amount_invoice?: "inherit" | "skip" | "finalize";
2142
+ /**
2143
+ * Set to true to exclude all invoice custom sections from PDF generation for this customer only.
2144
+ * @example false
2145
+ */
2146
+ skip_invoice_custom_sections?: boolean;
2067
2147
  /** Configuration specific to the payment provider, utilized for billing the customer. This object contains settings and parameters necessary for processing payments and invoicing the customer. */
2068
2148
  billing_configuration?: CustomerBillingConfiguration;
2069
2149
  /** Configuration specific to the payment provider, utilized for billing the customer. This object contains settings and parameters necessary for processing payments and invoicing the customer. */
@@ -2076,15 +2156,114 @@ export type CustomerObjectExtended = CustomerObject & {
2076
2156
  metadata?: CustomerMetadata[];
2077
2157
  /** List of customer taxes */
2078
2158
  taxes?: TaxObject[];
2159
+ /** The customer’s invoice custom section used for generating invoices. */
2160
+ applicable_invoice_custom_sections?: {
2161
+ /**
2162
+ * Unique identifier for the invoice custom section in the Lago application, generated by Lago to ensure record uniqueness within the system.
2163
+ * @format uuid
2164
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2165
+ */
2166
+ lago_id: string;
2167
+ /**
2168
+ * Name of the invoice custom section.
2169
+ * @example "EU Bank Details"
2170
+ */
2171
+ name: string;
2172
+ /**
2173
+ * Unique code identifying the invoice custom section for the API request.
2174
+ * @example "eu_bank_details"
2175
+ */
2176
+ code: string;
2177
+ /**
2178
+ * Internal description of the invoice custom section.
2179
+ * @example "This section contains the bank details for EU customers."
2180
+ */
2181
+ description?: string;
2182
+ /**
2183
+ * The value shown on the invoice PDF.
2184
+ * @example "Bank Name: Lago Bank, IBAN: FR7630004000031234567890143"
2185
+ */
2186
+ details?: string;
2187
+ /**
2188
+ * The name of the invoice custom section displayed on the invoice.
2189
+ * @example "Bank Details:"
2190
+ */
2191
+ display_name?: string;
2192
+ /**
2193
+ * Set to true if the invoice custom section is a default for the organization.
2194
+ * @example true
2195
+ */
2196
+ applied_to_organization?: boolean;
2197
+ /**
2198
+ * Unique identifier for the organization associated with the invoice custom section.
2199
+ * @format uuid
2200
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2201
+ */
2202
+ organization_id?: string;
2203
+ /**
2204
+ * Creation date of the tax.
2205
+ * @format date-time
2206
+ * @example "2023-07-06T14:35:58Z"
2207
+ */
2208
+ created_at?: string;
2209
+ }[];
2079
2210
  };
2080
2211
  export interface CustomerPastUsage {
2081
2212
  usage_periods: CustomerUsage[];
2082
2213
  meta: PaginationMeta;
2083
2214
  }
2215
+ export interface CustomerPaymentProvidernErrorObject {
2216
+ /**
2217
+ * 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.
2218
+ * @format uuid
2219
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2220
+ */
2221
+ lago_customer_id: string;
2222
+ /**
2223
+ * The customer external unique identifier (provided by your own application)
2224
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
2225
+ */
2226
+ external_customer_id: string;
2227
+ /**
2228
+ * The type of payment provider
2229
+ * @example "stripe"
2230
+ */
2231
+ payment_provider: "adyen" | "cashfree" | "gocardless" | "stripe";
2232
+ /**
2233
+ * Code of the payment provider
2234
+ * @example "Stripe Prod"
2235
+ */
2236
+ payment_provider_code: string;
2237
+ provider_error: string | Record<string, any>;
2238
+ }
2084
2239
  export interface CustomersPaginated {
2085
2240
  customers: CustomerObjectExtended[];
2086
2241
  meta: PaginationMeta;
2087
2242
  }
2243
+ export interface CustomerTaxProviderErrorObject {
2244
+ /**
2245
+ * 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.
2246
+ * @format uuid
2247
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2248
+ */
2249
+ lago_customer_id: string;
2250
+ /**
2251
+ * The customer external unique identifier (provided by your own application)
2252
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
2253
+ */
2254
+ external_customer_id: string;
2255
+ /**
2256
+ * The type of tax provider
2257
+ * @example "anrock"
2258
+ */
2259
+ tax_provider: "anrock" | "hubspot" | "netsuite" | "okta" | "salesforce" | "xero";
2260
+ /**
2261
+ * Code of the tax provider
2262
+ * @example "Stripe Prod"
2263
+ */
2264
+ tax_provider_code: string;
2265
+ provider_error: string | Record<string, any>;
2266
+ }
2088
2267
  export interface CustomerUsage {
2089
2268
  customer_usage: CustomerUsageObject;
2090
2269
  }
@@ -2136,6 +2315,15 @@ export interface CustomerUsageObject {
2136
2315
  /** Array of charges that comprise the current usage. It contains detailed information about individual charge items associated with the usage. */
2137
2316
  charges_usage: CustomerChargeUsageObject[];
2138
2317
  }
2318
+ export type CustomerViesCheckObject = {
2319
+ vies_check?: {
2320
+ /**
2321
+ * Whether the VIES check was successful
2322
+ * @example true
2323
+ */
2324
+ valid?: boolean;
2325
+ };
2326
+ };
2139
2327
  export interface Event {
2140
2328
  event: EventObject;
2141
2329
  }
@@ -2255,6 +2443,37 @@ export interface EventObject {
2255
2443
  */
2256
2444
  created_at: string;
2257
2445
  }
2446
+ export interface EventErrorsObject {
2447
+ /**
2448
+ * HTTP status code. It will always be 422
2449
+ * @example 422
2450
+ */
2451
+ status: number;
2452
+ /**
2453
+ * HTTP error description. It will always be "Unprocessable Entity"
2454
+ * @example "Unprocessable Entity"
2455
+ */
2456
+ error: string;
2457
+ message: string | Record<string, any>;
2458
+ event: EventObject;
2459
+ }
2460
+ export interface EventsErrorsObject {
2461
+ /**
2462
+ * List of event transaction_id with an invalid code
2463
+ * @example ["transaction_1234567890"]
2464
+ */
2465
+ invalid_code: string[];
2466
+ /**
2467
+ * List of event transaction_id with a missing aggregation property
2468
+ * @example ["transaction_1234567890"]
2469
+ */
2470
+ missing_aggregation_property: string[];
2471
+ /**
2472
+ * List of event transaction_id with invalid filter values
2473
+ * @example ["transaction_1234567890"]
2474
+ */
2475
+ invalid_filter_values: string[];
2476
+ }
2258
2477
  export interface Fee {
2259
2478
  fee: FeeObject;
2260
2479
  }
@@ -2618,6 +2837,11 @@ export interface FeeObject {
2618
2837
  per_unit_total_amount: string;
2619
2838
  }[];
2620
2839
  };
2840
+ /**
2841
+ * Indicates if the fee belongs to self-billed invoice. Self-billing is a process where an organization creates the invoice on behalf of the partner.
2842
+ * @example false
2843
+ */
2844
+ self_billed?: boolean;
2621
2845
  /** Item attached to the fee */
2622
2846
  item: {
2623
2847
  /**
@@ -2670,6 +2894,25 @@ export interface Fees {
2670
2894
  export type FeesPaginated = Fees & {
2671
2895
  meta: PaginationMeta;
2672
2896
  };
2897
+ export interface FeeTaxProviderErrorObject {
2898
+ /**
2899
+ * Code of the tax provider
2900
+ * @example "Stripe Prod"
2901
+ */
2902
+ tax_provider_code: string;
2903
+ /**
2904
+ * Unique identifier assigned to the charge that the fee belongs to
2905
+ * @format uuid
2906
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2907
+ */
2908
+ lago_charge_id: string | null;
2909
+ /**
2910
+ * Unique identifier assigned to the transaction. This field is specifically displayed when the fee type is `charge`.
2911
+ * @example "transaction_1234567890"
2912
+ */
2913
+ event_transaction_id: string | null;
2914
+ provider_error: string | Record<string, any>;
2915
+ }
2673
2916
  export interface FeeUpdateInput {
2674
2917
  fee: {
2675
2918
  /**
@@ -3008,14 +3251,15 @@ export type InvoiceObject = {
3008
3251
  */
3009
3252
  invoice_type: "subscription" | "add_on" | "credit" | "one_off" | "progressive_billing";
3010
3253
  /**
3011
- * The status of the invoice. It indicates the current state of the invoice and can have two possible values:
3254
+ * The status of the invoice. It indicates the current state of the invoice and can have following values:
3012
3255
  * - `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.
3013
3256
  * - `finalized`: the invoice has been issued and finalized. In this state, events cannot be ingested or added to the invoice anymore.
3014
3257
  * - `voided`: the invoice has been issued and subsequently voided. In this state, events cannot be ingested or added to the invoice anymore.
3258
+ * - `pending`: the invoice remains pending until the taxes are fetched from the external provider.
3015
3259
  * - `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.
3016
3260
  * @example "finalized"
3017
3261
  */
3018
- status: "draft" | "finalized" | "voided" | "failed";
3262
+ status: "draft" | "finalized" | "voided" | "failed" | "pending";
3019
3263
  /**
3020
3264
  * The status of the payment associated with the invoice. It can have one of the following values:
3021
3265
  * - `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.
@@ -3084,15 +3328,80 @@ export type InvoiceObject = {
3084
3328
  total_amount_cents: number;
3085
3329
  /** @example 3 */
3086
3330
  version_number: number;
3331
+ /**
3332
+ * Indicates if the invoice is self-billed. Self-billing is a process where an organization creates the invoice on behalf of the partner. This field specifies whether the invoice is self-billed or not.
3333
+ * @example false
3334
+ */
3335
+ self_billed?: boolean;
3087
3336
  /**
3088
3337
  * Contains the URL that provides direct access to the invoice PDF file. You can use this URL to download or view the PDF document of the invoice
3089
3338
  * @format uri
3090
3339
  * @example "https://getlago.com/invoice/file"
3091
3340
  */
3092
3341
  file_url?: string;
3342
+ /**
3343
+ * The date of the invoice 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 invoice object was created
3344
+ * @format date-time
3345
+ * @example "2022-04-29T08:59:51Z"
3346
+ */
3347
+ created_at: string;
3348
+ /**
3349
+ * The date of the invoice update, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC). The update_date provides a standardized and internationally recognized timestamp for when the invoice object was updated
3350
+ * @format date-time
3351
+ * @example "2022-04-29T08:59:51Z"
3352
+ */
3353
+ updated_at: string;
3093
3354
  } & {
3094
3355
  /** The customer on which the invoice applies. It refers to the customer account or entity associated with the invoice. */
3095
3356
  customer?: CustomerObject;
3357
+ billing_period?: {
3358
+ /**
3359
+ * Unique identifier assigned to the subscription, created by Lago.
3360
+ * @format uuid
3361
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3362
+ */
3363
+ lago_subscription_id: string;
3364
+ /**
3365
+ * Unique identifier assigned to the subscription in your application.
3366
+ * @example "external_id"
3367
+ */
3368
+ external_subscription_id: string;
3369
+ /**
3370
+ * Unique identifier assigned to the plan, created by Lago.
3371
+ * @format uuid
3372
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3373
+ */
3374
+ lago_plan_id?: string;
3375
+ /**
3376
+ * The beginning date of the subscription billing period. This field indicates the start date of the billing period associated with the subscription fee.
3377
+ * @format date-time
3378
+ * @example "2022-04-29T08:59:51Z"
3379
+ */
3380
+ subscription_from_datetime: string;
3381
+ /**
3382
+ * The ending date of the subscription billing period. This field indicates the end date of the billing period associated with the subscription fee.
3383
+ * @format date-time
3384
+ * @example "2022-05-29T08:59:51Z"
3385
+ */
3386
+ subscription_to_datetime: string;
3387
+ /**
3388
+ * The beginning date of the period that covers the charge fees. It is applicable only to the `charge` fees attached to the subscription. This field indicates the start date of the billing period or subscription period associated with the fees.
3389
+ * @format date-time
3390
+ * @example "2022-04-29T08:59:51Z"
3391
+ */
3392
+ charges_from_datetime: string;
3393
+ /**
3394
+ * The ending date of the period that covers the charge fees. It is applicable only to the `charge` fees attached to the subscription. This field indicates the end date of the billing period or subscription period associated with the fees.
3395
+ * @format date-time
3396
+ * @example "2022-05-29T08:59:51Z"
3397
+ */
3398
+ charges_to_datetime: string;
3399
+ /**
3400
+ * The reason explaining why this subscription appears on the invoice.
3401
+ * @example "subscription_starting"
3402
+ */
3403
+ invoicing_reason: "subscription_starting" | "subscription_periodic" | "subscription_terminating" | "in_advance_charge" | "in_advance_charge_periodic" | "progressive_billing";
3404
+ }[];
3096
3405
  metadata?: InvoiceMetadataObject[];
3097
3406
  applied_taxes?: InvoiceAppliedTaxObject[];
3098
3407
  applied_usage_thresholds?: AppliedUsageThresholdObject[] | null;
@@ -3167,6 +3476,41 @@ export interface InvoiceOneOffCreateInput {
3167
3476
  }[];
3168
3477
  };
3169
3478
  }
3479
+ export interface InvoicePaymentFailureObject {
3480
+ /**
3481
+ * Unique identifier assigned to the invoice within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the invoice's record within the Lago system.
3482
+ * @format uuid
3483
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3484
+ */
3485
+ lago_invoice_id: string;
3486
+ /**
3487
+ * 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.
3488
+ * @format uuid
3489
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3490
+ */
3491
+ lago_customer_id: string;
3492
+ /**
3493
+ * The customer external unique identifier (provided by your own application)
3494
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
3495
+ */
3496
+ external_customer_id: string;
3497
+ /**
3498
+ * Unique identifier of the customer within the payment provider
3499
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
3500
+ */
3501
+ provider_customer_id?: string;
3502
+ /**
3503
+ * The type of payment provider code
3504
+ * @example "stripe"
3505
+ */
3506
+ payment_provider: "adyen" | "cashfree" | "gocardless" | "stripe";
3507
+ /**
3508
+ * Code of the payment provider
3509
+ * @example "Stripe Prod"
3510
+ */
3511
+ payment_provider_code?: string;
3512
+ provider_error?: string | Record<string, any>;
3513
+ }
3170
3514
  export interface InvoicesPaginated {
3171
3515
  invoices: InvoiceObject[];
3172
3516
  meta: PaginationMeta;
@@ -3492,6 +3836,80 @@ export interface PaginationMeta {
3492
3836
  */
3493
3837
  total_count: number;
3494
3838
  }
3839
+ export interface PaymentObject {
3840
+ /**
3841
+ * The unique identifier of the paid resource, created by Lago.
3842
+ * @format uuid
3843
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3844
+ */
3845
+ lago_payable_id: string;
3846
+ /**
3847
+ * Unique identifier of the customer, created by Lago.
3848
+ * @format uuid
3849
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3850
+ */
3851
+ lago_customer_id: string;
3852
+ /**
3853
+ * The status of the payment within the payment provider
3854
+ * @example "processing"
3855
+ */
3856
+ status: string;
3857
+ /**
3858
+ * The customer external unique identifier (provided by your own application)
3859
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
3860
+ */
3861
+ external_id: string;
3862
+ /**
3863
+ * Unique identifier of the customer within the payment provider
3864
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
3865
+ */
3866
+ provider_customer_id: string;
3867
+ /**
3868
+ * Code of the payment provider
3869
+ * @example "Stripe Prod"
3870
+ */
3871
+ payment_provider_code?: string;
3872
+ /**
3873
+ * The type of payment provider
3874
+ * @example "stripe"
3875
+ */
3876
+ payment_provider_type: "adyen" | "cashfree" | "gocardless" | "stripe";
3877
+ /**
3878
+ * Unique identifier of the payment within the payment provider
3879
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
3880
+ */
3881
+ provider_payment_id: string;
3882
+ next_action: Record<string, any>;
3883
+ }
3884
+ export interface PaymentProviderErrorObject {
3885
+ /**
3886
+ * Unique identifier assigned to the payment provider within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the payment provider's record within the Lago system.
3887
+ * @format uuid
3888
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3889
+ */
3890
+ lago_payment_provider_id: string;
3891
+ /**
3892
+ * The name of payment provider
3893
+ * @example "Stripe Prod"
3894
+ */
3895
+ payment_provider_name: string;
3896
+ /**
3897
+ * Code of the payment provider
3898
+ * @example "stripe"
3899
+ */
3900
+ payment_provider_code: string;
3901
+ /**
3902
+ * The source of the error
3903
+ * @example "stripe"
3904
+ */
3905
+ source: "stripe";
3906
+ /**
3907
+ * The action that was being performed when the error occurred
3908
+ * @example "payment_provider.register_webhook"
3909
+ */
3910
+ action?: "payment_provider.register_webhook";
3911
+ provider_error: string | Record<string, any>;
3912
+ }
3495
3913
  export interface PaymentRequestObject {
3496
3914
  /**
3497
3915
  * Unique identifier of the payment request, created by Lago.
@@ -3533,6 +3951,46 @@ export interface PaymentRequestObject {
3533
3951
  customer: any;
3534
3952
  invoices: any[];
3535
3953
  }
3954
+ export interface PaymentRequestPaymentFailureObject {
3955
+ /**
3956
+ * Unique identifier assigned to the payment request within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the payment request record within the Lago system.
3957
+ * @format uuid
3958
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3959
+ */
3960
+ lago_payment_request_id: string;
3961
+ /**
3962
+ * List of unique identifiers assigned to the invoices within the Lago application. These IDs are exclusively created by Lago and serve as unique identifiers for the invoices records within the Lago system.
3963
+ * @example ["1a901a90-1a90-1a90-1a90-1a901a901a90"]
3964
+ */
3965
+ lago_invoice_ids: string[];
3966
+ /**
3967
+ * 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.
3968
+ * @format uuid
3969
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3970
+ */
3971
+ lago_customer_id: string;
3972
+ /**
3973
+ * The customer external unique identifier (provided by your own application)
3974
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
3975
+ */
3976
+ external_customer_id: string;
3977
+ /**
3978
+ * Unique identifier of the customer within the payment provider
3979
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
3980
+ */
3981
+ provider_customer_id?: string;
3982
+ /**
3983
+ * The type of payment provider code
3984
+ * @example "stripe"
3985
+ */
3986
+ payment_provider: "adyen" | "cashfree" | "gocardless" | "stripe";
3987
+ /**
3988
+ * Code of the payment provider
3989
+ * @example "Stripe Prod"
3990
+ */
3991
+ payment_provider_code?: string;
3992
+ provider_error?: string | Record<string, any>;
3993
+ }
3536
3994
  export interface PaymentRequestsPaginated {
3537
3995
  payment_requests: PaymentRequestObject[];
3538
3996
  meta: PaginationMeta;
@@ -3943,16 +4401,6 @@ export interface PlanObject {
3943
4401
  * @example null
3944
4402
  */
3945
4403
  bill_charges_monthly?: boolean | null;
3946
- /**
3947
- * The count of active subscriptions that are currently associated with the plan. This field provides valuable information regarding the impact of deleting the plan. By checking the value of this field, you can determine the number of subscriptions that will be affected if the plan is deleted.
3948
- * @example 0
3949
- */
3950
- active_subscriptions_count: number;
3951
- /**
3952
- * The number of draft invoices that include a subscription attached to the plan. This field provides valuable information about the impact of deleting the plan. By checking the value of this field, you can determine the number of draft invoices that will be affected if the plan is deleted.
3953
- * @example 0
3954
- */
3955
- draft_invoices_count: number;
3956
4404
  minimum_commitment?: MinimumCommitmentObject;
3957
4405
  /**
3958
4406
  * Additional usage-based charges for this plan.
@@ -4042,6 +4490,15 @@ export interface SubscriptionUpdateInput {
4042
4490
  plan_overrides?: PlanOverridesObject;
4043
4491
  };
4044
4492
  }
4493
+ export type SubscriptionWithCustomerObject = SubscriptionObject & {
4494
+ plan?: PlanObject;
4495
+ customer?: CustomerObject;
4496
+ };
4497
+ export type SubscriptionWithThresholdObject = SubscriptionObject & {
4498
+ plan?: PlanObject;
4499
+ customer?: CustomerObject;
4500
+ usage_threshold?: UsageThresholdObject;
4501
+ };
4045
4502
  export interface SubscriptionObject {
4046
4503
  /**
4047
4504
  * Unique identifier assigned to the subscription within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the subscription's record within the Lago system
@@ -4112,7 +4569,7 @@ export interface SubscriptionObject {
4112
4569
  * @format date-time
4113
4570
  * @example "2022-10-08T00:00:00Z"
4114
4571
  */
4115
- ending_at?: string;
4572
+ ending_at?: string | null;
4116
4573
  /**
4117
4574
  * The anniversary date and time of the initial subscription. This date serves as the basis for billing subscriptions with `anniversary` billing time. The `anniversary_date` should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
4118
4575
  * @format date-time
@@ -4237,26 +4694,6 @@ export interface TaxObject {
4237
4694
  * @example true
4238
4695
  */
4239
4696
  applied_to_organization: boolean;
4240
- /**
4241
- * Number of add-ons this tax is applied to.
4242
- * @example 0
4243
- */
4244
- add_ons_count?: number;
4245
- /**
4246
- * Number of charges this tax is applied to.
4247
- * @example 0
4248
- */
4249
- charges_count?: number;
4250
- /**
4251
- * Number of customers this tax is applied to (directly or via the organization's default).
4252
- * @example 0
4253
- */
4254
- customers_count: number;
4255
- /**
4256
- * Number of plans this tax is applied to.
4257
- * @example 0
4258
- */
4259
- plans_count?: number;
4260
4697
  /**
4261
4698
  * Creation date of the tax.
4262
4699
  * @format date-time
@@ -4623,7 +5060,7 @@ export interface WalletObject {
4623
5060
  */
4624
5061
  ongoing_balance_cents: number;
4625
5062
  /**
4626
- * The ongoing usage balance of the wallet, expressed in cents. This reflects all current usage including taxes.
5063
+ * The ongoing usage balance of the wallet, expressed in cents. This reflects all current usage and draft invoices including taxes.
4627
5064
  * @example 200
4628
5065
  */
4629
5066
  ongoing_usage_balance_cents: number;
@@ -4634,7 +5071,7 @@ export interface WalletObject {
4634
5071
  */
4635
5072
  credits_ongoing_balance: string;
4636
5073
  /**
4637
- * The ongoing usage balance of the wallet, expressed in credits. This reflects all current usage including taxes.
5074
+ * The ongoing usage balance of the wallet, expressed in credits. This reflects all current usage and draft invoices including taxes.
4638
5075
  * @pattern ^[0-9]+.?[0-9]*$
4639
5076
  * @example "2.0"
4640
5077
  */
@@ -4760,6 +5197,41 @@ export interface WalletTransactionObject {
4760
5197
  */
4761
5198
  created_at: string;
4762
5199
  }
5200
+ export interface WalletTransactionPaymentFailureObject {
5201
+ /**
5202
+ * Unique identifier assigned to the wallet transaction within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the wallet transaction's record within the Lago system.
5203
+ * @format uuid
5204
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
5205
+ */
5206
+ lago_wallet_transaction_id: string;
5207
+ /**
5208
+ * 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.
5209
+ * @format uuid
5210
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
5211
+ */
5212
+ lago_customer_id: string;
5213
+ /**
5214
+ * The customer external unique identifier (provided by your own application)
5215
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
5216
+ */
5217
+ external_customer_id: string;
5218
+ /**
5219
+ * Unique identifier of the customer within the payment provider
5220
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
5221
+ */
5222
+ provider_customer_id?: string;
5223
+ /**
5224
+ * The type of payment provider code
5225
+ * @example "stripe"
5226
+ */
5227
+ payment_provider: "adyen" | "cashfree" | "gocardless" | "stripe";
5228
+ /**
5229
+ * Code of the payment provider
5230
+ * @example "Stripe Prod"
5231
+ */
5232
+ payment_provider_code?: string;
5233
+ provider_error?: string | Record<string, any>;
5234
+ }
4763
5235
  export interface WalletTransactions {
4764
5236
  wallet_transactions: WalletTransactionObject[];
4765
5237
  }
@@ -4980,7 +5452,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
4980
5452
  }
4981
5453
  /**
4982
5454
  * @title Lago API documentation
4983
- * @version 1.17.0
5455
+ * @version 1.20.0
4984
5456
  * @license AGPLv3
4985
5457
  * @baseUrl https://api.getlago.com/api/v1
4986
5458
  * @externalDocs https://github.com/getlago
@@ -5376,6 +5848,54 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
5376
5848
  * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
5377
5849
  */
5378
5850
  external_customer_id?: string;
5851
+ /**
5852
+ * Filter credit notes starting from a specific date.
5853
+ * @format date
5854
+ * @example "2022-07-08"
5855
+ */
5856
+ issuing_date_from?: string;
5857
+ /**
5858
+ * Filter credit notes up to a specific date.
5859
+ * @format date
5860
+ * @example "2022-08-09"
5861
+ */
5862
+ issuing_date_to?: string;
5863
+ /**
5864
+ * Search credit notes by id, number, customer name, customer external_id or customer email.
5865
+ * @example "Jane"
5866
+ */
5867
+ search_term?: string;
5868
+ /**
5869
+ * Filter credit notes by currency. Possible values ISO 4217 currency codes.
5870
+ * @example "EUR"
5871
+ */
5872
+ currency?: string;
5873
+ /** Filter credit notes by reasons. Possible values are `product_unsatisfactory`, `order_change`, `order_cancellation`, `fraudulent_charge`, `duplicated_charge` or `other`. */
5874
+ reason?: "product_unsatisfactory" | "order_change" | "order_cancellation" | "fraudulent_charge" | "duplicated_charge" | "other";
5875
+ /** Filter credit notes by credit status. Possible values are `available`, `consumed` or `voided`. */
5876
+ credit_status?: "available" | "consumed" | "voided";
5877
+ /** Filter credit notes by refund status. Possible values are `pending`, `succeeded` or `failed`. */
5878
+ refund_status?: "pending" | "succeeded" | "failed";
5879
+ /**
5880
+ * Filter credit notes by their related invoice number.
5881
+ * @example "INV-001-002"
5882
+ */
5883
+ invoice_number?: string;
5884
+ /**
5885
+ * Filter credit notes of at least a specific amount. This parameter must be defined in cents to ensure consistent handling for all currency types.
5886
+ * @example 9000
5887
+ */
5888
+ amount_from?: number;
5889
+ /**
5890
+ * Filter credit notes up to a specific amount. This parameter must be defined in cents to ensure consistent handling for all currency types.
5891
+ * @example 100000
5892
+ */
5893
+ amount_to?: number;
5894
+ /**
5895
+ * Filter credit notes belonging to a self billed invoice. Possible values are `true` or `false`.
5896
+ * @example true
5897
+ */
5898
+ self_billed?: boolean;
5379
5899
  }, params?: RequestParams) => Promise<HttpResponse<CreditNotes, ApiErrorUnauthorized>>;
5380
5900
  /**
5381
5901
  * @description This endpoint updates an existing credit note.
@@ -5459,6 +5979,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
5459
5979
  * @example 20
5460
5980
  */
5461
5981
  per_page?: number;
5982
+ /**
5983
+ * Filter customers by account type.
5984
+ * @example ["customer","partner"]
5985
+ */
5986
+ account_type?: ("customer" | "partner")[];
5462
5987
  }, params?: RequestParams) => Promise<HttpResponse<CustomersPaginated, ApiErrorUnauthorized>>;
5463
5988
  /**
5464
5989
  * @description This endpoint retrieves an existing customer.
@@ -5575,17 +6100,22 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
5575
6100
  * 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
5576
6101
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
5577
6102
  */
5578
- lago_customer_id?: string | undefined;
6103
+ lago_customer_id: string;
5579
6104
  /**
5580
6105
  * The customer external unique identifier (provided by your own application)
5581
6106
  * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
5582
6107
  */
5583
- external_customer_id?: string | undefined;
6108
+ external_customer_id: string;
5584
6109
  /**
5585
6110
  * The Payment Provider name linked to the Customer.
5586
6111
  * @example "stripe"
5587
6112
  */
5588
- payment_provider?: string | undefined;
6113
+ payment_provider: string;
6114
+ /**
6115
+ * Code of the payment provider
6116
+ * @example "Stripe Prod"
6117
+ */
6118
+ payment_provider_code?: string | undefined;
5589
6119
  /**
5590
6120
  * The new generated Payment Provider Checkout URL for the Customer.
5591
6121
  * @example "https://foo.bar"
@@ -5713,6 +6243,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
5713
6243
  * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
5714
6244
  */
5715
6245
  external_subscription_id?: string;
6246
+ /**
6247
+ * Filter results by event transaction ID
6248
+ * @example "et_12345678"
6249
+ */
6250
+ event_transaction_id?: string;
5716
6251
  /** Filter results by fee's currency. */
5717
6252
  currency?: Currency;
5718
6253
  /**
@@ -5846,6 +6381,16 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
5846
6381
  * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
5847
6382
  */
5848
6383
  external_customer_id?: string;
6384
+ /**
6385
+ * Filter invoices of at least a specific amount. This parameter must be defined in cents to ensure consistent handling for all currency types.
6386
+ * @example 9000
6387
+ */
6388
+ amount_from?: number;
6389
+ /**
6390
+ * Filter invoices up to a specific amount. This parameter must be defined in cents to ensure consistent handling for all currency types.
6391
+ * @example 100000
6392
+ */
6393
+ amount_to?: number;
5849
6394
  /**
5850
6395
  * Filter invoices starting from a specific date.
5851
6396
  * @format date
@@ -5873,7 +6418,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
5873
6418
  */
5874
6419
  search_term?: string;
5875
6420
  /**
5876
- * Filter invoices by currency in. Possible values ISO 4217 currency codes.
6421
+ * Filter invoices by currency. Possible values ISO 4217 currency codes.
5877
6422
  * @example "EUR"
5878
6423
  */
5879
6424
  currency?: string;
@@ -5884,6 +6429,16 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
5884
6429
  payment_dispute_lost?: boolean;
5885
6430
  /** Filter invoices by invoice type. Possible values are `subscription`, `add_on`, `credit`, `one_off` or `advance_charges` */
5886
6431
  invoice_type?: "subscription" | "add_on" | "credit" | "one_off" | "advance_charges";
6432
+ /**
6433
+ * Filter invoices by self billed. Possible values are `true` or `false`.
6434
+ * @example true
6435
+ */
6436
+ self_billed?: boolean;
6437
+ /**
6438
+ * Filter invoices by metadata. Replace `key` with the actual metadata key you want to match, and provide the corresponding value. Providing empty value will search for invoice without given metadata key. For example, `metadata[color]=blue`.
6439
+ * @example "someValue"
6440
+ */
6441
+ "metadata[key]"?: string;
5887
6442
  }, params?: RequestParams) => Promise<HttpResponse<InvoicesPaginated, ApiErrorUnauthorized>>;
5888
6443
  /**
5889
6444
  * @description This endpoint is used for updating an existing invoice.
@@ -6042,7 +6597,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
6042
6597
  * The customer external unique identifier (provided by your own application)
6043
6598
  * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
6044
6599
  */
6045
- customer_external_id?: string;
6600
+ external_customer_id: string;
6046
6601
  /**
6047
6602
  * The customer's email address used for sending dunning notifications
6048
6603
  * @format email