lago-javascript-client 1.40.0 → 1.43.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.
@@ -2558,188 +2558,6 @@ export interface CreditNoteCreateInput {
2558
2558
  metadata?: MetadataInput;
2559
2559
  };
2560
2560
  }
2561
- export interface CreditNote {
2562
- credit_note: CreditNoteObject;
2563
- }
2564
- export interface CreditNoteUpdateInput {
2565
- credit_note: {
2566
- /**
2567
- * The status of the refund portion of the credit note. It indicates the current state or condition of the refund associated with the credit note. The possible values for this field are:
2568
- *
2569
- * - `pending`: this status indicates that the refund is pending execution. The refund request has been initiated but has not been processed or completed yet.
2570
- * - `succeeded`: this status indicates that the refund has been successfully executed. The refund amount has been processed and returned to the customer or the designated recipient.
2571
- * - `failed`: this status indicates that the refund failed to execute. The refund request encountered an error or unsuccessful processing, and the refund amount could not be returned.
2572
- * @example "succeeded"
2573
- */
2574
- refund_status: "pending" | "succeeded" | "failed";
2575
- /** Metadata to set as key-value pairs. Keys are strings (max 100 characters), values can be strings (max 255 characters) or null. */
2576
- metadata?: MetadataInput;
2577
- };
2578
- }
2579
- export interface CreditNoteEstimateInput {
2580
- credit_note: {
2581
- /**
2582
- * The invoice unique identifier, created by Lago.
2583
- * @format uuid
2584
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2585
- */
2586
- invoice_id: string;
2587
- /**
2588
- * The list of credit note's items.
2589
- * @example [{"fee_id":"1a901a90-1a90-1a90-1a90-1a901a901a90","amount_cents":10},{"fee_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","amount_cents":5}]
2590
- */
2591
- items: {
2592
- /**
2593
- * The fee unique identifier, created by Lago.
2594
- * @format uuid
2595
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2596
- */
2597
- fee_id: string;
2598
- /**
2599
- * The amount of the credit note item, expressed in cents.
2600
- * @example 10
2601
- */
2602
- amount_cents: number;
2603
- }[];
2604
- };
2605
- }
2606
- export interface CreditNoteEstimated {
2607
- estimated_credit_note: {
2608
- /**
2609
- * Unique identifier assigned to the invoice that the credit note belongs to
2610
- * @format uuid
2611
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2612
- */
2613
- lago_invoice_id: string;
2614
- /**
2615
- * The invoice unique number, related to the credit note.
2616
- * @example "LAG-1234"
2617
- */
2618
- invoice_number: string;
2619
- /**
2620
- * The currency of the credit note.
2621
- * @example "EUR"
2622
- */
2623
- currency: Currency;
2624
- /**
2625
- * The tax amount of the credit note, expressed in cents.
2626
- * @example 20
2627
- */
2628
- taxes_amount_cents: number;
2629
- /**
2630
- * The precise tax amount of the credit note, expressed in cents with decimal precision.
2631
- * @example 20.1
2632
- */
2633
- precise_taxes_amount_cents: number;
2634
- /**
2635
- * The tax rate associated with this specific credit note.
2636
- * @example 20
2637
- */
2638
- taxes_rate: number;
2639
- /**
2640
- * The subtotal of the credit note excluding any applicable taxes, expressed in cents.
2641
- * @example 100
2642
- */
2643
- sub_total_excluding_taxes_amount_cents: number;
2644
- /**
2645
- * The credited amount of the credit note, expressed in cents.
2646
- * @example 100
2647
- */
2648
- max_creditable_amount_cents: number;
2649
- /**
2650
- * The refunded amount of the credit note, expressed in cents.
2651
- * @example 0
2652
- */
2653
- max_refundable_amount_cents: number;
2654
- /**
2655
- * The ofsetted amount of the credit note, expressed in cents.
2656
- * @example 0
2657
- */
2658
- max_offsettable_amount_cents: number;
2659
- /**
2660
- * The pro-rated amount of the coupons applied to the source invoice.
2661
- * @example 20
2662
- */
2663
- coupons_adjustment_amount_cents: number;
2664
- /**
2665
- * The precise pro-rated amount with decimal precision of the coupons applied to the source invoice.
2666
- * @example 20.1
2667
- */
2668
- precise_coupons_adjustment_amount_cents: number;
2669
- /** Array of credit note's items. */
2670
- items: {
2671
- /**
2672
- * The credit note's item amount, expressed in cents.
2673
- * @example 100
2674
- */
2675
- amount_cents: number;
2676
- /**
2677
- * 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.
2678
- * @format uuid
2679
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2680
- */
2681
- lago_fee_id: string | null;
2682
- }[];
2683
- applied_taxes?: {
2684
- /**
2685
- * Unique identifier of the tax, created by Lago.
2686
- * @format uuid
2687
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2688
- */
2689
- lago_tax_id?: string;
2690
- /**
2691
- * Name of the tax.
2692
- * @example "TVA"
2693
- */
2694
- tax_name?: string;
2695
- /**
2696
- * Unique code used to identify the tax associated with the API request.
2697
- * @example "french_standard_vat"
2698
- */
2699
- tax_code?: string;
2700
- /**
2701
- * The percentage rate of the tax
2702
- * @example 20
2703
- */
2704
- tax_rate?: number;
2705
- /**
2706
- * Internal description of the taxe
2707
- * @example "French standard VAT"
2708
- */
2709
- tax_description?: string;
2710
- /** @example 100 */
2711
- base_amount_cents?: number;
2712
- /**
2713
- * Amount of the tax
2714
- * @example 2000
2715
- */
2716
- amount_cents?: number;
2717
- /**
2718
- * Currency of the tax
2719
- * @example "USD"
2720
- */
2721
- amount_currency?: Currency;
2722
- }[];
2723
- };
2724
- }
2725
- export interface ApiErrorNotAllowed {
2726
- /**
2727
- * @format int32
2728
- * @example 405
2729
- */
2730
- status: number;
2731
- /** @example "Method Not Allowed" */
2732
- error: string;
2733
- /** @example "not_allowed" */
2734
- code: string;
2735
- }
2736
- export interface CreditNoteMetadataResponse {
2737
- /**
2738
- * Custom metadata stored as key-value pairs.
2739
- * Keys are strings (max 100 characters), values can be strings (max 255 characters) or null.
2740
- */
2741
- metadata: MetadataObject;
2742
- }
2743
2561
  /** @example "US" */
