lago-javascript-client 1.49.0 → 1.52.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.
@@ -361,7 +361,7 @@ export interface TaxObject {
361
361
  */
362
362
  rate: number;
363
363
  /**
364
- * This field is deprecated and will be removed in a future version. When set to true, it applies the tax to the organization's default billing entity. To apply or remove a tax from any billing entity (including the default one), please use the `PUT /billing_entities/:code` endpoint instead.
364
+ * **Deprecated.** This field will be removed in a future version. When set to true, it applies the tax to the organization's default billing entity. To apply or remove a tax from any billing entity (including the default one), please use the `PUT /billing_entities/:code` endpoint instead.
365
365
  * @deprecated
366
366
  * @example true
367
367
  */
@@ -406,7 +406,7 @@ export interface InvoiceCustomSectionObject {
406
406
  */
407
407
  display_name?: string;
408
408
  /**
409
- * This field is deprecated and will be removed in a future version. When set to true, it applies the invoice custom section to the organization's default billing entity. To apply or remove an invoice custom section from any billing entity (including the default one), please use the `PUT /billing_entities/:code` endpoint instead.
409
+ * **Deprecated.** This field will be removed in a future version. When set to true, it applies the invoice custom section to the organization's default billing entity. To apply or remove an invoice custom section from any billing entity (including the default one), please use the `PUT /billing_entities/:code` endpoint instead.
410
410
  * @deprecated
411
411
  * @example true
412
412
  */
@@ -2645,6 +2645,54 @@ export interface CustomerBaseObject {
2645
2645
  shipping_address?: Address;
2646
2646
  metadata?: CustomerMetadata[];
2647
2647
  }
2648
+ /** Configuration specific to the accounting and tax integrations. This object contains settings and parameters necessary for syncing documents and payments. */
2649
+ export interface IntegrationCustomer {
2650
+ /**
2651
+ * A unique identifier for the integration customer object in the Lago application.
2652
+ * @format uuid
2653
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2654
+ */
2655
+ lago_id: string;
2656
+ /**
2657
+ * The integration type used for accounting and tax syncs.
2658
+ * Accepted values: `netsuite, anrok`.
2659
+ * @example "netsuite"
2660
+ */
2661
+ type: "netsuite" | "anrok" | "xero" | "hubspot" | "salesforce";
2662
+ /**
2663
+ * Unique code used to identify an integration connection.
2664
+ * @example "netsuite-eu-1"
2665
+ */
2666
+ integration_code: string;
2667
+ /**
2668
+ * The customer ID within the integration's system. If this field is not provided, Lago has the option to create a new customer record within the integration's system on behalf of the customer.
2669
+ * @example "cus_12345"
2670
+ */
2671
+ external_customer_id: string;
2672
+ /**
2673
+ * Set this field to `true` if you want to create a customer record in the integration's system. This option is applicable only when the `external_customer_id` is null and the `sync_with_provider` field is set to `true`. By default, the value is set to `false`
2674
+ * @example true
2675
+ */
2676
+ sync_with_provider?: boolean | null;
2677
+ /**
2678
+ * This optional field is needed only when working with `netsuite` connection.
2679
+ * @example "2"
2680
+ */
2681
+ subsidiary_id?: string;
2682
+ /**
2683
+ * This optional field is present only when working with `hubspot` connection.
2684
+ * @example "contacts"
2685
+ */
2686
+ targeted_object?: string | null;
2687
+ /**
2688
+ * This optional field is present only when working with `hubspot` connection.
2689
+ * @example "dinesh@piedpiper.test"
2690
+ */
2691
+ email?: string | null;
2692
+ }
2693
+ export type CustomerObject = CustomerBaseObject & {
2694
+ integration_customers?: IntegrationCustomer[];
2695
+ };
2648
2696
  /**
2649
2697
  * Custom metadata stored as key-value pairs.
2650
2698
  * Keys are strings (max 100 characters), values can be strings (max 255 characters) or null.
@@ -2699,6 +2747,11 @@ export interface CreditNoteObject {
2699
2747
  * @example "LAG-1234"
2700
2748
  */
2701
2749
  invoice_number: string;
2750
+ /**
2751
+ * The purchase order number of the invoice the credit note belongs to.
2752
+ * @example "PO-123"
2753
+ */
2754
+ purchase_order_number?: string | null;
2702
2755
  /**
2703
2756
  * The date of creation of the credit note. It follows the ISO 8601 date format and provides the specific date when the credit note was created.
2704
2757
  * @format date
@@ -2809,7 +2862,7 @@ export interface CreditNoteObject {
2809
2862
  * @example false
2810
2863
  */
2811
2864
  self_billed?: boolean;
2812
- customer?: CustomerBaseObject;
2865
+ customer?: CustomerObject;
2813
2866
  /**
2814
2867
  * Custom metadata stored as key-value pairs.
2815
2868
  * Keys are strings (max 100 characters), values can be strings (max 255 characters) or null.
@@ -2882,7 +2935,7 @@ export interface CreditNoteCreateInput {
2882
2935
  };
2883
2936
  }
2884
2937
  export type CreditNoteExtendedObject = CreditNoteObject & {
2885
- customer?: CustomerBaseObject;
2938
+ customer?: CustomerObject;
2886
2939
  };
2887
2940
  export interface CreditNoteExtended {
2888
2941
  credit_note: CreditNoteExtendedObject;
@@ -3069,54 +3122,6 @@ export interface CreditNoteMetadataResponse {
3069
3122
  */
3070
3123
  metadata: MetadataObject;
3071
3124
  }
3072
- /** Configuration specific to the accounting and tax integrations. This object contains settings and parameters necessary for syncing documents and payments. */
3073
- export interface IntegrationCustomer {
3074
- /**
3075
- * A unique identifier for the integration customer object in the Lago application.
3076
- * @format uuid
3077
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3078
- */
3079
- lago_id: string;
3080
- /**
3081
- * The integration type used for accounting and tax syncs.
3082
- * Accepted values: `netsuite, anrok`.
3083
- * @example "netsuite"
3084
- */
3085
- type: "netsuite" | "anrok" | "xero" | "hubspot" | "salesforce";
3086
- /**
3087
- * Unique code used to identify an integration connection.
3088
- * @example "netsuite-eu-1"
3089
- */
3090
- integration_code: string;
3091
- /**
3092
- * The customer ID within the integration's system. If this field is not provided, Lago has the option to create a new customer record within the integration's system on behalf of the customer.
3093
- * @example "cus_12345"
3094
- */
3095
- external_customer_id: string;
3096
- /**
3097
- * Set this field to `true` if you want to create a customer record in the integration's system. This option is applicable only when the `external_customer_id` is null and the `sync_with_provider` field is set to `true`. By default, the value is set to `false`
3098
- * @example true
3099
- */
3100
- sync_with_provider?: boolean | null;
3101
- /**
3102
- * This optional field is needed only when working with `netsuite` connection.
3103
- * @example "2"
3104
- */
3105
- subsidiary_id?: string;
3106
- /**
3107
- * This optional field is present only when working with `hubspot` connection.
3108
- * @example "contacts"
3109
- */
3110
- targeted_object?: string | null;
3111
- /**
3112
- * This optional field is present only when working with `hubspot` connection.
3113
- * @example "dinesh@piedpiper.test"
3114
- */
3115
- email?: string | null;
3116
- }
3117
- export type CustomerObject = CustomerBaseObject & {
3118
- integration_customers?: IntegrationCustomer[];
3119
- };
3120
3125
  export interface ErrorDetailObject {
3121
3126
  /**
3122
3127
  * Unique identifier assigned to the error_detail within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the error's record within the Lago system.
@@ -3204,7 +3209,8 @@ export interface CustomerCreateInput {
3204
3209
  */
3205
3210
  logo_url?: string | null;
3206
3211
  /**
3207
- * The full name of the customer
3212
+ * The full name of the customer (255 characters max).
3213
+ * @maxLength 255
3208
3214
  * @example "Gavin Belson"
3209
3215
  */
3210
3216
  name?: string | null;
@@ -3372,6 +3378,11 @@ export interface InvoiceBaseObject {
3372
3378
  * @example "LAG-1234-001-002"
3373
3379
  */
3374
3380
  number: string;
3381
+ /**
3382
+ * The purchase order number associated with the invoice. It is inherited from the subscription, wallet or wallet transaction the invoice was generated for.
3383
+ * @example "PO-123"
3384
+ */
3385
+ purchase_order_number?: string | null;
3375
3386
  /**
3376
3387
  * The date when the invoice was issued. It is provided in the ISO 8601 date format.
3377
3388
  * @format date
@@ -3412,9 +3423,10 @@ export interface InvoiceBaseObject {
3412
3423
  * - `voided`: the invoice has been issued and subsequently voided. In this state, events cannot be ingested or added to the invoice anymore.
3413
3424
  * - `pending`: the invoice remains pending until the taxes are fetched from the external provider.
3414
3425
  * - `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.
3426
+ * - `deleted`: the draft invoice has been permanently deleted. This status is only returned by the delete endpoint and its webhook; a deleted invoice is no longer retrievable afterwards.
3415
3427
  * @example "finalized"
3416
3428
  */
3417
- status: "draft" | "finalized" | "voided" | "failed" | "pending";
3429
+ status: "draft" | "finalized" | "voided" | "failed" | "pending" | "deleted";
3418
3430
  /**
3419
3431
  * The status of the payment associated with the invoice. It can have one of the following values:
3420
3432
  * - `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.
@@ -3504,6 +3516,12 @@ export interface InvoiceBaseObject {
3504
3516
  * @example "https://getlago.com/invoice/file"
3505
3517
  */
3506
3518
  file_url?: string;
3519
+ /**
3520
+ * Contains the URL to the invoice page in the Lago dashboard. It is `null` for invoices that are not visible in the dashboard (for example while still generating). Use it to link users directly to the invoice overview page.
3521
+ * @format uri
3522
+ * @example "https://app.getlago.com/acme/customer/1a901a90-1a90-1a90-1a90-1a901a901a90/invoice/2b012b01-2b01-2b01-2b01-2b012b012b01/overview"
3523
+ */
3524
+ web_url?: string | null;
3507
3525
  /**
3508
3526
  * 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
3509
3527
  * @format date-time
@@ -3530,7 +3548,8 @@ export interface InvoiceMetadataObject {
3530
3548
  */
3531
3549
  key?: string;
3532
3550
  /**
3533
- * Represents the value of the metadata's key-value pair.
3551
+ * Represents the value of the metadata's key-value pair (140 characters max).
3552
+ * @maxLength 140
3534
3553
  * @example "INV-0123456-98765"
3535
3554
  */
3536
3555
  value?: string;
@@ -3817,7 +3836,7 @@ export interface AppliedInvoiceCustomSectionObject {
3817
3836
  */
3818
3837
  created_at: string;
3819
3838
  /**
3820
- * Unique identifier of the invoice custom section that was applied.
3839
+ * **Deprecated.** Unique identifier of the invoice custom section that was applied.
3821
3840
  * @deprecated
3822
3841
  * @format uuid
3823
3842
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
@@ -3839,6 +3858,54 @@ export interface PaymentMethodReference {
3839
3858
  */
3840
3859
  payment_method_id?: string;
3841
3860
  }
3861
+ export interface SubscriptionActivationRuleObject {
3862
+ /**
3863
+ * Unique identifier assigned to the activation rule within the Lago application. This ID is exclusively created by Lago.
3864
+ * @format uuid
3865
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3866
+ */
3867
+ lago_id: string;
3868
+ /**
3869
+ * The type of the activation rule. Only `payment` is currently supported. A `payment` rule gates the subscription activation on a successful payment of the first invoice.
3870
+ * @example "payment"
3871
+ */
3872
+ type: "payment";
3873
+ /**
3874
+ * The number of hours the subscription stays in the `incomplete` state waiting for the payment to succeed before it is automatically canceled.
3875
+ * @example 48
3876
+ */
3877
+ timeout_hours: number;
3878
+ /**
3879
+ * The evaluation status of the activation rule:
3880
+ * - `inactive`: the rule has not been evaluated yet.
3881
+ * - `pending`: the rule is applicable and is waiting to be satisfied (e.g. waiting for the payment).
3882
+ * - `satisfied`: the rule has been satisfied and no longer blocks activation.
3883
+ * - `declined`: the rule was applicable but was declined.
3884
+ * - `failed`: the rule could not be satisfied (e.g. the payment failed).
3885
+ * - `expired`: the rule was not satisfied before its timeout elapsed.
3886
+ * - `not_applicable`: the rule did not apply to this subscription.
3887
+ * @example "pending"
3888
+ */
3889
+ status: "inactive" | "pending" | "satisfied" | "declined" | "failed" | "expired" | "not_applicable";
3890
+ /**
3891
+ * The date and time when the rule expires, after which an unsatisfied rule causes the subscription to be canceled. Represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC). Null until the rule starts being evaluated.
3892
+ * @format date-time
3893
+ * @example "2022-08-10T00:00:00Z"
3894
+ */
3895
+ expires_at?: string | null;
3896
+ /**
3897
+ * The creation date of the activation rule, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
3898
+ * @format date-time
3899
+ * @example "2022-08-08T00:00:00Z"
3900
+ */
3901
+ created_at: string;
3902
+ /**
3903
+ * The last update date of the activation rule, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
3904
+ * @format date-time
3905
+ * @example "2022-08-08T00:00:00Z"
3906
+ */
3907
+ updated_at: string;
3908
+ }
3842
3909
  export interface SubscriptionObject {
3843
3910
  /**
3844
3911
  * 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
@@ -3895,12 +3962,13 @@ export interface SubscriptionObject {
3895
3962
  /**
3896
3963
  * The status of the subscription, which can have the following values:
3897
3964
  * - `active`: the subscription is currently active and applied to the customer.
3898
- * - `canceled`: the subscription has been stopped before its activation. This can occur when two consecutive downgrades have been applied to a customer or when a subscription with a pending status is terminated.
3965
+ * - `canceled`: the subscription has been stopped before its activation. This can occur when two consecutive downgrades have been applied to a customer, when a subscription with a pending status is terminated, or when a payment-gated subscription fails to be paid (or its activation rule expires) before activation. When caused by payment gating, the `cancellation_reason` field is set.
3966
+ * - `incomplete`: the subscription was created with a payment activation rule and is waiting for the gating payment to succeed before it becomes `active`. It is automatically `canceled` if the payment fails or the activation rule expires.
3899
3967
  * - `pending`: a previous subscription has been downgraded, and the current one is awaiting automatic activation at the end of the billing period.
3900
3968
  * - `terminated`: the subscription is no longer active.
3901
3969
  * @example "active"
3902
3970
  */
3903
- status: "active" | "canceled" | "pending" | "terminated";
3971
+ status: "active" | "canceled" | "incomplete" | "pending" | "terminated";
3904
3972
  /**
3905
3973
  * The creation date of the subscription, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC). This date provides a timestamp indicating when the subscription was initially created.
3906
3974
  * @format date-time
@@ -4007,11 +4075,41 @@ export interface SubscriptionObject {
4007
4075
  * @example true
4008
4076
  */
4009
4077
  consolidate_invoice?: boolean;
4078
+ /**
4079
+ * The reason a payment-gated subscription was canceled while still `incomplete`. Null unless the subscription was canceled before activation.
4080
+ *
4081
+ * - `payment_failed`: the gating payment failed.
4082
+ * - `timeout`: the activation rule expired before the payment succeeded.
4083
+ * - `manual`: the incomplete subscription was canceled on demand, via a terminate request with `status=incomplete`.
4084
+ * @example "payment_failed"
4085
+ */
4086
+ cancellation_reason?: "payment_failed" | "timeout" | "manual";
4087
+ /**
4088
+ * The date and time when a payment-gated subscription was activated (i.e. moved from `incomplete` to `active` once the gating payment succeeded), represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC). Null while the subscription is still `incomplete`.
4089
+ * @format date-time
4090
+ * @example "2022-08-08T00:00:00Z"
4091
+ */
4092
+ activated_at?: string | null;
4093
+ /** The activation rules attached to the subscription. A payment activation rule gates activation on a successful first payment, keeping the subscription in the `incomplete` state until the payment succeeds or the rule expires. */
4094
+ activation_rules?: SubscriptionActivationRuleObject[];
4095
+ /**
4096
+ * The purchase order number associated with the subscription. It will be added to invoices generated for this subscription.
4097
+ * @example "PO-123"
4098
+ */
4099
+ purchase_order_number?: string | null;
4010
4100
  }
4011
4101
  export interface SubscriptionsPaginated {
4012
4102
  subscriptions: SubscriptionObject[];
4013
4103
  meta: PaginationMeta;
4014
4104
  }
4105
+ /**
4106
+ * Fee type to which a wallet can be restricted. It can be any of the following values:
4107
+ * - `charge`
4108
+ * - `subscription`
4109
+ * - `commitment`
4110
+ * - `fixed_charge`
4111
+ */
4112
+ export type WalletFeeTypeEnum = "charge" | "subscription" | "commitment" | "fixed_charge";
4015
4113
  /** Object that represents rule for wallet recurring transactions. */
4016
4114
  export interface WalletRecurringTransactionRule {
4017
4115
  /**
@@ -4116,6 +4214,11 @@ export interface WalletRecurringTransactionRule {
4116
4214
  applied_invoice_custom_sections?: AppliedInvoiceCustomSectionObject[];
4117
4215
  /** The payment method assigned to this recurring transaction rule for processing top-up payments. */
4118
4216
  payment_method?: PaymentMethodReference;
4217
+ /**
4218
+ * The purchase order number associated with this recurring transaction rule. It will be added to invoices generated for the resulting wallet top-ups. If not set, falls back to the wallet's `purchase_order_number`.
4219
+ * @example "PO-123"
4220
+ */
4221
+ purchase_order_number?: string | null;
4119
4222
  }
4120
4223
  export interface WalletObject {
4121
4224
  /**
@@ -4231,7 +4334,7 @@ export interface WalletObject {
4231
4334
  * An array of fee types to which the wallet is applicable. By specifying the fee types in this field, you can restrict the wallet's usage to specific fee types only.
4232
4335
  * @example ["charge"]
4233
4336
  */
4234
- fee_types?: ("charge" | "subscription" | "commitment")[];
4337
+ fee_types?: WalletFeeTypeEnum[];
4235
4338
  /**
4236
4339
  * An array of billable metric codes to which the wallet is applicable. By specifying the billable metric codes in this field, you can restrict the wallet's usage to specific metrics only.
4237
4340
  * @example ["bm1"]
@@ -4276,6 +4379,11 @@ export interface WalletObject {
4276
4379
  applied_invoice_custom_sections?: AppliedInvoiceCustomSectionObject[];
4277
4380
  /** The payment method assigned to this wallet for processing top-up payments. */
4278
4381
  payment_method?: PaymentMethodReference;
4382
+ /**
4383
+ * The purchase order number associated with the wallet. It will be added to invoices generated for wallet top-ups, unless a more specific purchase order number is set on the wallet transaction or recurring transaction rule that triggered the top-up.
4384
+ * @example "PO-123"
4385
+ */
4386
+ purchase_order_number?: string | null;
4279
4387
  /**
4280
4388
  * Custom metadata stored as key-value pairs.
4281
4389
  * Keys are strings (max 100 characters), values can be strings (max 255 characters) or null.
@@ -4372,6 +4480,11 @@ export interface WalletCreateInput {
4372
4480
  * @example "Tokens for models 'high-fidelity-boost'"
4373
4481
  */
4374
4482
  transaction_name?: string | null;
4483
+ /**
4484
+ * The purchase order number associated with the wallet. It will be added to invoices generated for wallet top-ups, unless a more specific purchase order number is set on the wallet transaction or recurring transaction rule that triggered the top-up.
4485
+ * @example "PO-123"
4486
+ */
4487
+ purchase_order_number?: string | null;
4375
4488
  /** Set wallet limitations to fee types. */
4376
4489
  applies_to?: {
4377
4490
  /**
@@ -4448,6 +4561,11 @@ export interface WalletUpdateInput {
4448
4561
  * @example "default"
4449
4562
  */
4450
4563
  billing_entity_code?: string;
4564
+ /**
4565
+ * The purchase order number associated with the wallet. It will be added to invoices generated for wallet top-ups, unless a more specific purchase order number is set on the wallet transaction or recurring transaction rule that triggered the top-up.
4566
+ * @example "PO-123"
4567
+ */
4568
+ purchase_order_number?: string | null;
4451
4569
  /** Configuration for invoice custom sections to apply to invoices generated by this resource. */
4452
4570
  invoice_custom_section?: InvoiceCustomSectionInput;
4453
4571
  /** List of recurring transaction rules. Currently, we only allow one recurring rule per wallet. */
@@ -4534,6 +4652,11 @@ export interface WalletUpdateInput {
4534
4652
  * @example "Tokens for models 'high-fidelity-boost'"
4535
4653
  */
4536
4654
  transaction_name?: string | null;
4655
+ /**
4656
+ * The purchase order number associated with this recurring transaction rule. It will be added to invoices generated for the resulting wallet top-ups. If not set, falls back to the wallet's `purchase_order_number`.
4657
+ * @example "PO-123"
4658
+ */
4659
+ purchase_order_number?: string | null;
4537
4660
  /** Configuration for invoice custom sections to apply to invoices generated by this resource. */
4538
4661
  invoice_custom_section?: InvoiceCustomSectionInput;
4539
4662
  /** Optional payment method to use for processing recurring top-up payments. */
@@ -5261,8 +5384,7 @@ export interface PaymentMethod {
5261
5384
  }
5262
5385
  export interface EventObject {
5263
5386
  /**
5264
- * Unique identifier assigned to the event within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the event's record within the Lago system
5265
- * @format uuid
5387
+ * Unique identifier assigned to the event within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the event's record within the Lago system. It is an opaque identifier and is not guaranteed to be a UUID; on organizations using the ClickHouse events store it is a composite string.
5266
5388
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
5267
5389
  */
5268
5390
  lago_id?: string | null;
@@ -5648,6 +5770,11 @@ export interface InvoiceOneOffCreateInput {
5648
5770
  * @example "EUR"
5649
5771
  */
5650
5772
  currency?: Currency;
5773
+ /**
5774
+ * The purchase order number to associate with the invoice.
5775
+ * @example "PO-123"
5776
+ */
5777
+ purchase_order_number?: string | null;
5651
5778
  fees: {
5652
5779
  /**
5653
5780
  * The code of the add-on used as invoice item.
@@ -5780,7 +5907,8 @@ export interface InvoiceUpdateInput {
5780
5907
  */
5781
5908
  key?: string;
5782
5909
  /**
5783
- * The value in the key-value pair of the metadata.
5910
+ * The value in the key-value pair of the metadata (140 characters max).
5911
+ * @maxLength 140
5784
5912
  * @example "INV-0123456-98765"
5785
5913
  */
5786
5914
  value?: string;
@@ -6354,8 +6482,8 @@ export interface MinimumCommitmentObject {
6354
6482
  export type ChargeModelEnum = "dynamic" | "graduated" | "graduated_percentage" | "package" | "percentage" | "standard" | "volume";
6355
6483
  export interface ChargeProperties {
6356
6484
  /**
6485
+ * **Deprecated.** Replaced by `pricing_group_keys`.
6357
6486
  * The list of event properties that are used to group the events on the invoice for a `standard` charge model.
6358
- * **DEPRECATED** Replaced by `pricing_group_keys`.
6359
6487
  * @deprecated
6360
6488
  * @example ["agent_name"]
6361
6489
  */
@@ -7842,11 +7970,26 @@ export interface PlanOverridesObject {
7842
7970
  /** List of taxes applied to the fixed charge. */
7843
7971
  tax_codes?: TaxCodes;
7844
7972
  }[];
7845
- /** List of usage thresholds applied to the subscription. */
7973
+ /**
7974
+ * **Deprecated.** Managing usage thresholds through `plan_overrides` is deprecated and its behavior is inconsistent: an empty array does not reliably clear thresholds (it is ignored the first time a subscription is overridden), and it never affects thresholds inherited from a parent plan. Use the top-level `usage_thresholds` array on the subscription instead, or `progressive_billing_disabled` to switch progressive billing off.
7975
+ * @deprecated
7976
+ */
7846
7977
  usage_thresholds?: UsageThresholdInput[];
7847
7978
  /** Metadata to set as key-value pairs. Keys are strings (max 100 characters), values can be strings (max 255 characters) or null. */
7848
7979
  metadata?: MetadataInput;
7849
7980
  }
7981
+ export interface SubscriptionActivationRuleInput {
7982
+ /**
7983
+ * The type of the activation rule. Only `payment` is currently supported. A `payment` rule gates the subscription activation on a successful payment of the first invoice.
7984
+ * @example "payment"
7985
+ */
7986
+ type: "payment";
7987
+ /**
7988
+ * The number of hours the subscription stays in the `incomplete` state waiting for the payment to succeed before it is automatically canceled. Must be a positive integer or zero.
7989
+ * @example 48
7990
+ */
7991
+ timeout_hours?: number;
7992
+ }
7850
7993
  export interface SubscriptionCreateInput {
7851
7994
  /**
7852
7995
  * Optionally, you can create a pre-authorization on the customer's card before creating a subscription. This process places a temporary hold (capture) for a specified amount on the customer's account, but does not actually withdraw the funds.
@@ -7927,6 +8070,27 @@ export interface SubscriptionCreateInput {
7927
8070
  * @example true
7928
8071
  */
7929
8072
  consolidate_invoice?: boolean;
8073
+ /**
8074
+ * The purchase order number associated with the subscription. It will be added to invoices generated for this subscription.
8075
+ * @example "PO-123"
8076
+ */
8077
+ purchase_order_number?: string | null;
8078
+ /**
8079
+ * Disables progressive billing for this subscription, regardless of any usage thresholds defined on the plan (including thresholds inherited from a parent plan when the subscription runs on a plan override).
8080
+ *
8081
+ * Set to `true` to switch progressive billing off for this subscription specifically, without changing the plan's thresholds.
8082
+ * @default false
8083
+ * @example true
8084
+ */
8085
+ progressive_billing_disabled?: boolean;
8086
+ /**
8087
+ * Usage thresholds managed directly on the subscription. This is the recommended way to set progressive billing thresholds per subscription; when present, they take precedence over the thresholds defined on the plan.
8088
+ *
8089
+ * This field cannot be combined with `plan_overrides.usage_thresholds` in the same request.
8090
+ */
8091
+ usage_thresholds?: UsageThresholdInput[];
8092
+ /** Optional list of activation rules that gate the subscription activation. When a `payment` rule is provided and the plan is paid in advance (and the subscription is not in a trial), the subscription is created in the `incomplete` state and is only activated once the gating payment succeeds. If the payment fails or the rule's `timeout_hours` elapses, the subscription is canceled. */
8093
+ activation_rules?: SubscriptionActivationRuleInput[];
7930
8094
  };
7931
8095
  }
7932
8096
  export interface ApplicableUsageThreshold {
@@ -7997,6 +8161,27 @@ export interface SubscriptionUpdateInput {
7997
8161
  * @example "default"
7998
8162
  */
7999
8163
  billing_entity_code?: string;
8164
+ /**
8165
+ * The purchase order number associated with the subscription. It will be added to invoices generated for this subscription.
8166
+ * @example "PO-123"
8167
+ */
8168
+ purchase_order_number?: string | null;
8169
+ /**
8170
+ * Disables progressive billing for this subscription, regardless of any usage thresholds defined on the plan (including thresholds inherited from a parent plan when the subscription runs on a plan override).
8171
+ *
8172
+ * Set to `true` to switch progressive billing off for this subscription specifically. This is the recommended way to stop progressive billing on a subscription that inherits thresholds from its plan, since clearing `usage_thresholds` only removes subscription-level thresholds and does not remove those defined on (or inherited from) the plan.
8173
+ * @default false
8174
+ * @example true
8175
+ */
8176
+ progressive_billing_disabled?: boolean;
8177
+ /**
8178
+ * Usage thresholds managed directly on the subscription. This is the recommended way to set progressive billing thresholds per subscription; when present, they take precedence over the thresholds defined on the plan.
8179
+ *
8180
+ * Sending an empty array removes all subscription-level thresholds. This field cannot be combined with `plan_overrides.usage_thresholds` in the same request. To fully disable progressive billing on a subscription that inherits thresholds from its plan, use `progressive_billing_disabled` instead.
8181
+ */
8182
+ usage_thresholds?: UsageThresholdInput[];
8183
+ /** Optional list of activation rules that gate the subscription activation. Activation rules can only be set or modified while the subscription is `pending` (future-dated and not yet activated); the request is rejected for `incomplete`, `active`, or `terminated` subscriptions. */
8184
+ activation_rules?: SubscriptionActivationRuleInput[];
8000
8185
  };
8001
8186
  }
8002
8187
  export interface Subscription {
@@ -8279,7 +8464,7 @@ export interface TaxBaseInput {
8279
8464
  */
8280
8465
  description?: string | null;
8281
8466
  /**
8282
- * This field is deprecated and will be removed in a future version. When set to true, it applies the tax to the organization's default billing entity. To apply or remove a tax from any billing entity (including the default one), please use the `PUT /billing_entities/:code` endpoint instead.
8467
+ * **Deprecated.** This field will be removed in a future version. When set to true, it applies the tax to the organization's default billing entity. To apply or remove a tax from any billing entity (including the default one), please use the `PUT /billing_entities/:code` endpoint instead.
8283
8468
  * @deprecated
8284
8469
  * @example true
8285
8470
  */
@@ -8337,6 +8522,11 @@ export interface WalletTransactionCreateInput {
8337
8522
  * @example false
8338
8523
  */
8339
8524
  ignore_paid_top_up_limits?: boolean;
8525
+ /**
8526
+ * The purchase order number associated with this wallet transaction. It will be added to invoices generated for the resulting wallet top-up. If not set, falls back to the wallet's `purchase_order_number`.
8527
+ * @example "PO-123"
8528
+ */
8529
+ purchase_order_number?: string | null;
8340
8530
  /** Configuration for invoice custom sections to apply to invoices generated by this resource. */
8341
8531
  invoice_custom_section?: InvoiceCustomSectionInput;
8342
8532
  /** Optional payment method to use for processing the wallet transaction payment. */
@@ -8469,6 +8659,11 @@ export interface WalletTransactionObject {
8469
8659
  applied_invoice_custom_sections?: AppliedInvoiceCustomSectionObject[];
8470
8660
  /** The payment method assigned to this wallet transaction for processing the payment. */
8471
8661
  payment_method: PaymentMethodReference;
8662
+ /**
8663
+ * The purchase order number associated with this wallet transaction. It will be added to invoices generated for the resulting wallet top-up. If not set, falls back to the wallet's `purchase_order_number`.
8664
+ * @example "PO-123"
8665
+ */
8666
+ purchase_order_number?: string | null;
8472
8667
  }
8473
8668
  export interface WalletTransactions {
8474
8669
  wallet_transactions: WalletTransactionObject[];
@@ -8570,6 +8765,16 @@ export type WalletTransactionFundingsPaginated = WalletTransactionFundings & {
8570
8765
  export type WalletTransactionsPaginated = WalletTransactions & {
8571
8766
  meta: PaginationMeta;
8572
8767
  };
8768
+ export interface WebhookPublicKeyObject {
8769
+ /**
8770
+ * Base64-encoded public key used to verify webhook signatures.
8771
+ * @example "MEgCQQCo9+BpMRYQ/dL3DS2CyJxRF+j6ctbT3/Qp84+KeFhnii7NT7fELilKUSnxS30WAvQCCo2yU1orfgqr41mM70MBAgMBAAE="
8772
+ */
8773
+ public_key: string;
8774
+ }
8775
+ export interface WebhookPublicKey {
8776
+ webhook: WebhookPublicKeyObject;
8777
+ }
8573
8778
  export interface WebhookEndpointObject {
8574
8779
  /**
8575
8780
  * Unique identifier assigned to the wallet within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the webhook endpoint's record within the Lago system.
@@ -8584,8 +8789,8 @@ export interface WebhookEndpointObject {
8584
8789
  */
8585
8790
  lago_organization_id: string;
8586
8791
  /**
8587
- * The name of the wallet.
8588
- * @example "Prepaid"
8792
+ * The URL of the webhook endpoint.
8793
+ * @example "https://foo.bar"
8589
8794
  */
8590
8795
  webhook_url: string;
8591
8796
  /**
@@ -8593,6 +8798,16 @@ export interface WebhookEndpointObject {
8593
8798
  * @example "hmac"
8594
8799
  */
8595
8800
  signature_algo?: "jwt" | "hmac";
8801
+ /**
8802
+ * The name of the webhook.
8803
+ * @example "EC2-production"
8804
+ */
8805
+ name?: string | null;
8806
+ /**
8807
+ * A list of event types that will trigger the webhook. Passing null means that all event types will be sent.
8808
+ * @example ["invoice.voided","customer.created"]
8809
+ */
8810
+ event_types?: any[] | null;
8596
8811
  /**
8597
8812
  * The date of the webhook endpoint creation, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
8598
8813
  * @format date-time
@@ -8616,6 +8831,16 @@ export interface WebhookEndpointCreateInput {
8616
8831
  * @example "hmac"
8617
8832
  */
8618
8833
  signature_algo?: "jwt" | "hmac";
8834
+ /**
8835
+ * The name of the webhook.
8836
+ * @example "EC2-production"
8837
+ */
8838
+ name?: string | null;
8839
+ /**
8840
+ * A list of event types that will trigger the webhook. Passing null means that all event types will be sent.
8841
+ * @example ["invoice.voided","customer.created"]
8842
+ */
8843
+ event_types?: any[] | null;
8619
8844
  };
8620
8845
  }
8621
8846
  export interface WebhookEndpoint {
@@ -8633,6 +8858,16 @@ export interface WebhookEndpointUpdateInput {
8633
8858
  * @example "hmac"
8634
8859
  */
8635
8860
  signature_algo?: "jwt" | "hmac";
8861
+ /**
8862
+ * The name of the webhook.
8863
+ * @example "EC2-production"
8864
+ */
8865
+ name?: string | null;
8866
+ /**
8867
+ * A list of event types that will trigger the webhook. Passing null means that all event types will be sent.
8868
+ * @example ["invoice.voided","customer.created"]
8869
+ */
8870
+ event_types?: any[] | null;
8636
8871
  };
8637
8872
  }
8638
8873
  export interface TriggeredAlertObject {
@@ -8825,6 +9060,18 @@ export interface CreditNotePaymentProviderRefundError {
8825
9060
  payment_provider_code?: string;
8826
9061
  provider_error?: string | Record<string, any>;
8827
9062
  }
9063
+ export interface OverdueBalancePerCurrencyObject {
9064
+ /**
9065
+ * The amount of the overdue balance for this currency, expressed in cents.
9066
+ * @example 120
9067
+ */
9068
+ amount_cents: number;
9069
+ /**
9070
+ * The currency of the overdue balance.
9071
+ * @example "EUR"
9072
+ */
9073
+ currency: Currency;
9074
+ }
8828
9075
  export interface DunningCampaignFinishedObject {
8829
9076
  /**
8830
9077
  * The customer external unique identifier (provided by your own application).
@@ -8846,6 +9093,8 @@ export interface DunningCampaignFinishedObject {
8846
9093
  * @example "EUR"
8847
9094
  */
8848
9095
  overdue_balance_currency: Currency;
9096
+ /** Overdue balance broken down per currency. */
9097
+ overdue_balances?: OverdueBalancePerCurrencyObject[];
8849
9098
  }
8850
9099
  export interface EventErrorsObject {
8851
9100
  /**
@@ -8877,7 +9126,10 @@ export interface EventsErrorsObject {
8877
9126
  * @example ["transaction_1234567890"]
8878
9127
  */
8879
9128
  invalid_filter_values: string[];
8880
- /** @deprecated */
9129
+ /**
9130
+ * **Deprecated.** List of event transaction_id with a missing group key.
9131
+ * @deprecated
9132
+ */
8881
9133
  missing_group_key: string[];
8882
9134
  }
8883
9135
  export interface FeeTaxProviderErrorObject {
@@ -9135,7 +9387,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
9135
9387
  }
9136
9388
  /**
9137
9389
  * @title Lago API documentation
9138
- * @version 1.49.0
9390
+ * @version 1.52.0
9139
9391
  * @license AGPLv3 (https://github.com/getlago/lago-openapi/blob/main/LICENSE)
9140
9392
  * @baseUrl https://api.getlago.com/api/v1
9141
9393
  * @externalDocs https://github.com/getlago
@@ -9898,6 +10150,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
9898
10150
  * @example "INV-001-002"
9899
10151
  */
9900
10152
  invoice_number?: string;
10153
+ /**
10154
+ * Filter by the invoice purchase order number. The match is exact but case-insensitive.
10155
+ * @example "PO-123"
10156
+ */
10157
+ purchase_order_number?: string;
9901
10158
  /**
9902
10159
  * Filter credit notes of at least a specific amount. This parameter must be defined in cents to ensure consistent handling for all currency types.
9903
10160
  * @example 9000
@@ -10206,6 +10463,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
10206
10463
  * @example "INV-001-002"
10207
10464
  */
10208
10465
  invoice_number?: string;
10466
+ /**
10467
+ * Filter by the invoice purchase order number. The match is exact but case-insensitive.
10468
+ * @example "PO-123"
10469
+ */
10470
+ purchase_order_number?: string;
10209
10471
  /**
10210
10472
  * Filter credit notes of at least a specific amount. This parameter must be defined in cents to ensure consistent handling for all currency types.
10211
10473
  * @example 9000
@@ -10295,6 +10557,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
10295
10557
  * @example "someValue"
10296
10558
  */
10297
10559
  "metadata[key]"?: string;
10560
+ /**
10561
+ * Filter by the invoice purchase order number. The match is exact but case-insensitive.
10562
+ * @example "PO-123"
10563
+ */
10564
+ purchase_order_number?: string;
10298
10565
  }, params?: RequestParams) => Promise<HttpResponse<InvoicesPaginated, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
10299
10566
  /**
10300
10567
  * @description This endpoint is used to list all payments of a customer
@@ -10617,20 +10884,20 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
10617
10884
  */
10618
10885
  group?: Record<string, string>;
10619
10886
  /**
10620
- * Filter usage to a specific charge by its Lago ID (UUID).
10887
+ * **Deprecated.** Filter usage to a specific charge by its Lago ID (UUID).
10621
10888
  * @deprecated
10622
10889
  * @format uuid
10623
10890
  * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
10624
10891
  */
10625
10892
  filter_by_charge_id?: string;
10626
10893
  /**
10627
- * Filter usage to a specific charge by its code.
10894
+ * **Deprecated.** Filter usage to a specific charge by its code.
10628
10895
  * @deprecated
10629
10896
  * @example "storage"
10630
10897
  */
10631
10898
  filter_by_charge_code?: string;
10632
10899
  /**
10633
- * Filter usage by pricing group. Pass key/value pairs as query parameters, e.g. `filter_by_group[cloud]=aws`.
10900
+ * **Deprecated.** Filter usage by pricing group. Pass key/value pairs as query parameters, e.g. `filter_by_group[cloud]=aws`.
10634
10901
  * @deprecated
10635
10902
  * @example {"cloud":"aws"}
10636
10903
  */
@@ -11101,6 +11368,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
11101
11368
  * @example "someValue"
11102
11369
  */
11103
11370
  "metadata[key]"?: string;
11371
+ /**
11372
+ * Filter by the invoice purchase order number. The match is exact but case-insensitive.
11373
+ * @example "PO-123"
11374
+ */
11375
+ purchase_order_number?: string;
11104
11376
  }, params?: RequestParams) => Promise<HttpResponse<InvoicesPaginated, ApiErrorUnauthorized>>;
11105
11377
  /**
11106
11378
  * @description This endpoint is used for updating an existing invoice.
@@ -11122,6 +11394,16 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
11122
11394
  * @secure
11123
11395
  */
11124
11396
  findInvoice: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiErrorUnauthorized | ApiErrorNotFound>>;
11397
+ /**
11398
+ * @description This endpoint is used for permanently deleting a `draft` invoice. Deleting a draft invoice removes it entirely: it never becomes accounts receivable, consumes no invoice number, and disappears from every list, export, and analytics surface. Only invoices in the `draft` status can be deleted; for a `finalized` invoice, void it instead.
11399
+ *
11400
+ * @tags invoices
11401
+ * @name DeleteInvoice
11402
+ * @summary Delete a draft invoice
11403
+ * @request DELETE:/invoices/{lago_id}
11404
+ * @secure
11405
+ */
11406
+ deleteInvoice: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiErrorUnauthorized | ApiErrorNotFound | ApiErrorNotAllowed>>;
11125
11407
  /**
11126
11408
  * @description This endpoint is used for downloading a specific invoice PDF document.
11127
11409
  *
@@ -11297,6 +11579,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
11297
11579
  * @example 20
11298
11580
  */
11299
11581
  per_page?: number;
11582
+ /**
11583
+ * Filter the results by currency, expressed as an ISO 4217 code.
11584
+ * @example "EUR"
11585
+ */
11586
+ currency?: string;
11300
11587
  /**
11301
11588
  * Unique identifier assigned to the customer in your application.
11302
11589
  * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
@@ -11755,6 +12042,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
11755
12042
  * @example 20
11756
12043
  */
11757
12044
  per_page?: number;
12045
+ /**
12046
+ * Filter the results by currency, expressed as an ISO 4217 code.
12047
+ * @example "EUR"
12048
+ */
12049
+ currency?: string;
11758
12050
  /**
11759
12051
  * The customer external unique identifier (provided by your own application)
11760
12052
  * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
@@ -11823,8 +12115,12 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
11823
12115
  */
11824
12116
  destroySubscription: (externalId: string, query?: {
11825
12117
  /**
11826
- * If the field is not defined, Lago will terminate only `active` subscriptions. However, if you wish to cancel a `pending` subscription, please ensure that you include `status=pending` in your request.
11827
- * @example "pending"
12118
+ * Selects which subscription to terminate for the given `external_id`, based on its status. If the field is not defined, Lago targets only `active` subscriptions.
12119
+ *
12120
+ * - `pending`: cancel a subscription scheduled for a future activation (include `status=pending`).
12121
+ * - `incomplete`: cancel a payment-gated subscription that is still awaiting its activation payment (include `status=incomplete`). The subscription is canceled with `cancellation_reason: manual`, its invoice is closed and nothing is billed, and any pending payment is canceled on a best-effort basis with the payment provider (some provider statuses cannot be canceled). Applied coupons, credit notes and wallet credits are recredited. Termination behaviours (`on_termination_credit_note`, `on_termination_invoice`) are ignored, as an incomplete subscription has never been billed.
12122
+ * @default "active"
12123
+ * @example "incomplete"
11828
12124
  */
11829
12125
  status?: string;
11830
12126
  /**
@@ -12351,6 +12647,11 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
12351
12647
  * @example 20
12352
12648
  */
12353
12649
  per_page?: number;
12650
+ /**
12651
+ * Filter the results by currency, expressed as an ISO 4217 code.
12652
+ * @example "EUR"
12653
+ */
12654
+ currency?: string;
12354
12655
  /**
12355
12656
  * The customer external unique identifier (provided by your own application).
12356
12657
  * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
@@ -12551,9 +12852,20 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
12551
12852
  * @name FetchPublicKey
12552
12853
  * @summary Retrieve webhook public key
12553
12854
  * @request GET:/webhooks/public_key
12855
+ * @deprecated
12554
12856
  * @secure
12555
12857
  */
12556
12858
  fetchPublicKey: (params?: RequestParams) => Promise<HttpResponse<string, ApiErrorUnauthorized>>;
12859
+ /**
12860
+ * @description This endpoint is used to retrieve the public key used to verify the webhooks signature, wrapped in a JSON object. Prefer this endpoint over the deprecated GET /webhooks/public_key.
12861
+ *
12862
+ * @tags webhooks
12863
+ * @name FetchJsonPublicKey
12864
+ * @summary Retrieve webhook public key (JSON)
12865
+ * @request GET:/webhooks/json_public_key
12866
+ * @secure
12867
+ */
12868
+ fetchJsonPublicKey: (params?: RequestParams) => Promise<HttpResponse<WebhookPublicKey, ApiErrorUnauthorized>>;
12557
12869
  };
12558
12870
  webhookEndpoints: {
12559
12871
  /**