2744
2562
  export type CountryOrNull = "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AQ" | "AR" | "AS" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BR" | "BS" | "BT" | "BV" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CF" | "CG" | "CH" | "CI" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CV" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FM" | "FO" | "FR" | "GA" | "GB" | "GD" | "GE" | "GF" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GP" | "GQ" | "GR" | "GS" | "GT" | "GU" | "GW" | "GY" | "HK" | "HM" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MF" | "MG" | "MH" | "MK" | "ML" | "MM" | "MN" | "MO" | "MP" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NC" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PM" | "PN" | "PR" | "PS" | "PT" | "PW" | "PY" | "QA" | "RE" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SD" | "SE" | "SG" | "SH" | "SI" | "SJ" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SY" | "SZ" | "TC" | "TD" | "TF" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "UM" | "US" | "UY" | "UZ" | "VA" | "VC" | "VE" | "VG" | "VI" | "VN" | "VU" | "WF" | "WS" | "YE" | "YT" | "ZA" | "ZM" | "ZW";
2745
2563
  /** @example "America/Los_Angeles" */
@@ -3011,23 +2829,211 @@ export interface CustomerBaseObject {
3011
2829
  */
3012
2830
  updated_at?: string;
3013
2831
  /**
3014
- * Specifies how invoices with a zero total amount should be handled:
3015
- * - `inherit`: (Default) Follows the organization-level configuration.
3016
- * - `finalize`: Invoices are issued and finalized even if the total amount is zero.
3017
- * - `skip`: Invoices with a total amount of zero are not finalized.
3018
- * @example "inherit"
2832
+ * Specifies how invoices with a zero total amount should be handled:
2833
+ * - `inherit`: (Default) Follows the organization-level configuration.
2834
+ * - `finalize`: Invoices are issued and finalized even if the total amount is zero.
2835
+ * - `skip`: Invoices with a total amount of zero are not finalized.
2836
+ * @example "inherit"
2837
+ */
2838
+ finalize_zero_amount_invoice?: "inherit" | "skip" | "finalize";
2839
+ /**
2840
+ * Set to true to exclude all invoice custom sections from PDF generation for this customer only.
2841
+ * @example false
2842
+ */
2843
+ skip_invoice_custom_sections?: boolean;
2844
+ /** 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. */
2845
+ billing_configuration?: CustomerBillingConfiguration;
2846
+ /** 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. */
2847
+ shipping_address?: Address;
2848
+ metadata?: CustomerMetadata[];
2849
+ }
2850
+ export type CreditNoteExtendedObject = CreditNoteObject & {
2851
+ customer?: CustomerBaseObject;
2852
+ };
2853
+ export interface CreditNoteExtended {
2854
+ credit_note: CreditNoteExtendedObject;
2855
+ }
2856
+ export interface CreditNoteUpdateInput {
2857
+ credit_note: {
2858
+ /**
2859
+ * The status of the refund portion of the credit note. It indicates the current state or condition of the refund associated with the credit note. The possible values for this field are:
2860
+ *
2861
+ * - `pending`: this status indicates that the refund is pending execution. The refund request has been initiated but has not been processed or completed yet.
2862
+ * - `succeeded`: this status indicates that the refund has been successfully executed. The refund amount has been processed and returned to the customer or the designated recipient.
2863
+ * - `failed`: this status indicates that the refund failed to execute. The refund request encountered an error or unsuccessful processing, and the refund amount could not be returned.
2864
+ * @example "succeeded"
2865
+ */
2866
+ refund_status: "pending" | "succeeded" | "failed";
2867
+ /** Metadata to set as key-value pairs. Keys are strings (max 100 characters), values can be strings (max 255 characters) or null. */
2868
+ metadata?: MetadataInput;
2869
+ };
2870
+ }
2871
+ export interface CreditNote {
2872
+ credit_note: CreditNoteObject;
2873
+ }
2874
+ export interface CreditNoteEstimateInput {
2875
+ credit_note: {
2876
+ /**
2877
+ * The invoice unique identifier, created by Lago.
2878
+ * @format uuid
2879
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2880
+ */
2881
+ invoice_id: string;
2882
+ /**
2883
+ * The list of credit note's items.
2884
+ * @example [{"fee_id":"1a901a90-1a90-1a90-1a90-1a901a901a90","amount_cents":10},{"fee_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","amount_cents":5}]
2885
+ */
2886
+ items: {
2887
+ /**
2888
+ * The fee unique identifier, created by Lago.
2889
+ * @format uuid
2890
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2891
+ */
2892
+ fee_id: string;
2893
+ /**
2894
+ * The amount of the credit note item, expressed in cents.
2895
+ * @example 10
2896
+ */
2897
+ amount_cents: number;
2898
+ }[];
2899
+ };
2900
+ }
2901
+ export interface CreditNoteEstimated {
2902
+ estimated_credit_note: {
2903
+ /**
2904
+ * Unique identifier assigned to the invoice that the credit note belongs to
2905
+ * @format uuid
2906
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2907
+ */
2908
+ lago_invoice_id: string;
2909
+ /**
2910
+ * The invoice unique number, related to the credit note.
2911
+ * @example "LAG-1234"
2912
+ */
2913
+ invoice_number: string;
2914
+ /**
2915
+ * The currency of the credit note.
2916
+ * @example "EUR"
2917
+ */
2918
+ currency: Currency;
2919
+ /**
2920
+ * The tax amount of the credit note, expressed in cents.
2921
+ * @example 20
2922
+ */
2923
+ taxes_amount_cents: number;
2924
+ /**
2925
+ * The precise tax amount of the credit note, expressed in cents with decimal precision.
2926
+ * @example 20.1
2927
+ */
2928
+ precise_taxes_amount_cents: number;
2929
+ /**
2930
+ * The tax rate associated with this specific credit note.
2931
+ * @example 20
2932
+ */
2933
+ taxes_rate: number;
2934
+ /**
2935
+ * The subtotal of the credit note excluding any applicable taxes, expressed in cents.
2936
+ * @example 100
2937
+ */
2938
+ sub_total_excluding_taxes_amount_cents: number;
2939
+ /**
2940
+ * The credited amount of the credit note, expressed in cents.
2941
+ * @example 100
2942
+ */
2943
+ max_creditable_amount_cents: number;
2944
+ /**
2945
+ * The refunded amount of the credit note, expressed in cents.
2946
+ * @example 0
2947
+ */
2948
+ max_refundable_amount_cents: number;
2949
+ /**
2950
+ * The ofsetted amount of the credit note, expressed in cents.
2951
+ * @example 0
2952
+ */
2953
+ max_offsettable_amount_cents: number;
2954
+ /**
2955
+ * The pro-rated amount of the coupons applied to the source invoice.
2956
+ * @example 20
2957
+ */
2958
+ coupons_adjustment_amount_cents: number;
2959
+ /**
2960
+ * The precise pro-rated amount with decimal precision of the coupons applied to the source invoice.
2961
+ * @example 20.1
2962
+ */
2963
+ precise_coupons_adjustment_amount_cents: number;
2964
+ /** Array of credit note's items. */
2965
+ items: {
2966
+ /**
2967
+ * The credit note's item amount, expressed in cents.
2968
+ * @example 100
2969
+ */
2970
+ amount_cents: number;
2971
+ /**
2972
+ * 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.
2973
+ * @format uuid
2974
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2975
+ */
2976
+ lago_fee_id: string | null;
2977
+ }[];
2978
+ applied_taxes?: {
2979
+ /**
2980
+ * Unique identifier of the tax, created by Lago.
2981
+ * @format uuid
2982
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2983
+ */
2984
+ lago_tax_id?: string;
2985
+ /**
2986
+ * Name of the tax.
2987
+ * @example "TVA"
2988
+ */
2989
+ tax_name?: string;
2990
+ /**
2991
+ * Unique code used to identify the tax associated with the API request.
2992
+ * @example "french_standard_vat"
2993
+ */
2994
+ tax_code?: string;
2995
+ /**
2996
+ * The percentage rate of the tax
2997
+ * @example 20
2998
+ */
2999
+ tax_rate?: number;
3000
+ /**
3001
+ * Internal description of the taxe
3002
+ * @example "French standard VAT"
3003
+ */
3004
+ tax_description?: string;
3005
+ /** @example 100 */
3006
+ base_amount_cents?: number;
3007
+ /**
3008
+ * Amount of the tax
3009
+ * @example 2000
3010
+ */
3011
+ amount_cents?: number;
3012
+ /**
3013
+ * Currency of the tax
3014
+ * @example "USD"
3015
+ */
3016
+ amount_currency?: Currency;
3017
+ }[];
3018
+ };
3019
+ }
3020
+ export interface ApiErrorNotAllowed {
3021
+ /**
3022
+ * @format int32
3023
+ * @example 405
3019
3024
  */
3020
- finalize_zero_amount_invoice?: "inherit" | "skip" | "finalize";
3025
+ status: number;
3026
+ /** @example "Method Not Allowed" */
3027
+ error: string;
3028
+ /** @example "not_allowed" */
3029
+ code: string;
3030
+ }
3031
+ export interface CreditNoteMetadataResponse {
3021
3032
  /**
3022
- * Set to true to exclude all invoice custom sections from PDF generation for this customer only.
3023
- * @example false
3033
+ * Custom metadata stored as key-value pairs.
3034
+ * Keys are strings (max 100 characters), values can be strings (max 255 characters) or null.
3024
3035
  */
3025
- skip_invoice_custom_sections?: boolean;
3026
- /** 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. */
3027
- billing_configuration?: CustomerBillingConfiguration;
3028
- /** 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. */
3029
- shipping_address?: Address;
3030
- metadata?: CustomerMetadata[];
3036
+ metadata: MetadataObject;
3031
3037
  }
3032
3038
  /** Configuration specific to the accounting and tax integrations. This object contains settings and parameters necessary for syncing documents and payments. */
3033
3039
  export interface IntegrationCustomer {
@@ -3676,6 +3682,12 @@ export interface PaymentObject {
3676
3682
  * @example "cus_5eb0285bcf941bc6ba"
3677
3683
  */
3678
3684
  provider_customer_id: string;
3685
+ /**
3686
+ * The unique identifier of the payment method used for this payment.
3687
+ * @format uuid
3688
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3689
+ */
3690
+ payment_method_id?: string | null;
3679
3691
  /**
3680
3692
  * The next action to be taken by the customer to complete the payment. Should usually be empty, except when receiving the `payment.requires_action` webhook.
3681
3693
  * @example {"type":"redirect_to_url","redirect_to_url":{"url":"https://hooks.stripe.com/3d_secure_2/hosted?merchant=acct_AAA&payment_intent=pi_BBB&payment_intent_client_secret=pi_BBB&publishable_key=pk_test_CCC","return_url":"https://app.example.com"}}
@@ -3737,6 +3749,20 @@ export interface PaymentRequestsPaginated {
3737
3749
  payment_requests: PaymentRequestObject[];
3738
3750
  meta: PaginationMeta;
3739
3751
  }
3752
+ /** Reference to a specific payment method for processing the payment. */
3753
+ export interface PaymentMethodReference {
3754
+ /**
3755
+ * The type of payment method to use.
3756
+ * @example "provider"
3757
+ */
3758
+ payment_method_type?: "provider" | "manual";
3759
+ /**
3760
+ * The unique identifier of the payment method (required when using a specific provider payment method).
3761
+ * @format uuid
3762
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3763
+ */
3764
+ payment_method_id?: string;
3765
+ }
3740
3766
  export interface SubscriptionObject {
3741
3767
  /**
3742
3768
  * 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
@@ -3775,6 +3801,16 @@ export interface SubscriptionObject {
3775
3801
  * @example "premium"
3776
3802
  */
3777
3803
  plan_code: string;
3804
+ /**
3805
+ * The base cost of the related plan, excluding any applicable taxes, that is billed on a recurring basis.
3806
+ * @example 10000
3807
+ */
3808
+ plan_amount_cents?: number;
3809
+ /**
3810
+ * The currency of the related plan. It indicates the monetary unit in which the plan's cost, including taxes and usage-based charges, is expressed.
3811
+ * @example "USD"
3812
+ */
3813
+ plan_amount_currency?: Currency;
3778
3814
  /**
3779
3815
  * The status of the subscription, which can have the following values:
3780
3816
  * - `active`: the subscription is currently active and applied to the customer.
@@ -3860,12 +3896,13 @@ export interface SubscriptionObject {
3860
3896
  *
3861
3897
  * - `credit`: A credit note is generated for the unused subscription time. The unused amount is credited back to the customer.
3862
3898
  * - `refund`: A credit note is generated for the unused subscription time. If the invoice is paid or partially paid, the unused paid amount is refunded; any unpaid unused amount is credited back to the customer.
3899
+ * - `offset`: A credit note is generated for the unused subscription time. If the invoice is paid or partially paid, the unused paid amount is refunded; any unpaid unused amount is applied to the invoice reducing its amount due.
3863
3900
  * - `skip`: No credit note is generated for the unused subscription time.
3864
3901
  *
3865
3902
  * _Note: This field is only applicable to pay-in-advance plans and will be `null` for pay-in-arrears plans._
3866
3903
  * @example "credit"
3867
3904
  */
3868
- on_termination_credit_note: "credit" | "refund" | "skip";
3905
+ on_termination_credit_note: "credit" | "refund" | "offset" | "skip";
3869
3906
  /**
3870
3907
  * When a subscription is terminated before the end of its billing period, we generate an invoice for the unbilled usage.
3871
3908
  * This field allows you to control the behavior of the invoice generation:
@@ -3876,6 +3913,8 @@ export interface SubscriptionObject {
3876
3913
  * @example "generate"
3877
3914
  */
3878
3915
  on_termination_invoice: "generate" | "skip";
3916
+ /** The payment method assigned to this subscription for processing payments. */
3917
+ payment_method?: PaymentMethodReference;
3879
3918
  }
3880
3919
  export interface SubscriptionsPaginated {
3881
3920
  subscriptions: SubscriptionObject[];
@@ -3976,6 +4015,8 @@ export interface WalletRecurringTransactionRule {
3976
4015
  * @example false
3977
4016
  */
3978
4017
  ignore_paid_top_up_limits: boolean;
4018
+ /** The payment method assigned to this recurring transaction rule for processing top-up payments. */
4019
+ payment_method?: PaymentMethodReference;
3979
4020
  }
3980
4021
  export interface WalletObject {
3981
4022
  /**
@@ -4010,6 +4051,11 @@ export interface WalletObject {
4010
4051
  * @example "Prepaid"
4011
4052
  */
4012
4053
  name?: string | null;
4054
+ /**
4055
+ * The code of the wallet.
4056
+ * @example "prepaid"
4057
+ */
4058
+ code?: string | null;
4013
4059
  /**
4014
4060
  * Wallet priority for ordering when a customer has multiple wallets. Allowed values: 1-50, where 1 is highest priority and 50 is lowest. Defaults to 50.
4015
4061
  * @min 1
@@ -4122,6 +4168,8 @@ export interface WalletObject {
4122
4168
  * @example 1000
4123
4169
  */
4124
4170
  paid_top_up_max_amount_cents?: number | null;
4171
+ /** The payment method assigned to this wallet for processing top-up payments. */
4172
+ payment_method?: PaymentMethodReference;
4125
4173
  /**
4126
4174
  * Custom metadata stored as key-value pairs.
4127
4175
  * Keys are strings (max 100 characters), values can be strings (max 255 characters) or null.
@@ -4407,35 +4455,78 @@ export interface CustomerPastUsage {
4407
4455
  usage_periods: CustomerUsage[];
4408
4456
  meta: PaginationMeta;
4409
4457
  }
4410
- /** . */
4411
4458
  export interface CustomerCheckoutUrl {
4412
- customer?: {
4413
- /**
4414
- * 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
4415
- * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4416
- */
4417
- lago_customer_id: string;
4418
- /**
4419
- * The customer external unique identifier (provided by your own application)
4420
- * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4421
- */
4422
- external_customer_id: string;
4423
- /**
4424
- * The Payment Provider name linked to the Customer.
4425
- * @example "stripe"
4426
- */
4427
- payment_provider: string;
4428
- /**
4429
- * Code of the payment provider
4430
- * @example "Stripe Prod"
4431
- */
4432
- payment_provider_code?: string;
4433
- /**
4434
- * The new generated Payment Provider Checkout URL for the Customer.
4435
- * @example "https://foo.bar"
4436
- */
4437
- checkout_url?: string;
4438
- };
4459
+ /**
4460
+ * 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
4461
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
4462
+ */
4463
+ lago_customer_id: string;
4464
+ /**
4465
+ * The customer external unique identifier (provided by your own application)
4466
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4467
+ */
4468
+ external_customer_id: string;
4469
+ /**
4470
+ * The Payment Provider name linked to the Customer.
4471
+ * @example "stripe"
4472
+ */
4473
+ payment_provider: string;
4474
+ /**
4475
+ * Code of the payment provider
4476
+ * @example "Stripe Prod"
4477
+ */
4478
+ payment_provider_code?: string;
4479
+ /**
4480
+ * The new generated Payment Provider Checkout URL for the Customer.
4481
+ * @example "https://foo.bar"
4482
+ */
4483
+ checkout_url?: string;
4484
+ }
4485
+ export interface PaymentMethodObject {
4486
+ /**
4487
+ * The unique identifier of the payment method, created by Lago.
4488
+ * @format uuid
4489
+ * @example "4cf085a7-c196-4f07-a543-97c50ec6e8b2"
4490
+ */
4491
+ lago_id: string;
4492
+ /**
4493
+ * Indicates whether this payment method is the default one for the customer.
4494
+ * @example true
4495
+ */
4496
+ is_default: boolean;
4497
+ /**
4498
+ * Code of the payment provider associated with this payment method.
4499
+ * @example "stripe_prod"
4500
+ */
4501
+ payment_provider_code?: string | null;
4502
+ /**
4503
+ * Human-readable name of the payment provider.
4504
+ * @example "Stripe"
4505
+ */
4506
+ payment_provider_name?: string | null;
4507
+ /**
4508
+ * The type of the payment provider.
4509
+ * @example "stripe"
4510
+ */
4511
+ payment_provider_type: "adyen" | "cashfree" | "gocardless" | "stripe" | "flutterwave" | "moneyhash";
4512
+ /**
4513
+ * Unique identifier of the payment method within the payment provider.
4514
+ * @example "pm_1N8ZQX2eZvKYlo2CkL9Y8XYZ"
4515
+ */
4516
+ provider_method_id: string;
4517
+ /**
4518
+ * Timestamp when the payment method was created in Lago's database.
4519
+ * @format date-time
4520
+ * @example "2025-01-21T00:10:29Z"
4521
+ */
4522
+ created_at: string;
4523
+ }
4524
+ export interface PaymentMethodsPaginated {
4525
+ payment_methods: PaymentMethodObject[];
4526
+ meta: PaginationMeta;
4527
+ }
4528
+ export interface PaymentMethod {
4529
+ payment_method: PaymentMethodObject;
4439
4530
  }
4440
4531
  export interface EventObject {
4441
4532
  /**
@@ -4869,6 +4960,8 @@ export interface InvoiceOneOffCreateInput {
4869
4960
  */
4870
4961
  skip_psp?: boolean | null;
4871
4962
  }[];
4963
+ /** Optional payment method to use for processing the invoice payment. */
4964
+ payment_method?: PaymentMethodReference;
4872
4965
  };
4873
4966
  }
4874
4967
  export interface ErrorDetailObject {
@@ -5400,6 +5493,8 @@ export interface PaymentRequestCreateInput {
5400
5493
  email: string;
5401
5494
  /** A list of Lago IDs for the customer's overdue invoices to start the dunning process */
5402
5495
  lago_invoice_ids: string[];
5496
+ /** Optional payment method to use for processing the payment request. */
5497
+ payment_method?: PaymentMethodReference;
5403
5498
  };
5404
5499
  }
5405
5500
  export interface PaymentRequest {
@@ -5740,6 +5835,11 @@ export interface ChargeObject {
5740
5835
  */
5741
5836
  conversion_rate: string;
5742
5837
  };
5838
+ /**
5839
+ * Specifies whether the charge accepts a target wallet for prepaid credits deduction.
5840
+ * @example false
5841
+ */
5842
+ accepts_target_wallet?: boolean | null;
5743
5843
  }
5744
5844
  export interface FixedChargeProperties {
5745
5845
  /**
@@ -6190,6 +6290,11 @@ export interface PlanCreateInput {
6190
6290
  */
6191
6291
  conversion_rate?: string;
6192
6292
  };
6293
+ /**
6294
+ * Specifies whether the charge accepts a target wallet for prepaid credits deduction.
6295
+ * @example false
6296
+ */
6297
+ accepts_target_wallet?: boolean | null;
6193
6298
  }[];
6194
6299
  /**
6195
6300
  * Additional fixed charges for this plan.
@@ -6398,6 +6503,11 @@ export interface PlanUpdateInput {
6398
6503
  */
6399
6504
  conversion_rate?: string;
6400
6505
  };
6506
+ /**
6507
+ * Specifies whether the charge accepts a target wallet for prepaid credits deduction.
6508
+ * @example false
6509
+ */
6510
+ accepts_target_wallet?: boolean | null;
6401
6511
  }[];
6402
6512
  /**
6403
6513
  * Additional fixed charges for this plan.
@@ -6682,6 +6792,8 @@ export interface SubscriptionCreateInput {
6682
6792
  subscription_at?: string;
6683
6793
  /** Based plan overrides. */
6684
6794
  plan_overrides?: PlanOverridesObject;
6795
+ /** Optional payment method to use for processing subscription payments. */
6796
+ payment_method?: PaymentMethodReference;
6685
6797
  };
6686
6798
  }
6687
6799
  export type SubscriptionObjectExtended = SubscriptionObject & {
@@ -6716,6 +6828,8 @@ export interface SubscriptionUpdateInput {
6716
6828
  subscription_at?: string;
6717
6829
  /** Based plan overrides. */
6718
6830
  plan_overrides?: PlanOverridesObject;
6831
+ /** Optional payment method to use for processing subscription payments. */
6832
+ payment_method?: PaymentMethodReference;
6719
6833
  };
6720
6834
  }
6721
6835
  export interface LifetimeUsageThresholdObject {
@@ -6921,6 +7035,21 @@ export interface AlertCreateInput {
6921
7035
  code: string;
6922
7036
  };
6923
7037
  }
7038
+ export interface AlertBatchCreateInput {
7039
+ /** Array of alerts to create. All alerts are created atomically - if any fail validation, none are created. */
7040
+ alerts: (AlertBaseInput & {
7041
+ /**
7042
+ * The type of alert.
7043
+ * @example "billable_metric_current_usage_amount"
7044
+ */
7045
+ alert_type: "current_usage_amount" | "billable_metric_current_usage_amount" | "billable_metric_current_usage_units" | "lifetime_usage_amount";
7046
+ /**
7047
+ * Unique code used to identify the alert.
7048
+ * @example "storage_threshold_alert"
7049
+ */
7050
+ code: string;
7051
+ })[];
7052
+ }
6924
7053
  export interface Alert {
6925
7054
  alert: AlertObject;
6926
7055
  }
@@ -7026,6 +7155,11 @@ export interface WalletCreateInput {
7026
7155
  * @example "Prepaid"
7027
7156
  */
7028
7157
  name?: string | null;
7158
+ /**
7159
+ * The code of the wallet.
7160
+ * @example "prepaid"
7161
+ */
7162
+ code?: string | null;
7029
7163
  /**
7030
7164
  * Wallet priority for ordering when a customer has multiple wallets. Allowed values: 1-50, where 1 is highest priority and 50 is lowest. Defaults to 50.
7031
7165
  * @min 1
@@ -7112,6 +7246,8 @@ export interface WalletCreateInput {
7112
7246
  ignore_paid_top_up_limits_on_creation?: boolean | null;
7113
7247
  /** List of recurring transaction rules. Currently, we only allow one recurring rule per wallet. */
7114
7248
  recurring_transaction_rules?: any[] | null;
7249
+ /** Optional payment method to use for processing wallet top-up payments. */
7250
+ payment_method?: PaymentMethodReference;
7115
7251
  /** Metadata to set as key-value pairs. Keys are strings (max 100 characters), values can be strings (max 255 characters) or null. */
7116
7252
  metadata?: MetadataInput;
7117
7253
  };
@@ -7126,6 +7262,11 @@ export interface WalletUpdateInput {
7126
7262
  * @example "new_name"
7127
7263
  */
7128
7264
  name?: string | null;
7265
+ /**
7266
+ * The code of the wallet.
7267
+ * @example "prepaid"
7268
+ */
7269
+ code?: string | null;
7129
7270
  /**
7130
7271
  * Wallet priority for ordering when a customer has multiple wallets. Allowed values: 1-50, where 1 is highest priority and 50 is lowest. Defaults to 50.
7131
7272
  * @min 1
@@ -7223,7 +7364,11 @@ export interface WalletUpdateInput {
7223
7364
  * @example "Tokens for models 'high-fidelity-boost'"
7224
7365
  */
7225
7366
  transaction_name?: string | null;
7367
+ /** Optional payment method to use for processing recurring top-up payments. */
7368
+ payment_method?: PaymentMethodReference;
7226
7369
  }[];
7370
+ /** Optional payment method to use for processing wallet top-up payments. */
7371
+ payment_method?: PaymentMethodReference;
7227
7372
  /** Set wallet limitations to fee types. */
7228
7373
  applies_to?: {
7229
7374
  /**
@@ -7291,6 +7436,8 @@ export interface WalletTransactionCreateInput {
7291
7436
  * @example false
7292
7437
  */
7293
7438
  ignore_paid_top_up_limits?: boolean;
7439
+ /** Optional payment method to use for processing the wallet transaction payment. */
7440
+ payment_method?: PaymentMethodReference;
7294
7441
  /**
7295
7442
  * This optional field allows you to store a list of key-value pairs that hold additional information or custom attributes related to the data.
7296
7443
  * @example [{"key":"example key","value":"example value"},{"key":"another key","value":"another value"}]
@@ -7381,6 +7528,8 @@ export interface WalletTransactionObject {
7381
7528
  * @example "Tokens for models 'high-fidelity-boost'"
7382
7529
  */
7383
7530
  name: string | null;
7531
+ /** The payment method assigned to this wallet transaction for processing the payment. */
7532
+ payment_method?: PaymentMethodReference;
7384
7533
  }
7385
7534
  export interface WalletTransactions {
7386
7535
  wallet_transactions: WalletTransactionObject[];
@@ -7633,9 +7782,6 @@ export type CustomerViesCheckObject = CustomerBaseObject & {
7633
7782
  valid?: boolean;
7634
7783
  };
7635
7784
  };
7636
- export type CreditNoteExtendedObject = CreditNoteObject & {
7637
- customer?: CustomerBaseObject;
7638
- };
7639
7785
  export interface CreditNotePaymentProviderRefundError {
7640
7786
  /**
7641
7787
  * 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.
@@ -7745,6 +7891,9 @@ export interface FeeTaxProviderErrorObject {
7745
7891
  event_transaction_id: string | null;
7746
7892
  provider_error: string | Record<string, any>;
7747
7893
  }
7894
+ export type InvoicePaymentDisputeLostObject = InvoiceObjectExtended & {
7895
+ provider_error?: string | Record<string, any>;
7896
+ };
7748
7897
  export interface InvoicePaymentFailureObject {
7749
7898
  /**
7750
7899
  * 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.
@@ -7976,7 +8125,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
7976
8125
  }
7977
8126
  /**
7978
8127
  * @title Lago API documentation
7979
- * @version 1.40.0
8128
+ * @version 1.42.0
7980
8129
  * @license AGPLv3
7981
8130
  * @baseUrl https://api.getlago.com/api/v1
7982
8131
  * @externalDocs https://github.com/getlago
@@ -8680,7 +8829,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
8680
8829
  * @request POST:/credit_notes
8681
8830
  * @secure
8682
8831
  */
8683
- createCreditNote: (data: CreditNoteCreateInput, params?: RequestParams) => Promise<HttpResponse<CreditNote, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorBadRequest>>;
8832
+ createCreditNote: (data: CreditNoteCreateInput, params?: RequestParams) => Promise<HttpResponse<CreditNoteExtended, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorBadRequest>>;
8684
8833
  /**
8685
8834
  * @description This endpoint list all existing credit notes.
8686
8835
  *
@@ -8769,7 +8918,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
8769
8918
  * @request PUT:/credit_notes/{lago_id}
8770
8919
  * @secure
8771
8920
  */
8772
- updateCreditNote: (lagoId: string, data: CreditNoteUpdateInput, params?: RequestParams) => Promise<HttpResponse<CreditNote, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorBadRequest | ApiErrorNotFound>>;
8921
+ updateCreditNote: (lagoId: string, data: CreditNoteUpdateInput, params?: RequestParams) => Promise<HttpResponse<CreditNoteExtended, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorBadRequest | ApiErrorNotFound>>;
8773
8922
  /**
8774
8923
  * @description This endpoint retrieves an existing credit note.
8775
8924
  *
@@ -8779,7 +8928,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
8779
8928
  * @request GET:/credit_notes/{lago_id}
8780
8929
  * @secure
8781
8930
  */
8782
- findCreditNote: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<CreditNote, ApiErrorUnauthorized | ApiErrorNotFound>>;
8931
+ findCreditNote: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<CreditNoteExtended, ApiErrorUnauthorized | ApiErrorNotFound>>;
8783
8932
  /**
8784
8933
  * @description This endpoint downloads the PDF of an existing credit note.
8785
8934
  *
@@ -8809,7 +8958,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
8809
8958
  * @request PUT:/credit_notes/{lago_id}/void
8810
8959
  * @secure
8811
8960
  */
8812
- voidCreditNote: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<CreditNote, ApiErrorUnauthorized | ApiErrorNotFound | ApiErrorNotAllowed>>;
8961
+ voidCreditNote: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<CreditNoteExtended, ApiErrorUnauthorized | ApiErrorNotFound | ApiErrorNotAllowed>>;
8813
8962
  /**
8814
8963
  * @description This endpoint replaces all existing metadata on a credit note with the provided key-value pairs. Any existing metadata keys not included in the request will be removed.
8815
8964
  *
@@ -9350,6 +9499,47 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
9350
9499
  * @secure
9351
9500
  */
9352
9501
  generateCustomerCheckoutUrl: (externalCustomerId: string, params?: RequestParams) => Promise<HttpResponse<CustomerCheckoutUrl, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
9502
+ /**
9503
+ * @description This endpoint retrieves all payment methods of a Customer.
9504
+ *
9505
+ * @tags payment_methods
9506
+ * @name FindAllCustomersPaymentMethods
9507
+ * @summary List all customer payment methods
9508
+ * @request GET:/customers/{external_customer_id}/payment_methods
9509
+ * @secure
9510
+ */
9511
+ findAllCustomersPaymentMethods: (externalCustomerId: string, query?: {
9512
+ /**
9513
+ * Page number.
9514
+ * @example 1
9515
+ */
9516
+ page?: number;
9517
+ /**
9518
+ * Number of records per page.
9519
+ * @example 20
9520
+ */
9521
+ per_page?: number;
9522
+ }, params?: RequestParams) => Promise<HttpResponse<PaymentMethodsPaginated, ApiErrorUnauthorized | ApiErrorNotFound>>;
9523
+ /**
9524
+ * @description Use the payment method as default when not selected a payment method
9525
+ *
9526
+ * @tags payment_methods
9527
+ * @name PaymentMethodSetAsDefault
9528
+ * @summary Set the payment method as default
9529
+ * @request PUT:/customers/{external_customer_id}/payment_methods/{lago_id}/set_as_default
9530
+ * @secure
9531
+ */
9532
+ paymentMethodSetAsDefault: (lagoId: string, externalCustomerId: string, params?: RequestParams) => Promise<HttpResponse<PaymentMethod, ApiErrorUnauthorized | ApiErrorNotFound>>;
9533
+ /**
9534
+ * @description This endpoint deletes a specific payment method for a customer.
9535
+ *
9536
+ * @tags payment_methods
9537
+ * @name DestroyPaymentMethod
9538
+ * @summary Delete a payment method
9539
+ * @request DELETE:/customers/{external_customer_id}/payment_methods/{lago_id}
9540
+ * @secure
9541
+ */
9542
+ destroyPaymentMethod: (lagoId: string, externalCustomerId: string, params?: RequestParams) => Promise<HttpResponse<PaymentMethod, ApiErrorUnauthorized | ApiErrorNotFound>>;
9353
9543
  };
9354
9544
  events: {
9355
9545
  /**
@@ -9793,7 +9983,10 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
9793
9983
  * @request POST:/invoices/{lago_id}/retry_payment
9794
9984
  * @secure
9795
9985
  */
9796
- retryPayment: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<void, ApiErrorUnauthorized | ApiErrorNotFound | ApiErrorNotAllowed>>;
9986
+ retryPayment: (lagoId: string, data?: {
9987
+ /** Reference to a specific payment method for processing the payment. */
9988
+ payment_method?: PaymentMethodReference;
9989
+ }, params?: RequestParams) => Promise<HttpResponse<void, ApiErrorUnauthorized | ApiErrorNotFound | ApiErrorNotAllowed>>;
9797
9990
  /**
9798
9991
  * @description This endpoint is used for voiding an invoice. • When no body parameters are provided, the invoice can be voided only if it is in a `finalized` status and its payment status is NOT `succeeded`. • When `generate_credit_note` is provided (optionally with `refund_amount` and/or `credit_amount`), this validation is bypassed: the invoice is forcibly voided and a credit note is generated. If the specified refund/credit amounts do not cover the full invoice total, the remainder is issued on a second credit note that is created and immediately voided.
9799
9992
  *
@@ -10276,15 +10469,25 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
10276
10469
  */
10277
10470
  getSubscriptionAlerts: (externalId: string, params?: RequestParams) => Promise<HttpResponse<Alerts, ApiErrorUnauthorized | ApiErrorNotFound>>;
10278
10471
  /**
10279
- * @description This endpoint allows you to create a new alert for a subscription.
10472
+ * @description This endpoint allows you to create alerts for a subscription. Send a single alert object wrapped in `alert` key to create one alert, or an array of alert objects wrapped in `alerts` key to create multiple alerts atomically.
10280
10473
  *
10281
10474
  * @tags subscriptions
10282
10475
  * @name CreateSubscriptionAlert
10283
- * @summary Create a subscription alert
10476
+ * @summary Create subscription alert(s)
10284
10477
  * @request POST:/subscriptions/{external_id}/alerts
10285
10478
  * @secure
10286
10479
  */
10287
- createSubscriptionAlert: (externalId: string, data: AlertCreateInput, params?: RequestParams) => Promise<HttpResponse<Alert, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorBadRequest | ApiErrorNotFound>>;
10480
+ createSubscriptionAlert: (externalId: string, data: AlertCreateInput | AlertBatchCreateInput, params?: RequestParams) => Promise<HttpResponse<Alerts | Alert, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorBadRequest | ApiErrorNotFound>>;
10481
+ /**
10482
+ * @description This endpoint allows you to delete all alerts for a subscription.
10483
+ *
10484
+ * @tags subscriptions
10485
+ * @name DeleteAllSubscriptionAlerts
10486
+ * @summary Delete all subscription alerts
10487
+ * @request DELETE:/subscriptions/{external_id}/alerts
10488
+ * @secure
10489
+ */
10490
+ deleteAllSubscriptionAlerts: (externalId: string, params?: RequestParams) => Promise<HttpResponse<void, ApiErrorUnauthorized | ApiErrorNotFound>>;
10288
10491
  /**
10289
10492
  * @description This endpoint enables the retrieval of a specific alert for a subscription.
10290
10493
  *