lago-javascript-client 0.45.0-beta → 0.49.0-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4592 @@
1
+ export interface AddOnBaseInput {
2
+ /**
3
+ * The name of the add-on.
4
+ * @example "Setup Fee"
5
+ */
6
+ name?: string;
7
+ /**
8
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
9
+ * @example "Setup Fee (SF1)"
10
+ */
11
+ invoice_display_name?: string;
12
+ /**
13
+ * Unique code used to identify the add-on.
14
+ * @example "setup_fee"
15
+ */
16
+ code?: string;
17
+ /**
18
+ * The cost of the add-on in cents, excluding any applicable taxes, that is billed to a customer. By creating a one-off invoice, you will be able to override this value.
19
+ * @example 50000
20
+ */
21
+ amount_cents?: number;
22
+ /** The currency of the add-on. */
23
+ amount_currency?: Currency;
24
+ /**
25
+ * The description of the add-on.
26
+ * @example "Implementation fee for new customers."
27
+ */
28
+ description?: string | null;
29
+ /**
30
+ * List of unique code used to identify the taxes.
31
+ * @example ["french_standard_vat"]
32
+ */
33
+ tax_codes?: string[];
34
+ }
35
+ export interface AddOnCreateInput {
36
+ add_on: AddOnBaseInput;
37
+ }
38
+ export interface AddOnObject {
39
+ /**
40
+ * Unique identifier of the add-on, created by Lago.
41
+ * @format uuid
42
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
43
+ */
44
+ lago_id: string;
45
+ /**
46
+ * The name of the add-on.
47
+ * @example "Setup Fee"
48
+ */
49
+ name: string;
50
+ /**
51
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
52
+ * @example "Setup Fee (SF1)"
53
+ */
54
+ invoice_display_name?: string;
55
+ /**
56
+ * Unique code used to identify the add-on.
57
+ * @example "setup_fee"
58
+ */
59
+ code: string;
60
+ /**
61
+ * The cost of the add-on in cents, excluding any applicable taxes, that is billed to a customer. By creating a one-off invoice, you will be able to override this value.
62
+ * @example 50000
63
+ */
64
+ amount_cents: number;
65
+ /** The currency of the add-on. */
66
+ amount_currency: Currency;
67
+ /**
68
+ * The description of the add-on.
69
+ * @example "Implementation fee for new customers."
70
+ */
71
+ description?: string | null;
72
+ /**
73
+ * The date and time when the add-on was created. It is expressed in UTC format according to the ISO 8601 datetime standard. This field provides the timestamp for the exact moment when the add-on was initially created.
74
+ * @format date-time
75
+ * @example "2022-04-29T08:59:51Z"
76
+ */
77
+ created_at: string;
78
+ /** All taxes applied to the add-on. */
79
+ taxes?: TaxObject[];
80
+ }
81
+ export interface AddOn {
82
+ add_on: AddOnObject;
83
+ }
84
+ export interface AddOnsPaginated {
85
+ add_ons: AddOnObject[];
86
+ meta: PaginationMeta;
87
+ }
88
+ export interface AddOnUpdateInput {
89
+ add_on: AddOnBaseInput;
90
+ }
91
+ export interface ApiErrorBadRequest {
92
+ /**
93
+ * @format int32
94
+ * @example 400
95
+ */
96
+ status: number;
97
+ /** @example "Bad request" */
98
+ error: string;
99
+ }
100
+ export interface ApiErrorForbidden {
101
+ /**
102
+ * @format int32
103
+ * @example 403
104
+ */
105
+ status: number;
106
+ /** @example "Forbidden" */
107
+ error: string;
108
+ /** @example "feature_unavailable" */
109
+ code: string;
110
+ }
111
+ export interface ApiErrorUnauthorized {
112
+ /**
113
+ * @format int32
114
+ * @example 401
115
+ */
116
+ status: number;
117
+ /** @example "Unauthorized" */
118
+ error: string;
119
+ }
120
+ export interface ApiErrorUnprocessableEntity {
121
+ /**
122
+ * @format int32
123
+ * @example 422
124
+ */
125
+ status: number;
126
+ /** @example "Unprocessable entity" */
127
+ error: string;
128
+ /** @example "validation_errors" */
129
+ code: string;
130
+ error_details: object;
131
+ }
132
+ export interface ApiErrorNotAllowed {
133
+ /**
134
+ * @format int32
135
+ * @example 405
136
+ */
137
+ status: number;
138
+ /** @example "Method Not Allowed" */
139
+ error: string;
140
+ /** @example "not_allowed" */
141
+ code: string;
142
+ }
143
+ export interface ApiErrorNotFound {
144
+ /**
145
+ * @format int32
146
+ * @example 404
147
+ */
148
+ status: number;
149
+ /** @example "Not Found" */
150
+ error: string;
151
+ /** @example "object_not_found" */
152
+ code: string;
153
+ }
154
+ export interface AppliedCoupon {
155
+ applied_coupon: AppliedCouponObject;
156
+ }
157
+ export interface AppliedCouponInput {
158
+ applied_coupon: {
159
+ /**
160
+ * The customer external unique identifier (provided by your own application)
161
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
162
+ */
163
+ external_customer_id: string;
164
+ /**
165
+ * Unique code used to identify the coupon.
166
+ * @example "startup_deal"
167
+ */
168
+ coupon_code: string;
169
+ /**
170
+ * The type of frequency for the coupon. It can have three possible values: `once`, `recurring` or `forever`.
171
+ *
172
+ * - If set to `once`, the coupon is applicable only for a single use.
173
+ * - If set to `recurring`, the coupon can be used multiple times for recurring billing periods.
174
+ * - If set to `forever`, the coupon has unlimited usage and can be applied indefinitely.
175
+ * @example "recurring"
176
+ */
177
+ frequency?: "once" | "recurring" | null;
178
+ /**
179
+ * Specifies the number of billing periods to which the coupon applies. This field is required only for coupons with a `recurring` frequency type
180
+ * @example 3
181
+ */
182
+ frequency_duration?: number | null;
183
+ /**
184
+ * The amount of the coupon in cents. This field is required only for coupon with `fixed_amount` type.
185
+ * @example 2000
186
+ */
187
+ amount_cents?: number | null;
188
+ /** The currency of the coupon. This field is required only for coupon with `fixed_amount` type. */
189
+ amount_currency?: Currency;
190
+ /**
191
+ * The percentage rate of the coupon. This field is required only for coupons with a `percentage` coupon type.
192
+ * @pattern ^[0-9]+.?[0-9]*$
193
+ * @example null
194
+ */
195
+ percentage_rate?: string | null;
196
+ };
197
+ }
198
+ export interface AppliedCouponObject {
199
+ /**
200
+ * Unique identifier of the applied coupon, created by Lago.
201
+ * @format uuid
202
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
203
+ */
204
+ lago_id: string;
205
+ /**
206
+ * Unique identifier of the coupon, created by Lago.
207
+ * @format uuid
208
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
209
+ */
210
+ lago_coupon_id: string;
211
+ /**
212
+ * Unique code used to identify the coupon.
213
+ * @example "startup_deal"
214
+ */
215
+ coupon_code: string;
216
+ /**
217
+ * The name of the coupon.
218
+ * @example "Startup Deal"
219
+ */
220
+ coupon_name: string;
221
+ /**
222
+ * Unique identifier of the customer, created by Lago.
223
+ * @format uuid
224
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
225
+ */
226
+ lago_customer_id: string;
227
+ /**
228
+ * The customer external unique identifier (provided by your own application)
229
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
230
+ */
231
+ external_customer_id: string;
232
+ /**
233
+ * The status of the coupon. Can be either `active` or `terminated`.
234
+ * @example "active"
235
+ */
236
+ status: "active" | "terminated";
237
+ /**
238
+ * The amount of the coupon in cents. This field is required only for coupon with `fixed_amount` type.
239
+ * @example 2000
240
+ */
241
+ amount_cents?: number | null;
242
+ /**
243
+ * The remaining amount in cents for a `fixed_amount` coupon with a frequency set to `once`. This field indicates the remaining balance or value that can still be utilized from the coupon.
244
+ * @example 50
245
+ */
246
+ amount_cents_remaining?: number | null;
247
+ /** The currency of the coupon. This field is required only for coupon with `fixed_amount` type. */
248
+ amount_currency?: Currency;
249
+ /**
250
+ * The percentage rate of the coupon. This field is required only for coupons with a `percentage` coupon type.
251
+ * @pattern ^[0-9]+.?[0-9]*$
252
+ * @example null
253
+ */
254
+ percentage_rate?: string | null;
255
+ /**
256
+ * The type of frequency for the coupon. It can have three possible values: `once`, `recurring` or `forever`.
257
+ *
258
+ * - If set to `once`, the coupon is applicable only for a single use.
259
+ * - If set to `recurring`, the coupon can be used multiple times for recurring billing periods.
260
+ * - If set to `forever`, the coupon has unlimited usage and can be applied indefinitely.
261
+ * @example "recurring"
262
+ */
263
+ frequency: "once" | "recurring";
264
+ /**
265
+ * Specifies the number of billing periods to which the coupon applies. This field is required only for coupons with a `recurring` frequency type
266
+ * @example 3
267
+ */
268
+ frequency_duration?: number | null;
269
+ /**
270
+ * The remaining number of billing periods to which the coupon is applicable. This field determines the remaining usage or availability of the coupon based on the remaining billing periods.
271
+ * @example 1
272
+ */
273
+ frequency_duration_remaining?: number | null;
274
+ /**
275
+ * The date and time after which the coupon will stop applying to customer's invoices. Once the expiration date is reached, the coupon will no longer be applicable, and any further invoices generated for the customer will not include the coupon discount.
276
+ * @format date-time
277
+ * @example "2022-04-29T08:59:51Z"
278
+ */
279
+ expiration_at?: string | null;
280
+ /**
281
+ * The date and time when the coupon was assigned to a customer. It is expressed in UTC format according to the ISO 8601 datetime standard.
282
+ * @format date-time
283
+ * @example "2022-04-29T08:59:51Z"
284
+ */
285
+ created_at: string;
286
+ /**
287
+ * This field indicates the specific moment when the coupon amount is fully utilized or when the coupon is removed from the customer's coupon list. It is expressed in UTC format according to the ISO 8601 datetime standard.
288
+ * @format date-time
289
+ * @example "2022-04-29T08:59:51Z"
290
+ */
291
+ terminated_at?: string | null;
292
+ }
293
+ export type AppliedCouponObjectExtended = AppliedCouponObject & {
294
+ credits: CreditObject[];
295
+ };
296
+ export interface AppliedCouponsPaginated {
297
+ applied_coupons: AppliedCouponObjectExtended[];
298
+ meta: PaginationMeta;
299
+ }
300
+ export interface BaseAppliedTax {
301
+ /**
302
+ * Unique identifier of the applied tax, created by Lago.
303
+ * @format uuid
304
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
305
+ */
306
+ lago_id?: string;
307
+ /**
308
+ * Unique identifier of the tax, created by Lago.
309
+ * @format uuid
310
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
311
+ */
312
+ lago_tax_id?: string;
313
+ /**
314
+ * Name of the tax.
315
+ * @example "TVA"
316
+ */
317
+ tax_name?: string;
318
+ /**
319
+ * Unique code used to identify the tax associated with the API request.
320
+ * @example "french_standard_vat"
321
+ */
322
+ tax_code?: string;
323
+ /**
324
+ * The percentage rate of the tax
325
+ * @example 20
326
+ */
327
+ tax_rate?: number;
328
+ /**
329
+ * Internal description of the taxe
330
+ * @example "French standard VAT"
331
+ */
332
+ tax_description?: string;
333
+ /**
334
+ * Amount of the tax
335
+ * @example 2000
336
+ */
337
+ amount_cents?: number;
338
+ /** Currency of the tax */
339
+ amount_currency?: Currency;
340
+ /**
341
+ * The date and time when the applied tax was created. It is expressed in UTC format according to the ISO 8601 datetime standard. This field provides the timestamp for the exact moment when the applied tax was initially created.
342
+ * @format date-time
343
+ * @example "2022-09-14T16:35:31Z"
344
+ */
345
+ created_at?: string;
346
+ }
347
+ export interface BillableMetric {
348
+ billable_metric: BillableMetricObject;
349
+ }
350
+ export interface BillableMetricObject {
351
+ /**
352
+ * Unique identifier of the billable metric created by Lago.
353
+ * @format uuid
354
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
355
+ */
356
+ lago_id: string;
357
+ /**
358
+ * Name of the billable metric.
359
+ * @example "Storage"
360
+ */
361
+ name: string;
362
+ /**
363
+ * Unique code used to identify the billable metric associated with the API request. This code associates each event with the correct metric.
364
+ * @example "storage"
365
+ */
366
+ code: string;
367
+ /**
368
+ * Internal description of the billable metric.
369
+ * @example "GB of storage used in my application"
370
+ */
371
+ description?: string | null;
372
+ /**
373
+ * Defines if the billable metric is persisted billing period over billing period.
374
+ *
375
+ * - If set to `true`: the accumulated number of units calculated from the previous billing period is persisted to the next billing period.
376
+ * - If set to `false`: the accumulated number of units is reset to 0 at the end of the billing period.
377
+ * - If not defined in the request, default value is `false`.
378
+ * @example false
379
+ */
380
+ recurring: boolean;
381
+ /**
382
+ * Creation date of the billable metric.
383
+ * @format date-time
384
+ * @example "2022-09-14T16:35:31Z"
385
+ */
386
+ created_at: string;
387
+ /**
388
+ * Property of the billable metric used for aggregating usage data. This field is not required for `count_agg`.
389
+ * @example "gb"
390
+ */
391
+ field_name?: string | null;
392
+ /**
393
+ * Aggregation method used to compute usage for this billable metric.
394
+ * @example "sum_agg"
395
+ */
396
+ aggregation_type: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg" | "weighted_sum_agg" | "latest_agg";
397
+ /**
398
+ * Parameter exclusively utilized in conjunction with the `weighted_sum` aggregation type. It serves to adjust the aggregation result by assigning weights and proration to the result based on time intervals. When this field is not provided, the default time interval is assumed to be in `seconds`.
399
+ * @example "seconds"
400
+ */
401
+ weighted_interval?: "seconds" | null;
402
+ /** Group with one or two dimensions, used to apply differentiated pricing based on additional properties of the billable metric. */
403
+ group?: BillableMetricGroup;
404
+ /**
405
+ * Number of active subscriptions using this billable metric.
406
+ * @example 4
407
+ */
408
+ active_subscriptions_count: number;
409
+ /**
410
+ * Number of draft invoices for which this billable metric is listed as an invoice item.
411
+ * @example 10
412
+ */
413
+ draft_invoices_count: number;
414
+ /**
415
+ * Number of plans using this billable metric.
416
+ * @example 4
417
+ */
418
+ plans_count: number;
419
+ }
420
+ export interface BillableMetricBaseInput {
421
+ /**
422
+ * Name of the billable metric.
423
+ * @example "Storage"
424
+ */
425
+ name?: string;
426
+ /**
427
+ * Unique code used to identify the billable metric associated with the API request. This code associates each event with the correct metric.
428
+ * @example "storage"
429
+ */
430
+ code?: string;
431
+ /**
432
+ * Internal description of the billable metric.
433
+ * @example "GB of storage used in my application"
434
+ */
435
+ description?: string | null;
436
+ /**
437
+ * Defines if the billable metric is persisted billing period over billing period.
438
+ *
439
+ * - If set to `true`: the accumulated number of units calculated from the previous billing period is persisted to the next billing period.
440
+ * - If set to `false`: the accumulated number of units is reset to 0 at the end of the billing period.
441
+ * - If not defined in the request, default value is `false`.
442
+ * @example false
443
+ */
444
+ recurring?: boolean;
445
+ /**
446
+ * Property of the billable metric used for aggregating usage data. This field is not required for `count_agg`.
447
+ * @example "gb"
448
+ */
449
+ field_name?: string | null;
450
+ /**
451
+ * Aggregation method used to compute usage for this billable metric.
452
+ * @example "sum_agg"
453
+ */
454
+ aggregation_type?: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg" | "weighted_sum_agg" | "latest_agg";
455
+ /**
456
+ * Parameter exclusively utilized in conjunction with the `weighted_sum` aggregation type. It serves to adjust the aggregation result by assigning weights and proration to the result based on time intervals. When this field is not provided, the default time interval is assumed to be in `seconds`.
457
+ * @example "seconds"
458
+ */
459
+ weighted_interval?: "seconds" | null;
460
+ /** Group with one or two dimensions, used to apply differentiated pricing based on additional properties of the billable metric. */
461
+ group?: BillableMetricGroup;
462
+ }
463
+ export interface BillableMetricCreateInput {
464
+ billable_metric: BillableMetricBaseInput;
465
+ }
466
+ export interface BillableMetricUpdateInput {
467
+ billable_metric: BillableMetricBaseInput;
468
+ }
469
+ /** Group with one or two dimensions, used to apply differentiated pricing based on additional properties of the billable metric. */
470
+ export interface BillableMetricGroup {
471
+ /**
472
+ * Name of the event property used to group values.
473
+ * @example "region"
474
+ */
475
+ key: string;
476
+ /**
477
+ * Array of strings or objects representing all possible values.
478
+ * @example ["us-east-1","us-east-2","eu-west-1"]
479
+ */
480
+ values: (string | {
481
+ /**
482
+ * Name of the event property used to group values.
483
+ * @example "region"
484
+ */
485
+ key: string;
486
+ /**
487
+ * Array of strings representing all possible values.
488
+ * @example ["us-east-1","us-east-2","eu-west-1"]
489
+ */
490
+ values: string[];
491
+ })[];
492
+ }
493
+ export interface BillableMetricsPaginated {
494
+ billable_metrics: BillableMetricObject[];
495
+ meta: PaginationMeta;
496
+ }
497
+ export interface ChargeObject {
498
+ /**
499
+ * Unique identifier of charge, created by Lago.
500
+ * @format uuid
501
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
502
+ */
503
+ lago_id: string;
504
+ /**
505
+ * Unique identifier of the billable metric created by Lago.
506
+ * @format uuid
507
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
508
+ */
509
+ lago_billable_metric_id: string;
510
+ /**
511
+ * Unique code identifying a billable metric.
512
+ * @example "requests"
513
+ */
514
+ billable_metric_code: string;
515
+ /**
516
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
517
+ * @example "Setup"
518
+ */
519
+ invoice_display_name?: string;
520
+ /**
521
+ * The date and time when the charge was created. It is expressed in UTC format according to the ISO 8601 datetime standard.
522
+ * @format date-time
523
+ * @example "2022-09-14T16:35:31Z"
524
+ */
525
+ created_at: string;
526
+ /** Specifies the pricing model used for the calculation of the final fee. It can be `standard`, `graduated`, `graduated_percentage`, `package`, `percentage` or `volume`. */
527
+ charge_model: "standard" | "graduated" | "graduated_percentage" | "package" | "percentage" | "volume";
528
+ /**
529
+ * This field determines the billing timing for this specific usage-based charge. When set to `true`, the charge is due and invoiced immediately. Conversely, when set to `false`, the charge is due and invoiced at the end of each billing period.
530
+ * @example true
531
+ */
532
+ pay_in_advance?: boolean;
533
+ /**
534
+ * This field specifies whether the charge should be included in a proper invoice. If set to `false`, no invoice will be issued for this charge. You can only set it to `false` when `pay_in_advance` is `true`.
535
+ * @example true
536
+ */
537
+ invoiceable?: boolean;
538
+ /**
539
+ * Specifies whether a charge is prorated based on the remaining number of days in the billing period or billed fully.
540
+ *
541
+ * - If set to `true`, the charge is prorated based on the remaining days in the current billing period.
542
+ * - If set to `false`, the charge is billed in full.
543
+ * - If not defined in the request, default value is `false`.
544
+ * @example false
545
+ */
546
+ prorated?: boolean;
547
+ /**
548
+ * The minimum spending amount required for the charge, measured in cents and excluding any applicable taxes. It indicates the minimum amount that needs to be charged for each billing period.
549
+ * @example 1200
550
+ */
551
+ min_amount_cents?: number;
552
+ /** List of all thresholds utilized for calculating the charge. */
553
+ properties?: ChargeProperties;
554
+ /** All charge information, sorted by groups. */
555
+ group_properties?: GroupPropertiesObject[];
556
+ /** All taxes applied to the charge. */
557
+ taxes?: TaxObject[];
558
+ }
559
+ export interface ChargeProperties {
560
+ /** Graduated ranges, sorted from bottom to top tiers, used for a `graduated` charge model. */
561
+ graduated_ranges?: {
562
+ /**
563
+ * Specifies the lower value of a tier for a `graduated` charge model. It must be either 0 or the previous range's `to_value + 1` to maintain the proper sequence of values.
564
+ * @example 0
565
+ */
566
+ from_value: number;
567
+ /**
568
+ * Specifies the highest value of a tier for a `graduated` charge model.
569
+ * - This value must be higher than the from_value of the same tier.
570
+ * - This value must be null for the last tier.
571
+ * @example 10
572
+ */
573
+ to_value: number | null;
574
+ /**
575
+ * The flat amount for a whole tier, excluding tax, for a `graduated` charge model. It is expressed as a decimal value.
576
+ * @pattern ^[0-9]+.?[0-9]*$
577
+ * @example "10"
578
+ */
579
+ flat_amount: string;
580
+ /**
581
+ * The unit price, excluding tax, for a specific tier of a `graduated` charge model. It is expressed as a decimal value.
582
+ * @pattern ^[0-9]+.?[0-9]*$
583
+ * @example "0.5"
584
+ */
585
+ per_unit_amount: string;
586
+ }[];
587
+ /** Graduated percentage ranges, sorted from bottom to top tiers, used for a `graduated_percentage` charge model. */
588
+ graduated_percentage_ranges?: {
589
+ /**
590
+ * Specifies the lower value of a tier for a `graduated_percentage` charge model. It must be either 0 or the previous range's `to_value + 1` to maintain the proper sequence of values.
591
+ * @example 0
592
+ */
593
+ from_value: number;
594
+ /**
595
+ * Specifies the highest value of a tier for a `graduated_percentage` charge model.
596
+ * - This value must be higher than the from_value of the same tier.
597
+ * - This value must be null for the last tier.
598
+ * @example 10
599
+ */
600
+ to_value: number | null;
601
+ /**
602
+ * The percentage rate that is applied to the amount of each transaction in the tier for a `graduated_percentage` charge model. It is expressed as a decimal value.
603
+ * @format ^[0-9]+.?[0-9]*$
604
+ * @example "1"
605
+ */
606
+ rate: string;
607
+ /**
608
+ * The flat amount for a whole tier, excluding tax, for a `graduated_percentage` charge model. It is expressed as a decimal value.
609
+ * @format ^[0-9]+.?[0-9]*$
610
+ * @example "10"
611
+ */
612
+ flat_amount: string;
613
+ }[];
614
+ /**
615
+ * - The unit price, excluding tax, for a `standard` charge model. It is expressed as a decimal value.
616
+ * - The amount, excluding tax, for a complete set of units in a `package` charge model. It is expressed as a decimal value.
617
+ * @pattern ^[0-9]+.?[0-9]*$
618
+ * @example "30"
619
+ */
620
+ amount?: string;
621
+ /**
622
+ * The quantity of units that are provided free of charge for each billing period in a `package` charge model. This field specifies the number of units that customers can use without incurring any additional cost during each billing cycle.
623
+ * @example 100
624
+ */
625
+ free_units?: number;
626
+ /**
627
+ * The quantity of units included in each pack or set for a `package` charge model. It indicates the number of units that are bundled together as a single package or set within the pricing structure.
628
+ * @example 1000
629
+ */
630
+ package_size?: number;
631
+ /**
632
+ * The percentage rate that is applied to the amount of each transaction for a `percentage` charge model. It is expressed as a decimal value.
633
+ * @pattern ^[0-9]+.?[0-9]*$
634
+ * @example "1"
635
+ */
636
+ rate?: string;
637
+ /**
638
+ * The fixed fee that is applied to each transaction for a `percentage` charge model. It is expressed as a decimal value.
639
+ * @pattern ^[0-9]+.?[0-9]*$
640
+ * @example "0.5"
641
+ */
642
+ fixed_amount?: string;
643
+ /**
644
+ * The count of transactions that are not impacted by the `percentage` rate and fixed fee in a percentage charge model. This field indicates the number of transactions that are exempt from the calculation of charges based on the specified percentage rate and fixed fee.
645
+ * @example 5
646
+ */
647
+ free_units_per_events?: number | null;
648
+ /**
649
+ * The transaction amount that is not impacted by the `percentage` rate and fixed fee in a percentage charge model. This field indicates the portion of the transaction amount that is exempt from the calculation of charges based on the specified percentage rate and fixed fee.
650
+ * @pattern ^[0-9]+.?[0-9]*$
651
+ * @example "500"
652
+ */
653
+ free_units_per_total_aggregation?: string | null;
654
+ /**
655
+ * Specifies the maximum allowable spending for a single transaction. Working as a transaction cap.
656
+ * @format ^[0-9]+.?[0-9]*$
657
+ * @example "3.75"
658
+ */
659
+ per_transaction_max_amount?: string | null;
660
+ /**
661
+ * Specifies the minimum allowable spending for a single transaction. Working as a transaction floor.
662
+ * @format ^[0-9]+.?[0-9]*$
663
+ * @example "1.75"
664
+ */
665
+ per_transaction_min_amount?: string | null;
666
+ /** Volume ranges, sorted from bottom to top tiers, used for a `volume` charge model. */
667
+ volume_ranges?: {
668
+ /**
669
+ * Specifies the lower value of a tier for a `volume` charge model. It must be either 0 or the previous range's `to_value + 1` to maintain the proper sequence of values.
670
+ * @example 0
671
+ */
672
+ from_value: number;
673
+ /**
674
+ * Specifies the highest value of a tier for a `volume` charge model.
675
+ * - This value must be higher than the `from_value` of the same tier.
676
+ * - This value must be `null` for the last tier.
677
+ * @example 10
678
+ */
679
+ to_value: number | null;
680
+ /**
681
+ * The unit price, excluding tax, for a specific tier of a `volume` charge model. It is expressed as a decimal value.
682
+ * @pattern ^[0-9]+.?[0-9]*$
683
+ * @example "10"
684
+ */
685
+ flat_amount: string;
686
+ /**
687
+ * The flat amount for a whole tier, excluding tax, for a `volume` charge model. It is expressed as a decimal value.
688
+ * @pattern ^[0-9]+.?[0-9]*$
689
+ * @example "0.5"
690
+ */
691
+ per_unit_amount: string;
692
+ }[];
693
+ }
694
+ /** @example "US" */
695
+ export type Country = "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";
696
+ export interface Coupon {
697
+ coupon: CouponObject;
698
+ }
699
+ export interface CouponBaseInput {
700
+ /**
701
+ * The name of the coupon.
702
+ * @example "Startup Deal"
703
+ */
704
+ name?: string;
705
+ /**
706
+ * Unique code used to identify the coupon.
707
+ * @example "startup_deal"
708
+ */
709
+ code?: string;
710
+ /**
711
+ * Description of the coupon.
712
+ * @example "I am a coupon description"
713
+ */
714
+ description?: string | null;
715
+ /**
716
+ * The type of the coupon. It can have two possible values: `fixed_amount` or `percentage`.
717
+ *
718
+ * - If set to `fixed_amount`, the coupon represents a fixed amount discount.
719
+ * - If set to `percentage`, the coupon represents a percentage-based discount.
720
+ * @example "fixed_amount"
721
+ */
722
+ coupon_type?: "fixed_amount" | "percentage";
723
+ /**
724
+ * The amount of the coupon in cents. This field is required only for coupon with `fixed_amount` type.
725
+ * @example 5000
726
+ */
727
+ amount_cents?: number | null;
728
+ /** The currency of the coupon. This field is required only for coupon with `fixed_amount` type. */
729
+ amount_currency?: Currency;
730
+ /**
731
+ * Indicates whether the coupon can be reused or not. If set to `true`, the coupon is reusable, meaning it can be applied multiple times to the same customer. If set to `false`, the coupon can only be used once and is not reusable. If not specified, this field is set to `true` by default.
732
+ * @example false
733
+ */
734
+ reusable?: boolean;
735
+ /**
736
+ * The percentage rate of the coupon. This field is required only for coupons with a `percentage` coupon type.
737
+ * @pattern ^[0-9]+.?[0-9]*$
738
+ * @example null
739
+ */
740
+ percentage_rate?: string | null;
741
+ /**
742
+ * The type of frequency for the coupon. It can have three possible values: `once`, `recurring` or `forever`.
743
+ *
744
+ * - If set to `once`, the coupon is applicable only for a single use.
745
+ * - If set to `recurring`, the coupon can be used multiple times for recurring billing periods.
746
+ * - If set to `forever`, the coupon has unlimited usage and can be applied indefinitely.
747
+ * @example "recurring"
748
+ */
749
+ frequency?: "once" | "recurring";
750
+ /**
751
+ * Specifies the number of billing periods to which the coupon applies. This field is required only for coupons with a `recurring` frequency type
752
+ * @example 6
753
+ */
754
+ frequency_duration?: number | null;
755
+ /**
756
+ * Specifies the type of expiration for the coupon. It can have two possible values: `time_limit` or `no_expiration`.
757
+ *
758
+ * - If set to `time_limit`, the coupon has an expiration based on a specified time limit.
759
+ * - If set to `no_expiration`, the coupon does not have an expiration date and remains valid indefinitely.
760
+ * @example "time_limit"
761
+ */
762
+ expiration?: "no_expiration" | "time_limit";
763
+ /**
764
+ * The expiration date and time of the coupon. This field is required only for coupons with `expiration` set to `time_limit`. The expiration date and time should be specified in UTC format according to the ISO 8601 datetime standard. It indicates the exact moment when the coupon will expire and is no longer valid.
765
+ * @format date-time
766
+ * @example "2022-08-08T23:59:59Z"
767
+ */
768
+ expiration_at?: string | null;
769
+ /** Set coupon limitations to plans or specific metrics. */
770
+ applies_to?: {
771
+ /**
772
+ * An array of plan codes to which the coupon is applicable. By specifying the plan codes in this field, you can restrict the coupon's usage to specific plans only.
773
+ * @example ["startup_plan"]
774
+ */
775
+ plan_codes?: string[] | null;
776
+ /**
777
+ * An array of billable metric codes to which the coupon is applicable. By specifying the billable metric codes in this field, you can restrict the coupon's usage to specific metrics only.
778
+ * @example []
779
+ */
780
+ billable_metric_codes?: string[] | null;
781
+ };
782
+ }
783
+ export interface CouponCreateInput {
784
+ coupon: CouponBaseInput;
785
+ }
786
+ export interface CouponObject {
787
+ /**
788
+ * Unique identifier of the coupon, created by Lago.
789
+ * @format uuid
790
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
791
+ */
792
+ lago_id: string;
793
+ /**
794
+ * The name of the coupon.
795
+ * @example "Startup Deal"
796
+ */
797
+ name: string;
798
+ /**
799
+ * Unique code used to identify the coupon.
800
+ * @example "startup_deal"
801
+ */
802
+ code: string;
803
+ /**
804
+ * Description of the coupon.
805
+ * @example "I am a coupon description"
806
+ */
807
+ description?: string | null;
808
+ /**
809
+ * The type of the coupon. It can have two possible values: `fixed_amount` or `percentage`.
810
+ *
811
+ * - If set to `fixed_amount`, the coupon represents a fixed amount discount.
812
+ * - If set to `percentage`, the coupon represents a percentage-based discount.
813
+ * @example "fixed_amount"
814
+ */
815
+ coupon_type: "fixed_amount" | "percentage";
816
+ /**
817
+ * The amount of the coupon in cents. This field is required only for coupon with `fixed_amount` type.
818
+ * @example 5000
819
+ */
820
+ amount_cents?: number | null;
821
+ /** The currency of the coupon. This field is required only for coupon with `fixed_amount` type. */
822
+ amount_currency?: Currency;
823
+ /**
824
+ * Indicates whether the coupon can be reused or not. If set to `true`, the coupon is reusable, meaning it can be applied multiple times to the same customer. If set to `false`, the coupon can only be used once and is not reusable. If not specified, this field is set to `true` by default.
825
+ * @example true
826
+ */
827
+ reusable: boolean;
828
+ /**
829
+ * The coupon is limited to specific plans. The possible values can be `true` or `false`.
830
+ * @example true
831
+ */
832
+ limited_plans: boolean;
833
+ /**
834
+ * An array of plan codes to which the coupon is applicable. By specifying the plan codes in this field, you can restrict the coupon's usage to specific plans only.
835
+ * @example ["startup_plan"]
836
+ */
837
+ plan_codes?: string[];
838
+ /**
839
+ * The coupon is limited to specific billable metrics. The possible values can be `true` or `false`.
840
+ * @example false
841
+ */
842
+ limited_billable_metrics: boolean;
843
+ /**
844
+ * An array of billable metric codes to which the coupon is applicable. By specifying the billable metric codes in this field, you can restrict the coupon's usage to specific metrics only.
845
+ * @example []
846
+ */
847
+ billable_metric_codes?: string[];
848
+ /**
849
+ * The percentage rate of the coupon. This field is required only for coupons with a `percentage` coupon type.
850
+ * @pattern ^[0-9]+.?[0-9]*$
851
+ * @example null
852
+ */
853
+ percentage_rate?: string | null;
854
+ /**
855
+ * The type of frequency for the coupon. It can have three possible values: `once`, `recurring`, or `forever`.
856
+ *
857
+ * - If set to `once`, the coupon is applicable only for a single use.
858
+ * - If set to `recurring`, the coupon can be used multiple times for recurring billing periods.
859
+ * - If set to `forever`, the coupon has unlimited usage and can be applied indefinitely.
860
+ * @example "recurring"
861
+ */
862
+ frequency: "once" | "recurring";
863
+ /**
864
+ * Specifies the number of billing periods to which the coupon applies. This field is required only for coupons with a `recurring` frequency type
865
+ * @example 6
866
+ */
867
+ frequency_duration?: number | null;
868
+ /**
869
+ * Specifies the type of expiration for the coupon. It can have two possible values: `time_limit` or `no_expiration`.
870
+ *
871
+ * - If set to `time_limit`, the coupon has an expiration based on a specified time limit.
872
+ * - If set to `no_expiration`, the coupon does not have an expiration date and remains valid indefinitely.
873
+ * @example "time_limit"
874
+ */
875
+ expiration: "no_expiration" | "time_limit";
876
+ /**
877
+ * The expiration date and time of the coupon. This field is required only for coupons with `expiration` set to `time_limit`. The expiration date and time should be specified in UTC format according to the ISO 8601 datetime standard. It indicates the exact moment when the coupon will expire and is no longer valid.
878
+ * @format date-time
879
+ * @example "2022-08-08T23:59:59Z"
880
+ */
881
+ expiration_at?: string | null;
882
+ /**
883
+ * The date and time when the coupon was created. It is expressed in UTC format according to the ISO 8601 datetime standard. This field provides the timestamp for the exact moment when the coupon was initially created.
884
+ * @format date-time
885
+ * @example "2022-04-29T08:59:51Z"
886
+ */
887
+ created_at: string;
888
+ /**
889
+ * This field indicates if the coupon has been terminated and is no longer usable. If it's not null, it won't be removed for existing customers using it, but it prevents the coupon from being applied in the future.
890
+ * @format date-time
891
+ * @example "2022-08-08T23:59:59Z"
892
+ */
893
+ terminated_at?: string;
894
+ }
895
+ export interface CouponsPaginated {
896
+ coupons: CouponObject[];
897
+ meta: PaginationMeta;
898
+ }
899
+ export interface CouponUpdateInput {
900
+ coupon: CouponBaseInput;
901
+ }
902
+ export interface CreditObject {
903
+ /**
904
+ * Unique identifier assigned to the credit within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the credit’s item record within the Lago system.
905
+ * @format uuid
906
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
907
+ */
908
+ lago_id: string;
909
+ /**
910
+ * The amount of credit associated with the invoice, expressed in cents.
911
+ * @example 1200
912
+ */
913
+ amount_cents: number;
914
+ /** The currency of the credit. */
915
+ amount_currency: Currency;
916
+ /**
917
+ * Indicates whether the credit is applied on the amount before taxes (coupons) or after taxes (credit notes). This flag helps determine the order in which credits are applied to the invoice calculation
918
+ * @example false
919
+ */
920
+ before_taxes: boolean;
921
+ /** The item attached to the credit. */
922
+ item: {
923
+ /**
924
+ * Unique identifier assigned to the credit item within the Lago application.
925
+ * @format uuid
926
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
927
+ */
928
+ lago_item_id: string;
929
+ /**
930
+ * The type of credit applied. Possible values are `coupon` or `credit_note`.
931
+ * @example "coupon"
932
+ */
933
+ type: "coupon" | "credit_note";
934
+ /**
935
+ * The code of the credit applied. It can be the code of the coupon attached to the credit or the credit note's number.
936
+ * @example "startup_deal"
937
+ */
938
+ code: string;
939
+ /**
940
+ * The name of the credit applied. It can be the name of the coupon attached to the credit or the initial invoice's number linked to the credit note.
941
+ * @example "Startup Deal"
942
+ */
943
+ name: string;
944
+ };
945
+ invoice: {
946
+ /**
947
+ * @format uuid
948
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
949
+ */
950
+ lago_id: string;
951
+ /** @example "succeeded" */
952
+ payment_status: "pending" | "succeeded" | "failed";
953
+ };
954
+ }
955
+ export interface CreditNote {
956
+ credit_note: CreditNoteObject;
957
+ }
958
+ export type CreditNoteAppliedTaxObject = BaseAppliedTax & {
959
+ /**
960
+ * Unique identifier of the credit note, created by Lago.
961
+ * @format uuid
962
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
963
+ */
964
+ lago_credit_note_id?: string;
965
+ /** @example 100 */
966
+ base_amount_cents?: number;
967
+ };
968
+ export interface CreditNoteItemObject {
969
+ /**
970
+ * The credit note’s item unique identifier, created by Lago.
971
+ * @format uuid
972
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
973
+ */
974
+ lago_id: string;
975
+ /**
976
+ * The credit note’s item amount, expressed in cents.
977
+ * @example 100
978
+ */
979
+ amount_cents: number;
980
+ /** The credit note’s item currency. */
981
+ amount_currency: Currency;
982
+ /** The fee object related to the credit note item. */
983
+ fee: FeeObject;
984
+ }
985
+ export interface CreditNoteObject {
986
+ /**
987
+ * The credit note unique identifier, created by Lago.
988
+ * @format uuid
989
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
990
+ */
991
+ lago_id: string;
992
+ /**
993
+ * The sequential identifier of the credit note, specifically scoped on the associated invoice. It provides a unique numerical identifier for the credit note within the context of the invoice.
994
+ * @example 2
995
+ */
996
+ sequential_id: number;
997
+ /**
998
+ * The credit note unique number.
999
+ * @example "LAG-1234-CN2"
1000
+ */
1001
+ number: string;
1002
+ /**
1003
+ * Unique identifier assigned to the invoice that the credit note belongs to
1004
+ * @format uuid
1005
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1006
+ */
1007
+ lago_invoice_id: string;
1008
+ /**
1009
+ * The invoice unique number, related to the credit note.
1010
+ * @example "LAG-1234"
1011
+ */
1012
+ invoice_number: string;
1013
+ /**
1014
+ * 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.
1015
+ * @format date
1016
+ * @example "2022-12-06"
1017
+ */
1018
+ issuing_date: string;
1019
+ /**
1020
+ * The status of the credit portion of the credit note. It indicates the current state or condition of the credit amount associated with the credit note. The possible values for this field are:
1021
+ *
1022
+ * - `available`: this status indicates that an amount remains available for future usage. The credit can be applied towards future transactions or invoices.
1023
+ * - `consumed`: this status indicates that the credit amount has been fully consumed. The remaining amount is 0, indicating that the credit has been utilized in its entirety.
1024
+ * - `voided`: this status indicates that the remaining amount of the credit cannot be used any further. The credit has been voided and is no longer available for application or redemption.
1025
+ * @example "available"
1026
+ */
1027
+ credit_status?: "available" | "consumed" | "voided" | null;
1028
+ /**
1029
+ * 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:
1030
+ *
1031
+ * - `pending`: this status indicates that the refund is pending execution. The refund request has been initiated but has not been processed or completed yet.
1032
+ * - `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.
1033
+ * - `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.
1034
+ * @example "pending"
1035
+ */
1036
+ refund_status?: "pending" | "succeeded" | "failed" | null;
1037
+ /**
1038
+ * The reason of the credit note creation.
1039
+ * Possible values are `duplicated_charge`, `product_unsatisfactory`, `order_change`, `order_cancellation`, `fraudulent_charge` or `other`.
1040
+ * @example "other"
1041
+ */
1042
+ reason: "duplicated_charge" | "product_unsatisfactory" | "order_change" | "order_cancellation" | "fraudulent_charge" | "other";
1043
+ /**
1044
+ * The description of the credit note.
1045
+ * @example "Free text"
1046
+ */
1047
+ description?: string | null;
1048
+ /** The currency of the credit note. */
1049
+ currency: Currency;
1050
+ /**
1051
+ * The total amount of the credit note, expressed in cents.
1052
+ * @example 120
1053
+ */
1054
+ total_amount_cents: number;
1055
+ /**
1056
+ * The tax amount of the credit note, expressed in cents.
1057
+ * @example 20
1058
+ */
1059
+ taxes_amount_cents: number;
1060
+ /**
1061
+ * The tax rate associated with this specific credit note.
1062
+ * @example 20
1063
+ */
1064
+ taxes_rate: number;
1065
+ /**
1066
+ * The subtotal of the credit note excluding any applicable taxes, expressed in cents.
1067
+ * @example 100
1068
+ */
1069
+ sub_total_excluding_taxes_amount_cents: number;
1070
+ /**
1071
+ * The remaining credit note amount, expressed in cents.
1072
+ * @example 100
1073
+ */
1074
+ balance_amount_cents: number;
1075
+ /**
1076
+ * The credited amount of the credit note, expressed in cents.
1077
+ * @example 100
1078
+ */
1079
+ credit_amount_cents: number;
1080
+ /**
1081
+ * The refunded amount of the credit note, expressed in cents.
1082
+ * @example 0
1083
+ */
1084
+ refund_amount_cents: number;
1085
+ /**
1086
+ * The pro-rated amount of the coupons applied to the source invoice.
1087
+ * @example 20
1088
+ */
1089
+ coupons_adjustement_amount_cents: number;
1090
+ /**
1091
+ * The date when the credit note was created. It is expressed in Coordinated Universal Time (UTC).
1092
+ * @format date-time
1093
+ * @example "2022-09-14T16:35:31Z"
1094
+ */
1095
+ created_at: string;
1096
+ /**
1097
+ * The date when the credit note was last updated. It is expressed in Coordinated Universal Time (UTC).
1098
+ * @format date-time
1099
+ * @example "2022-09-14T16:35:31Z"
1100
+ */
1101
+ updated_at: string;
1102
+ /**
1103
+ * The PDF file of the credit note.
1104
+ * @example "https://getlago.com/credit_note/file"
1105
+ */
1106
+ file_url?: string | null;
1107
+ /** Array of credit note’s items. */
1108
+ items?: CreditNoteItemObject[];
1109
+ applied_taxes?: CreditNoteAppliedTaxObject[];
1110
+ }
1111
+ export interface CreditNotes {
1112
+ credit_notes: CreditNoteObject[];
1113
+ }
1114
+ export interface CreditNoteCreateInput {
1115
+ credit_note: {
1116
+ /**
1117
+ * The invoice unique identifier, created by Lago.
1118
+ * @format uuid
1119
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1120
+ */
1121
+ invoice_id: string;
1122
+ /**
1123
+ * The reason of the credit note creation.
1124
+ * Possible values are `duplicated_charge`, `product_unsatisfactory`, `order_change`, `order_cancellation`, `fraudulent_charge` or `other`.
1125
+ * @example "duplicated_charge"
1126
+ */
1127
+ reason?: "duplicated_charge" | "product_unsatisfactory" | "order_change" | "order_cancellation" | "fraudulent_charge" | "other" | null;
1128
+ /**
1129
+ * The description of the credit note.
1130
+ * @example "description"
1131
+ */
1132
+ description?: string;
1133
+ /**
1134
+ * The total amount to be credited on the customer balance.
1135
+ * @example 10
1136
+ */
1137
+ credit_amount_cents?: number | null;
1138
+ /**
1139
+ * The total amount to be refunded to the customer.
1140
+ * @example 5
1141
+ */
1142
+ refund_amount_cents?: number | null;
1143
+ /**
1144
+ * The list of credit note’s items.
1145
+ * @example [{"fee_id":"1a901a90-1a90-1a90-1a90-1a901a901a90","amount_cents":10},{"fee_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","amount_cents":5}]
1146
+ */
1147
+ items: {
1148
+ /**
1149
+ * The fee unique identifier, created by Lago.
1150
+ * @format uuid
1151
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1152
+ */
1153
+ fee_id: string;
1154
+ /**
1155
+ * The amount of the credit note item, expressed in cents.
1156
+ * @example 10
1157
+ */
1158
+ amount_cents: number;
1159
+ }[];
1160
+ };
1161
+ }
1162
+ export interface CreditNoteUpdateInput {
1163
+ credit_note: {
1164
+ /**
1165
+ * 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:
1166
+ *
1167
+ * - `pending`: this status indicates that the refund is pending execution. The refund request has been initiated but has not been processed or completed yet.
1168
+ * - `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.
1169
+ * - `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.
1170
+ * @example "succeeded"
1171
+ */
1172
+ refund_status: "pending" | "succeeded" | "failed";
1173
+ };
1174
+ }
1175
+ /** @example "USD" */
1176
+ 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";
1177
+ export interface Customer {
1178
+ customer: CustomerObjectExtended;
1179
+ }
1180
+ /** 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. */
1181
+ export interface CustomerBillingConfiguration {
1182
+ /**
1183
+ * The grace period, expressed in days, for the invoice. This period refers to the additional time granted to the customer beyond the invoice due date to adjust usage and line items
1184
+ * @example 3
1185
+ */
1186
+ invoice_grace_period?: number;
1187
+ /**
1188
+ * The payment provider utilized to initiate payments for invoices issued by Lago.
1189
+ * Accepted values: `stripe`, `adyen`, `gocardless` or null. This field is required if you intend to assign a `provider_customer_id`.
1190
+ * @example "stripe"
1191
+ */
1192
+ payment_provider?: "stripe" | "adyen" | "gocardless";
1193
+ /**
1194
+ * The customer ID within the payment provider's system. If this field is not provided, Lago has the option to create a new customer record within the payment provider's system on behalf of the customer
1195
+ * @example "cus_12345"
1196
+ */
1197
+ provider_customer_id?: string;
1198
+ /**
1199
+ * Set this field to `true` if you want to create the customer in the payment provider synchronously with the customer creation process in Lago. This option is applicable only when the `provider_customer_id` is `null` and the customer is automatically created in the payment provider through Lago. By default, the value is set to `false`
1200
+ * @example true
1201
+ */
1202
+ sync?: boolean;
1203
+ /**
1204
+ * Set this field to `true` if you want to create a customer record in the payment provider's system. This option is applicable only when the `provider_customer_id` is null and the `sync_with_provider` field is set to `true`. By default, the value is set to `false`
1205
+ * @example true
1206
+ */
1207
+ sync_with_provider?: boolean;
1208
+ /**
1209
+ * The document locale, specified in the ISO 639-1 format. This field represents the language or locale used for the documents issued by Lago
1210
+ * @example "fr"
1211
+ */
1212
+ document_locale?: string;
1213
+ /**
1214
+ * Specifies the available payment methods that can be used for this customer when `payment_provider` is set to `stripe`. The `provider_payment_methods` field is an array that allows multiple payment options to be defined. If this field is not explicitly set, all the payment methods are selected. For now, possible values are `card` and `sepa_debit`.
1215
+ * @example ["card","sepa_debit"]
1216
+ */
1217
+ provider_payment_methods?: string[] | null;
1218
+ }
1219
+ export interface CustomerChargeUsageObject {
1220
+ /**
1221
+ * The number of units consumed by the customer for a specific charge item.
1222
+ * @pattern ^[0-9]+.?[0-9]*$
1223
+ * @example "1.0"
1224
+ */
1225
+ units: string;
1226
+ /**
1227
+ * The quantity of usage events that have been recorded for a particular charge during the specified time period. These events may also be referred to as the number of transactions in some contexts.
1228
+ * @example 10
1229
+ */
1230
+ events_count: number;
1231
+ /**
1232
+ * The amount in cents, tax excluded, consumed by the customer for a specific charge item.
1233
+ * @example 123
1234
+ */
1235
+ amount_cents: number;
1236
+ /** The currency of a usage item consumed by the customer. */
1237
+ amount_currency: Currency;
1238
+ /** Object listing all the properties for a specific charge item. */
1239
+ charge: {
1240
+ /**
1241
+ * Unique identifier assigned to the charge within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the charge’s record within the Lago system.
1242
+ * @format uuid
1243
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1244
+ */
1245
+ lago_id: string;
1246
+ /**
1247
+ * The pricing model applied to this charge. Possible values are standard, `graduated`, `percentage`, `package` or `volume`.
1248
+ * @example "graduated"
1249
+ */
1250
+ charge_model: "standard" | "graduated" | "package" | "percentage" | "volume";
1251
+ };
1252
+ /** The related billable metric object. */
1253
+ billable_metric: {
1254
+ /**
1255
+ * Unique identifier assigned to the billable metric within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the billable metric’s record within the Lago system.
1256
+ * @format uuid
1257
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1258
+ */
1259
+ lago_id: string;
1260
+ /**
1261
+ * The name of the billable metric used for this charge.
1262
+ * @example "Storage"
1263
+ */
1264
+ name: string;
1265
+ /**
1266
+ * The code of the billable metric used for this charge.
1267
+ * @example "storage"
1268
+ */
1269
+ code: string;
1270
+ /**
1271
+ * The aggregation type of the billable metric used for this charge. Possible values are `count_agg`, `sum_agg`, `max_agg` or `unique_count_agg`.
1272
+ * @example "sum_agg"
1273
+ */
1274
+ aggregation_type: "count_agg" | "sum_agg" | "max_agg" | "unique_count_agg";
1275
+ };
1276
+ /** Array of group object, representing multiple dimensions for a charge item. */
1277
+ groups: {
1278
+ /**
1279
+ * Unique identifier assigned to the group within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the group record within the Lago system.
1280
+ * @format uuid
1281
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1282
+ */
1283
+ lago_id?: string;
1284
+ /**
1285
+ * The group key, only returned for groups with two dimensions.
1286
+ * @example null
1287
+ */
1288
+ key?: string | null;
1289
+ /**
1290
+ * The group value.
1291
+ * @example "europe"
1292
+ */
1293
+ value?: string;
1294
+ /**
1295
+ * The number of units consumed for a specific group related to a charge item.
1296
+ * @pattern ^[0-9]+.?[0-9]*$
1297
+ * @example "0.9"
1298
+ */
1299
+ units?: string;
1300
+ /**
1301
+ * The quantity of usage events that have been recorded for a particular charge during the specified time period. These events may also be referred to as the number of transactions in some contexts.
1302
+ * @example 10
1303
+ */
1304
+ events_count?: number;
1305
+ /**
1306
+ * The amount in cents, tax excluded, consumed for a specific group related to a charge item.
1307
+ * @example 1000
1308
+ */
1309
+ amount_cents?: number;
1310
+ }[];
1311
+ }
1312
+ export interface CustomerCreateInput {
1313
+ customer: {
1314
+ /**
1315
+ * The customer external unique identifier (provided by your own application)
1316
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
1317
+ */
1318
+ external_id: string;
1319
+ /**
1320
+ * The first line of the billing address
1321
+ * @example "5230 Penfield Ave"
1322
+ */
1323
+ address_line1?: string | null;
1324
+ /**
1325
+ * The second line of the billing address
1326
+ * @example ""
1327
+ */
1328
+ address_line2?: string | null;
1329
+ /**
1330
+ * The city of the customer's billing address
1331
+ * @example "Woodland Hills"
1332
+ */
1333
+ city?: string | null;
1334
+ /** Country code of the customer's billing address. Format must be ISO 3166 (alpha-2) */
1335
+ country?: Country;
1336
+ /** Currency of the customer. Format must be ISO 4217 */
1337
+ currency?: Currency;
1338
+ /**
1339
+ * The email of the customer
1340
+ * @format email
1341
+ * @example "dinesh@piedpiper.test"
1342
+ */
1343
+ email?: string | null;
1344
+ /**
1345
+ * The legal company name of the customer
1346
+ * @example "Coleman-Blair"
1347
+ */
1348
+ legal_name?: string | null;
1349
+ /**
1350
+ * The legal company number of the customer
1351
+ * @example "49-008-2965"
1352
+ */
1353
+ legal_number?: string | null;
1354
+ /**
1355
+ * The logo URL of the customer
1356
+ * @example "http://hooli.com/logo.png"
1357
+ */
1358
+ logo_url?: string | null;
1359
+ /**
1360
+ * The full name of the customer
1361
+ * @example "Gavin Belson"
1362
+ */
1363
+ name?: string | null;
1364
+ /**
1365
+ * The phone number of the customer
1366
+ * @example "1-171-883-3711 x245"
1367
+ */
1368
+ phone?: string | null;
1369
+ /**
1370
+ * The state of the customer's billing address
1371
+ * @example "CA"
1372
+ */
1373
+ state?: string | null;
1374
+ /**
1375
+ * List of unique code used to identify the taxes.
1376
+ * @example ["french_standard_vat"]
1377
+ */
1378
+ tax_codes?: string[];
1379
+ /**
1380
+ * The tax identification number of the customer
1381
+ * @example "EU123456789"
1382
+ */
1383
+ tax_identification_number?: string | null;
1384
+ /** The customer's timezone, used for billing purposes in their local time. Overrides the organization's timezone */
1385
+ timezone?: Timezone;
1386
+ /**
1387
+ * The custom website URL of the customer
1388
+ * @example "http://hooli.com"
1389
+ */
1390
+ url?: string | null;
1391
+ /**
1392
+ * The zipcode of the customer's billing address
1393
+ * @example "91364"
1394
+ */
1395
+ zipcode?: string | null;
1396
+ /**
1397
+ * The net payment term, expressed in days, specifies the duration within which a customer is expected to remit payment after the invoice is finalized.
1398
+ * @example 30
1399
+ */
1400
+ net_payment_term?: number | null;
1401
+ /** 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. */
1402
+ billing_configuration?: CustomerBillingConfiguration;
1403
+ /** 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 */
1404
+ metadata?: {
1405
+ /**
1406
+ * Identifier for the metadata object, only required when updating a key-value pair
1407
+ * @format uuid
1408
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1409
+ */
1410
+ id?: string;
1411
+ /**
1412
+ * The metadata object key
1413
+ * @example "Purchase Order"
1414
+ */
1415
+ key: string;
1416
+ /**
1417
+ * The metadata object value
1418
+ * @example "123456789"
1419
+ */
1420
+ value: string;
1421
+ /**
1422
+ * Determines whether the item or information should be displayed in the invoice. If set to true, the item or information will be included and visible in the generated invoice. If set to false, the item or information will be excluded and not displayed in the invoice.
1423
+ * @example true
1424
+ */
1425
+ display_in_invoice: boolean;
1426
+ }[];
1427
+ };
1428
+ }
1429
+ /** 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 */
1430
+ export interface CustomerMetadata {
1431
+ /**
1432
+ * A unique identifier for the customer metadata object in the Lago application. Can be used to update a key-value pair
1433
+ * @format uuid
1434
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1435
+ */
1436
+ lago_id: string;
1437
+ /**
1438
+ * The metadata object key
1439
+ * @example "Purchase Order"
1440
+ */
1441
+ key: string;
1442
+ /**
1443
+ * The metadata object value
1444
+ * @example "123456789"
1445
+ */
1446
+ value: string;
1447
+ /**
1448
+ * Determines whether the item or information should be displayed in the invoice. If set to true, the item or information will be included and visible in the generated invoice. If set to false, the item or information will be excluded and not displayed in the invoice.
1449
+ * @example true
1450
+ */
1451
+ display_in_invoice: boolean;
1452
+ /**
1453
+ * The date of the metadata object creation, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC). The creation_date provides a standardized and internationally recognized timestamp for when the metadata object was created
1454
+ * @format date-time
1455
+ * @example "2022-04-29T08:59:51Z"
1456
+ */
1457
+ created_at: string;
1458
+ }
1459
+ export interface CustomerObject {
1460
+ /**
1461
+ * 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
1462
+ * @format uuid
1463
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1464
+ */
1465
+ lago_id: string;
1466
+ /**
1467
+ * The unique identifier assigned to the customer within the organization's scope. This identifier is used to track and reference the customer's order of creation within the organization's system. It ensures that each customer has a distinct `sequential_id`` associated with them, allowing for easy identification and sorting based on the order of creation
1468
+ * @example 1
1469
+ */
1470
+ sequential_id: number;
1471
+ /**
1472
+ * A concise and unique identifier for the customer, formed by combining the Organization's `name`, `id`, and customer's `sequential_id`
1473
+ * @example "LAG-1234-001"
1474
+ */
1475
+ slug: string;
1476
+ /**
1477
+ * The customer external unique identifier (provided by your own application)
1478
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
1479
+ */
1480
+ external_id: string;
1481
+ /**
1482
+ * The first line of the billing address
1483
+ * @example "5230 Penfield Ave"
1484
+ */
1485
+ address_line1?: string | null;
1486
+ /**
1487
+ * The second line of the billing address
1488
+ * @example null
1489
+ */
1490
+ address_line2?: string | null;
1491
+ /** The customer's applicable timezone, used for billing purposes in their local time. */
1492
+ applicable_timezone: Timezone;
1493
+ /**
1494
+ * The city of the customer's billing address
1495
+ * @example "Woodland Hills"
1496
+ */
1497
+ city?: string | null;
1498
+ /** Country code of the customer's billing address. Format must be ISO 3166 (alpha-2) */
1499
+ country?: Country;
1500
+ /** Currency of the customer. Format must be ISO 4217 */
1501
+ currency?: Currency;
1502
+ /**
1503
+ * The email of the customer
1504
+ * @format email
1505
+ * @example "dinesh@piedpiper.test"
1506
+ */
1507
+ email?: string | null;
1508
+ /**
1509
+ * The legal company name of the customer
1510
+ * @example "Coleman-Blair"
1511
+ */
1512
+ legal_name?: string | null;
1513
+ /**
1514
+ * The legal company number of the customer
1515
+ * @example "49-008-2965"
1516
+ */
1517
+ legal_number?: string | null;
1518
+ /**
1519
+ * The logo URL of the customer
1520
+ * @example "http://hooli.com/logo.png"
1521
+ */
1522
+ logo_url?: string | null;
1523
+ /**
1524
+ * The full name of the customer
1525
+ * @example "Gavin Belson"
1526
+ */
1527
+ name?: string | null;
1528
+ /**
1529
+ * The phone number of the customer
1530
+ * @example "1-171-883-3711 x245"
1531
+ */
1532
+ phone?: string | null;
1533
+ /**
1534
+ * The state of the customer's billing address
1535
+ * @example "CA"
1536
+ */
1537
+ state?: string | null;
1538
+ /**
1539
+ * The tax identification number of the customer
1540
+ * @example "EU123456789"
1541
+ */
1542
+ tax_identification_number?: string | null;
1543
+ /** The customer's timezone, used for billing purposes in their local time. Overrides the organization's timezone */
1544
+ timezone?: Timezone;
1545
+ /**
1546
+ * The custom website URL of the customer
1547
+ * @example "http://hooli.com"
1548
+ */
1549
+ url?: string | null;
1550
+ /**
1551
+ * The zipcode of the customer's billing address
1552
+ * @example "91364"
1553
+ */
1554
+ zipcode?: string | null;
1555
+ /**
1556
+ * The net payment term, expressed in days, specifies the duration within which a customer is expected to remit payment after the invoice is finalized.
1557
+ * @example 30
1558
+ */
1559
+ net_payment_term?: number | null;
1560
+ /**
1561
+ * The date of the customer 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 customer object was created
1562
+ * @format date-time
1563
+ * @example "2022-04-29T08:59:51Z"
1564
+ */
1565
+ created_at: string;
1566
+ /**
1567
+ * The date of the customer 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 customer object was updated
1568
+ * @format date-time
1569
+ * @example "2022-04-29T08:59:51Z"
1570
+ */
1571
+ updated_at?: string;
1572
+ /** 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. */
1573
+ billing_configuration?: CustomerBillingConfiguration;
1574
+ metadata?: CustomerMetadata[];
1575
+ }
1576
+ export type CustomerObjectExtended = CustomerObject & {
1577
+ metadata?: CustomerMetadata[];
1578
+ /** List of customer taxes */
1579
+ taxes?: TaxObject[];
1580
+ };
1581
+ export interface CustomerPastUsage {
1582
+ usage_periods: CustomerUsage[];
1583
+ meta: PaginationMeta;
1584
+ }
1585
+ export interface CustomersPaginated {
1586
+ customers: CustomerObjectExtended[];
1587
+ meta: PaginationMeta;
1588
+ }
1589
+ export interface CustomerUsage {
1590
+ customer_usage: CustomerUsageObject;
1591
+ }
1592
+ export interface CustomerUsageObject {
1593
+ /**
1594
+ * The lower bound of the billing period, expressed in the ISO 8601 datetime format in Coordinated Universal Time (UTC).
1595
+ * @format date-time
1596
+ * @example "2022-07-01T00:00:00Z"
1597
+ */
1598
+ from_datetime: string;
1599
+ /**
1600
+ * The upper bound of the billing period, expressed in the ISO 8601 datetime format in Coordinated Universal Time (UTC).
1601
+ * @format date-time
1602
+ * @example "2022-07-31T23:59:59Z"
1603
+ */
1604
+ to_datetime: string;
1605
+ /**
1606
+ * The date of creation of the invoice.
1607
+ * @format date-time
1608
+ * @example "2022-08-01T23:59:59Z"
1609
+ */
1610
+ issuing_date: string;
1611
+ /**
1612
+ * A unique identifier associated with the invoice related to this particular usage record.
1613
+ * @format uuid
1614
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1615
+ */
1616
+ lago_invoice_id?: string | null;
1617
+ /** The currency of the customer’s current usage. */
1618
+ currency?: Currency;
1619
+ /**
1620
+ * The amount in cents, tax excluded.
1621
+ * @example 123
1622
+ */
1623
+ amount_cents: number;
1624
+ /**
1625
+ * The tax amount in cents.
1626
+ * @example 200
1627
+ */
1628
+ taxes_amount_cents: number;
1629
+ /**
1630
+ * The total amount in cents, tax included.
1631
+ * @example 123
1632
+ */
1633
+ total_amount_cents: number;
1634
+ /** Array of charges that comprise the current usage. It contains detailed information about individual charge items associated with the usage. */
1635
+ charges_usage: CustomerChargeUsageObject[];
1636
+ }
1637
+ export interface Event {
1638
+ event: EventObject;
1639
+ }
1640
+ export interface EventBatchInput {
1641
+ event: {
1642
+ /**
1643
+ * This field represents a unique identifier for the event. It is crucial for ensuring idempotency, meaning that each event can be uniquely identified and processed without causing any unintended side effects.
1644
+ * @example "transaction_1234567890"
1645
+ */
1646
+ transaction_id: string;
1647
+ /**
1648
+ * The customer external unique identifier (provided by your own application). This field is optional if you send the `external_subscription_ids`, targeting a specific subscription.
1649
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
1650
+ */
1651
+ external_customer_id?: string;
1652
+ /**
1653
+ * Array of unique identifiers of the targeted subscriptions within your application.
1654
+ * @example ["sub_1234567890","sub_0987654321"]
1655
+ */
1656
+ external_subscription_ids: string[];
1657
+ /**
1658
+ * The code that identifies a targeted billable metric. It is essential that this code matches the `code` property of one of your active billable metrics. If the provided code does not correspond to any active billable metric, it will be ignored during the process.
1659
+ * @example "storage"
1660
+ */
1661
+ code: string;
1662
+ /**
1663
+ * This field captures the Unix timestamp in seconds indicating the occurrence of the event in Coordinated Universal Time (UTC). If this timestamp is not provided, the API will automatically set it to the time of event reception.
1664
+ * @example 1651240791
1665
+ */
1666
+ timestamp?: number;
1667
+ /**
1668
+ * This field represents additional properties associated with the event, which are utilized in the calculation of the final fee. This object becomes mandatory when the targeted billable metric employs a `sum_agg`, `max_agg`, or `unique_count_agg` aggregation method. However, when using a simple `count_agg`, this object is not required.
1669
+ * @example {"gb":10}
1670
+ */
1671
+ properties?: {
1672
+ /** The `operation_type` field is only necessary when adding or removing a specific unit when the targeted billable metric adopts a `unique_count_agg` aggregation method. In other cases, the `operation_type` field is not required. The valid values for the `operation_type` field are `add` or `remove`, which indicate whether the unit is being added or removed from the unique count aggregation, respectively. */
1673
+ operation_type?: "add" | "remove";
1674
+ [key: string]: any;
1675
+ };
1676
+ };
1677
+ }
1678
+ export interface EventEstimateFeesInput {
1679
+ event: {
1680
+ /**
1681
+ * The code that identifies a targeted billable metric. It is essential that this code matches the `code` property of one of your active billable metrics. If the provided code does not correspond to any active billable metric, it will be ignored during the process.
1682
+ * @example "storage"
1683
+ */
1684
+ code: string;
1685
+ /**
1686
+ * The customer external unique identifier (provided by your own application). This field is optional if you send the `external_subscription_id`, targeting a specific subscription.
1687
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
1688
+ */
1689
+ external_customer_id?: string;
1690
+ /**
1691
+ * The unique identifier of the subscription within your application. It is a mandatory field when the customer possesses multiple subscriptions or when the `external_customer_id` is not provided.
1692
+ * @example "sub_1234567890"
1693
+ */
1694
+ external_subscription_id?: string;
1695
+ /** This field represents additional properties associated with the event, which are utilized in the calculation of the final fee. This object becomes mandatory when the targeted billable metric employs a `sum_agg`, `max_agg`, or `unique_count_agg` aggregation method. However, when using a simple `count_agg`, this object is not required. */
1696
+ properties?: object;
1697
+ };
1698
+ }
1699
+ export interface EventInput {
1700
+ event: {
1701
+ /**
1702
+ * This field represents a unique identifier for the event. It is crucial for ensuring idempotency, meaning that each event can be uniquely identified and processed without causing any unintended side effects.
1703
+ * @example "transaction_1234567890"
1704
+ */
1705
+ transaction_id: string;
1706
+ /**
1707
+ * The customer external unique identifier (provided by your own application). This field is optional if you send the `external_subscription_id`, targeting a specific subscription.
1708
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
1709
+ */
1710
+ external_customer_id?: string;
1711
+ /**
1712
+ * The unique identifier of the subscription within your application. It is a mandatory field when the customer possesses multiple subscriptions or when the `external_customer_id` is not provided.
1713
+ * @example "sub_1234567890"
1714
+ */
1715
+ external_subscription_id?: string;
1716
+ /**
1717
+ * The code that identifies a targeted billable metric. It is essential that this code matches the `code` property of one of your active billable metrics. If the provided code does not correspond to any active billable metric, it will be ignored during the process.
1718
+ * @example "storage"
1719
+ */
1720
+ code: string;
1721
+ /**
1722
+ * This field captures the Unix timestamp in seconds indicating the occurrence of the event in Coordinated Universal Time (UTC).
1723
+ * If this timestamp is not provided, the API will automatically set it to the time of event reception.
1724
+ * You can also provide miliseconds precision by appending decimals to the timestamp.
1725
+ * @example "1651240791.123"
1726
+ */
1727
+ timestamp?: number | string;
1728
+ /**
1729
+ * This field represents additional properties associated with the event, which are utilized in the calculation of the final fee. This object becomes mandatory when the targeted billable metric employs a `sum_agg`, `max_agg`, or `unique_count_agg` aggregation method. However, when using a simple `count_agg`, this object is not required.
1730
+ * @example {"gb":10}
1731
+ */
1732
+ properties?: Record<string, string>;
1733
+ };
1734
+ }
1735
+ export interface EventObject {
1736
+ /**
1737
+ * 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
1738
+ * @format uuid
1739
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1740
+ */
1741
+ lago_id: string;
1742
+ /**
1743
+ * This field represents a unique identifier for the event. It is crucial for ensuring idempotency, meaning that each event can be uniquely identified and processed without causing any unintended side effects.
1744
+ * @example "transaction_1234567890"
1745
+ */
1746
+ transaction_id: string;
1747
+ /**
1748
+ * 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
1749
+ * @format uuid
1750
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1751
+ */
1752
+ lago_customer_id: string;
1753
+ /**
1754
+ * The customer external unique identifier (provided by your own application). This field is optional if you send the `external_subscription_id`, targeting a specific subscription.
1755
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
1756
+ */
1757
+ external_customer_id: string;
1758
+ /**
1759
+ * The code that identifies a targeted billable metric. It is essential that this code matches the `code` property of one of your active billable metrics. If the provided code does not correspond to any active billable metric, it will be ignored during the process.
1760
+ * @example "storage"
1761
+ */
1762
+ code: string;
1763
+ /**
1764
+ * This field captures the Unix timestamp in seconds indicating the occurrence of the event in Coordinated Universal Time (UTC). If this timestamp is not provided, the API will automatically set it to the time of event reception.
1765
+ * @format date-time
1766
+ * @example "2022-04-29T08:59:51.123Z"
1767
+ */
1768
+ timestamp: string;
1769
+ /**
1770
+ * This field represents additional properties associated with the event, which are utilized in the calculation of the final fee. This object becomes mandatory when the targeted billable metric employs a `sum_agg`, `max_agg`, or `unique_count_agg` aggregation method. However, when using a simple `count_agg`, this object is not required.
1771
+ * @example {"gb":10}
1772
+ */
1773
+ properties?: {
1774
+ /** The `operation_type` field is only necessary when adding or removing a specific unit when the targeted billable metric adopts a `unique_count_agg` aggregation method. In other cases, the `operation_type` field is not required. The valid values for the `operation_type` field are `add` or `remove`, which indicate whether the unit is being added or removed from the unique count aggregation, respectively. */
1775
+ operation_type?: "add" | "remove";
1776
+ [key: string]: any;
1777
+ };
1778
+ /**
1779
+ * 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
1780
+ * @format uuid
1781
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1782
+ */
1783
+ lago_subscription_id: string;
1784
+ /**
1785
+ * The unique identifier of the subscription within your application. It is a mandatory field when the customer possesses multiple subscriptions or when the `external_customer_id` is not provided.
1786
+ * @example "sub_1234567890"
1787
+ */
1788
+ external_subscription_id: string;
1789
+ /**
1790
+ * The creation date of the event's record in the Lago application, presented in the ISO 8601 datetime format, specifically in Coordinated Universal Time (UTC). It provides the precise timestamp of when the event's record was created within the Lago application
1791
+ * @format date-time
1792
+ * @example "2022-04-29T08:59:51Z"
1793
+ */
1794
+ created_at: string;
1795
+ }
1796
+ export interface Fee {
1797
+ fee: FeeObject;
1798
+ }
1799
+ export type FeeAppliedTaxObject = BaseAppliedTax & {
1800
+ /**
1801
+ * Unique identifier of the fee, created by Lago.
1802
+ * @format uuid
1803
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1804
+ */
1805
+ lago_fee_id?: string;
1806
+ };
1807
+ export interface FeeObject {
1808
+ /**
1809
+ * 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.
1810
+ * @format uuid
1811
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1812
+ */
1813
+ lago_id?: string | null;
1814
+ /**
1815
+ * Unique identifier assigned to the group that the fee belongs to
1816
+ * @format uuid
1817
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1818
+ */
1819
+ lago_group_id?: string | null;
1820
+ /**
1821
+ * Unique identifier assigned to the invoice that the fee belongs to
1822
+ * @format uuid
1823
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1824
+ */
1825
+ lago_invoice_id?: string | null;
1826
+ /**
1827
+ * Unique identifier assigned to the true-up fee when a minimum has been set to the charge. This identifier helps to distinguish and manage the true-up fee associated with the charge, which may be applicable when a minimum threshold or limit is set for the charge amount.
1828
+ * @format uuid
1829
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1830
+ */
1831
+ lago_true_up_fee_id?: string | null;
1832
+ /**
1833
+ * Unique identifier assigned to the parent fee on which the true-up fee is assigned. This identifier establishes the relationship between the parent fee and the associated true-up fee.
1834
+ * @format uuid
1835
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1836
+ */
1837
+ lago_true_up_parent_fee_id?: string | null;
1838
+ /**
1839
+ * Unique identifier assigned to the subscription, created by Lago. This field is specifically displayed when the fee type is charge and the payment for the fee is made in advance (`pay_in_advance` is set to true).
1840
+ * @format uuid
1841
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1842
+ */
1843
+ lago_subscription_id?: string | null;
1844
+ /**
1845
+ * Unique identifier assigned to the customer, created by Lago. This field is specifically displayed when the fee type is charge and the payment for the fee is made in advance (`pay_in_advance` is set to true).
1846
+ * @format uuid
1847
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1848
+ */
1849
+ lago_customer_id?: string | null;
1850
+ /**
1851
+ * Unique identifier assigned to the customer in your application. This field is specifically displayed when the fee type is charge and the payment for the fee is made in advance (`pay_in_advance` is set to true).
1852
+ * @example "external_id"
1853
+ */
1854
+ external_customer_id?: string | null;
1855
+ /**
1856
+ * Unique identifier assigned to the subscription in your application. This field is specifically displayed when the fee type is charge and the payment for the fee is made in advance (`pay_in_advance` is set to true).
1857
+ * @example "external_id"
1858
+ */
1859
+ external_subscription_id?: string | null;
1860
+ /**
1861
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
1862
+ * @example "Setup Fee (SF1)"
1863
+ */
1864
+ invoice_display_name?: string;
1865
+ /**
1866
+ * The cost of this specific fee, excluding any applicable taxes.
1867
+ * @example 100
1868
+ */
1869
+ amount_cents: number;
1870
+ /** The currency of this specific fee. It indicates the monetary unit in which the fee’s cost is expressed. */
1871
+ amount_currency: Currency;
1872
+ /**
1873
+ * The cost of the tax associated with this specific fee.
1874
+ * @example 20
1875
+ */
1876
+ taxes_amount_cents: number;
1877
+ /**
1878
+ * The tax rate associated with this specific fee.
1879
+ * @example 20
1880
+ */
1881
+ taxes_rate: number;
1882
+ /**
1883
+ * The number of units used to charge the customer. This field indicates the quantity or count of units consumed or utilized in the context of the charge. It helps in determining the basis for calculating the fee or cost associated with the usage of the service or product provided to the customer.
1884
+ * @example "0.32"
1885
+ */
1886
+ units: string;
1887
+ /**
1888
+ * The cost of this specific fee, including any applicable taxes.
1889
+ * @example 120
1890
+ */
1891
+ total_amount_cents: number;
1892
+ /** The currency of this specific fee, including any applicable taxes. */
1893
+ total_amount_currency: Currency;
1894
+ /**
1895
+ * The number of events that have been sent and used to charge the customer. This field indicates the count or quantity of events that have been processed and considered in the charging process.
1896
+ * @example 23
1897
+ */
1898
+ events_count?: number;
1899
+ /**
1900
+ * Flag that indicates whether the fee was paid in advance. It serves as a boolean value, where `true` represents that the fee was paid in advance (straightaway), and `false` indicates that the fee was not paid in arrears (at the end of the period).
1901
+ * @example true
1902
+ */
1903
+ pay_in_advance: boolean;
1904
+ /**
1905
+ * Flag that indicates whether the fee was included on the invoice. It serves as a boolean value, where `true` represents that the fee was included on the invoice, and `false` indicates that the fee was not included on the invoice.
1906
+ * @example true
1907
+ */
1908
+ invoiceable: boolean;
1909
+ /**
1910
+ * The beginning date of the period that the fee covers. It is applicable only to `subscription` and `charge` fees. This field indicates the start date of the billing period or subscription period associated with the fee.
1911
+ * @format date-time
1912
+ * @example "2022-04-29T08:59:51Z"
1913
+ */
1914
+ from_date?: string | null;
1915
+ /**
1916
+ * The ending date of the period that the fee covers. It is applicable only to `subscription` and `charge` fees. This field indicates the end date of the billing period or subscription period associated with the fee.
1917
+ * @format date-time
1918
+ * @example "2022-05-29T08:59:51Z"
1919
+ */
1920
+ to_date?: string | null;
1921
+ /**
1922
+ * Indicates the payment status of the fee. It represents the current status of the payment associated with the fee. The possible values for this field are `pending`, `succeeded`, `failed` and `refunded`.
1923
+ * @example "pending"
1924
+ */
1925
+ payment_status: "pending" | "succeeded" | "failed" | "refunded";
1926
+ /**
1927
+ * The date and time when the fee was created. It is provided in Coordinated Universal Time (UTC) format.
1928
+ * @format date-time
1929
+ * @example "2022-08-24T14:58:59Z"
1930
+ */
1931
+ created_at?: string | null;
1932
+ /**
1933
+ * The date and time when the payment for the fee was successfully processed. It is provided in Coordinated Universal Time (UTC) format.
1934
+ * @format date-time
1935
+ * @example "2022-08-24T14:58:59Z"
1936
+ */
1937
+ succeeded_at?: string | null;
1938
+ /**
1939
+ * The date and time when the payment for the fee failed to process. It is provided in Coordinated Universal Time (UTC) format.
1940
+ * @format date-time
1941
+ * @example "2022-08-24T14:58:59Z"
1942
+ */
1943
+ failed_at?: string | null;
1944
+ /**
1945
+ * The date and time when the payment for the fee was refunded. It is provided in Coordinated Universal Time (UTC) format
1946
+ * @format date-time
1947
+ * @example "2022-08-24T14:58:59Z"
1948
+ */
1949
+ refunded_at?: string | null;
1950
+ /**
1951
+ * Unique identifier assigned to the transaction. This field is specifically displayed when the fee type is `charge` and the payment for the fee is made in advance (`pay_in_advance` is set to `true`).
1952
+ * @example "transaction_1234567890"
1953
+ */
1954
+ event_transaction_id?: string | null;
1955
+ /** Item attached to the fee */
1956
+ item: {
1957
+ /**
1958
+ * The fee type. Possible values are `add-on`, `charge`, `credit` or `subscription`.
1959
+ * @example "subscription"
1960
+ */
1961
+ type: "charge" | "add_on" | "subscription" | "credit";
1962
+ /**
1963
+ * The code of the fee item. It can be the code of the `add-o`n, the code of the `charge`, the code of the `credit` or the code of the `subscription`.
1964
+ * @example "startup"
1965
+ */
1966
+ code: string;
1967
+ /**
1968
+ * The name of the fee item. It can be the name of the `add-on`, the name of the `charge`, the name of the `credit` or the name of the `subscription`.
1969
+ * @example "Startup"
1970
+ */
1971
+ name: string;
1972
+ /**
1973
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
1974
+ * @example "Setup Fee (SF1)"
1975
+ */
1976
+ invoice_display_name?: string;
1977
+ /**
1978
+ * Unique identifier of the fee item, created by Lago. It can be the identifier of the `add-on`, the identifier of the `charge`, the identifier of the `credit` or the identifier of the `subscription`.
1979
+ * @format uuid
1980
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
1981
+ */
1982
+ lago_item_id: string;
1983
+ /**
1984
+ * The type of the fee item. Possible values are `AddOn`, `BillableMetric`, `WalletTransaction` or `Subscription`.
1985
+ * @example "Subscription"
1986
+ */
1987
+ item_type: "AddOn" | "BillableMetric" | "Subscription" | "WalletTransaction";
1988
+ };
1989
+ /** List of fee applied taxes */
1990
+ applied_taxes?: FeeAppliedTaxObject[];
1991
+ }
1992
+ export interface Fees {
1993
+ fees: FeeObject[];
1994
+ }
1995
+ export type FeesPaginated = Fees & {
1996
+ meta: PaginationMeta;
1997
+ };
1998
+ export interface FeeUpdateInput {
1999
+ fee: {
2000
+ /**
2001
+ * The payment status of the fee. Possible values are `pending`, `succeeded`, `failed` or `refunded`.
2002
+ * @example "succeeded"
2003
+ */
2004
+ payment_status: "pending" | "succeeded" | "failed" | "refunded";
2005
+ };
2006
+ }
2007
+ export interface GroupObject {
2008
+ /**
2009
+ * Unique identifier of a specific group associated with the billable metric.
2010
+ * @format uuid
2011
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2012
+ */
2013
+ lago_id: string;
2014
+ /**
2015
+ * Key of a specific group associated with the billable metric.
2016
+ * @example "region"
2017
+ */
2018
+ key: string;
2019
+ /**
2020
+ * One of the values for a specific group associated with the billable metric.
2021
+ * @example "us-east-1"
2022
+ */
2023
+ value: string;
2024
+ }
2025
+ export interface GroupPropertiesObject {
2026
+ /**
2027
+ * Unique identifier of a billable metric group, created by Lago.
2028
+ * @format uuid
2029
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2030
+ */
2031
+ group_id: string;
2032
+ /**
2033
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual group will be used as the default display name.
2034
+ * @example "AWS"
2035
+ */
2036
+ invoice_display_name?: string;
2037
+ /** List of all thresholds utilized for calculating a charge, scoped by groups used as dimensions for a single charge. */
2038
+ values: ChargeProperties;
2039
+ }
2040
+ export interface GroupsPaginated {
2041
+ groups: GroupObject[];
2042
+ meta: PaginationMeta;
2043
+ }
2044
+ export interface Invoice {
2045
+ invoice: InvoiceObjectExtended;
2046
+ }
2047
+ export type InvoiceAppliedTaxObject = BaseAppliedTax & {
2048
+ /**
2049
+ * Unique identifier of the invoice, created by Lago.
2050
+ * @format uuid
2051
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2052
+ */
2053
+ lago_invoice_id?: string;
2054
+ /**
2055
+ * Fees total amount on which the tax is applied
2056
+ * @example 20000
2057
+ */
2058
+ fees_amount_cents?: number;
2059
+ };
2060
+ export interface InvoiceMetadataObject {
2061
+ /**
2062
+ * Unique identifier assigned to the invoice metadata within the Lago application.
2063
+ * @format uuid
2064
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2065
+ */
2066
+ lago_id?: string;
2067
+ /**
2068
+ * Represents the key of the metadata’s key-value pair.
2069
+ * @example "digital_ref_id"
2070
+ */
2071
+ key?: string;
2072
+ /**
2073
+ * Represents the value of the metadata’s key-value pair.
2074
+ * @example "INV-0123456-98765"
2075
+ */
2076
+ value?: string;
2077
+ /**
2078
+ * The date and time when the metadata object was created. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
2079
+ * @format date-time
2080
+ * @example "2022-04-29T08:59:51Z"
2081
+ */
2082
+ created_at?: string;
2083
+ }
2084
+ export interface InvoiceObject {
2085
+ /**
2086
+ * 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.
2087
+ * @format uuid
2088
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2089
+ */
2090
+ lago_id: string;
2091
+ /**
2092
+ * This ID helps in uniquely identifying and organizing the invoices associated with a specific customer. It provides a sequential numbering system specific to the customer, allowing for easy tracking and management of invoices within the customer's context.
2093
+ * @example 2
2094
+ */
2095
+ sequential_id: number;
2096
+ /**
2097
+ * The unique number assigned to the invoice. This number serves as a distinct identifier for the invoice and helps in differentiating it from other invoices in the system.
2098
+ * @example "LAG-1234-001-002"
2099
+ */
2100
+ number: string;
2101
+ /**
2102
+ * The date when the invoice was issued. It is provided in the ISO 8601 date format.
2103
+ * @format date
2104
+ * @example "2022-04-30"
2105
+ */
2106
+ issuing_date: string;
2107
+ /**
2108
+ * The payment due date for the invoice, specified in the ISO 8601 date format.
2109
+ * @format date
2110
+ * @example "2022-04-30"
2111
+ */
2112
+ payment_due_date?: string;
2113
+ /**
2114
+ * The net payment term, expressed in days, specifies the duration within which a customer is expected to remit payment after the invoice is finalized.
2115
+ * @example 30
2116
+ */
2117
+ net_payment_term?: number;
2118
+ /**
2119
+ * The type of invoice issued. Possible values are `subscription`, `one-off` or `credit`.
2120
+ * @example "subscription"
2121
+ */
2122
+ invoice_type: "subscription" | "add_on" | "credit" | "one_off";
2123
+ /**
2124
+ * The status of the invoice. It indicates the current state of the invoice and can have two possible values:
2125
+ * - `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.
2126
+ * - `finalized`: the invoice has been issued and finalized. In this state, events cannot be ingested or added to the invoice anymore.
2127
+ * @example "finalized"
2128
+ */
2129
+ status: "draft" | "finalized";
2130
+ /**
2131
+ * The status of the payment associated with the invoice. It can have one of the following values:
2132
+ * - `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.
2133
+ * - `succeeded`: the payment of the invoice has been successfully processed.
2134
+ * - `failed`: the payment of the invoice has failed or encountered an error during processing.
2135
+ * @example "succeeded"
2136
+ */
2137
+ payment_status: "pending" | "succeeded" | "failed";
2138
+ /** The currency of the invoice issued. */
2139
+ currency: Currency;
2140
+ /**
2141
+ * The total sum of fees amount in cents. It calculates the cumulative amount of all the fees associated with the invoice, providing a consolidated value.
2142
+ * @example 100
2143
+ */
2144
+ fees_amount_cents: number;
2145
+ /**
2146
+ * The total sum of all coupons discounted on the invoice. It calculates the cumulative discount amount applied by coupons, expressed in cents.
2147
+ * @example 10
2148
+ */
2149
+ coupons_amount_cents: number;
2150
+ /**
2151
+ * The total sum of all credit notes discounted on the invoice. It calculates the cumulative discount amount applied by credit notes, expressed in cents.
2152
+ * @example 10
2153
+ */
2154
+ credit_notes_amount_cents: number;
2155
+ /**
2156
+ * Subtotal amount, excluding taxes, expressed in cents.
2157
+ * This field depends on the version number. Here are the definitions based on the version:
2158
+ * - Version 1: is equal to the sum of `fees_amount_cents`, minus `coupons_amount_cents`, and minus `prepaid_credit_amount_cents`.
2159
+ * - Version 2: is equal to the `fees_amount_cents`.
2160
+ * - Version 3: is equal to the `fees_amount_cents`, minus `coupons_amount_cents`
2161
+ * @example 100
2162
+ */
2163
+ sub_total_excluding_taxes_amount_cents: number;
2164
+ /**
2165
+ * The sum of tax amount associated with the invoice, expressed in cents.
2166
+ * @example 20
2167
+ */
2168
+ taxes_amount_cents: number;
2169
+ /**
2170
+ * Subtotal amount, including taxes, expressed in cents.
2171
+ * This field depends on the version number. Here are the definitions based on the version:
2172
+ * - Version 1: is equal to the `total_amount_cents`.
2173
+ * - Version 2: is equal to the sum of `fees_amount_cents` and `taxes_amount_cents`.
2174
+ * - Version 3: is equal to the sum `sub_total_excluding_taxes_amount_cents` and `taxes_amount_cents`
2175
+ * @example 120
2176
+ */
2177
+ sub_total_including_taxes_amount_cents: number;
2178
+ /**
2179
+ * The total sum of all prepaid credits discounted on the invoice. It calculates the cumulative discount amount applied by prepaid credits, expressed in cents.
2180
+ * @example 0
2181
+ */
2182
+ prepaid_credit_amount_cents: number;
2183
+ /**
2184
+ * The sum of the amount and taxes amount on the invoice, expressed in cents. It calculates the total financial value of the invoice, including both the original amount and any applicable taxes.
2185
+ * @example 100
2186
+ */
2187
+ total_amount_cents: number;
2188
+ /** @example 3 */
2189
+ version_number: number;
2190
+ /**
2191
+ * 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
2192
+ * @format uri
2193
+ * @example "https://getlago.com/invoice/file"
2194
+ */
2195
+ file_url?: string;
2196
+ /** The customer on which the invoice applies. It refers to the customer account or entity associated with the invoice. */
2197
+ customer?: CustomerObject;
2198
+ metadata?: InvoiceMetadataObject[];
2199
+ applied_taxes?: InvoiceAppliedTaxObject[];
2200
+ }
2201
+ export type InvoiceObjectExtended = InvoiceObject & {
2202
+ credits?: CreditObject[];
2203
+ fees?: FeeObject[];
2204
+ subscriptions?: SubscriptionObject[];
2205
+ };
2206
+ export interface InvoiceOneOffCreateInput {
2207
+ invoice: {
2208
+ /**
2209
+ * Unique identifier assigned to the customer in your application.
2210
+ * @example "hooli_1234"
2211
+ */
2212
+ external_customer_id: string;
2213
+ /** The currency of the invoice. */
2214
+ currency?: Currency;
2215
+ fees: {
2216
+ /**
2217
+ * The code of the add-on used as invoice item.
2218
+ * @example "setup_fee"
2219
+ */
2220
+ add_on_code: string;
2221
+ /**
2222
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
2223
+ * @example "Setup Fee (SF1)"
2224
+ */
2225
+ invoice_display_name?: string;
2226
+ /**
2227
+ * The amount of the fee per unit, expressed in cents. By default, the amount of the add-on is used.
2228
+ * @example 12000
2229
+ */
2230
+ unit_amount_cents?: number | null;
2231
+ /**
2232
+ * The quantity of units associated with the fee. By default, only 1 unit is added to the invoice.
2233
+ * @pattern ^[0-9]+.?[0-9]*$
2234
+ * @example "2.5"
2235
+ */
2236
+ units?: string | null;
2237
+ /**
2238
+ * This is a description
2239
+ * @example "The description of the fee line item in the invoice. By default, the description of the add-on is used."
2240
+ */
2241
+ description?: string | null;
2242
+ /**
2243
+ * List of unique code used to identify the taxes.
2244
+ * @example ["french_standard_vat"]
2245
+ */
2246
+ tax_codes?: string[];
2247
+ }[];
2248
+ };
2249
+ }
2250
+ export interface InvoicesPaginated {
2251
+ invoices: InvoiceObject[];
2252
+ meta: PaginationMeta;
2253
+ }
2254
+ export interface InvoiceUpdateInput {
2255
+ invoice: {
2256
+ /**
2257
+ * The payment status of the invoice. Possible values are `pending`, `failed` or `succeeded`.
2258
+ * @example "succeeded"
2259
+ */
2260
+ payment_status?: "pending" | "succeeded" | "failed";
2261
+ metadata?: {
2262
+ /**
2263
+ * The metadata object identifier. Only required when updating existing metadata.
2264
+ * @format uuid
2265
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2266
+ */
2267
+ id?: string;
2268
+ /**
2269
+ * The key in the key-value pair of the metadata.
2270
+ * @example "digital_ref_id"
2271
+ */
2272
+ key?: string;
2273
+ /**
2274
+ * The value in the key-value pair of the metadata.
2275
+ * @example "INV-0123456-98765"
2276
+ */
2277
+ value?: string;
2278
+ }[];
2279
+ };
2280
+ }
2281
+ export interface Organization {
2282
+ organization: OrganizationObject;
2283
+ }
2284
+ /** The custom billing settings for your organization. */
2285
+ export interface OrganizationBillingConfiguration {
2286
+ /**
2287
+ * The customer invoice message that appears at the bottom of each billing documents.
2288
+ * @example "This is my customer footer"
2289
+ */
2290
+ invoice_footer?: string | null;
2291
+ /**
2292
+ * The grace period, expressed in days, for finalizing the invoice. This period refers to the additional time granted to your customers beyond the invoice due date to adjust usage and line items. Can be overwritten by the customer’s grace period.
2293
+ * @example 3
2294
+ */
2295
+ invoice_grace_period?: number;
2296
+ /**
2297
+ * The locale of the billing documents, expressed in the ISO 639-1 format. This field indicates the language or regional variant used for the documents content issued or the embeddable customer portal.
2298
+ * @example "en"
2299
+ */
2300
+ document_locale?: string;
2301
+ }
2302
+ export interface OrganizationObject {
2303
+ /**
2304
+ * Unique identifier assigned to the organization within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the organization's record within the Lago system
2305
+ * @format uuid
2306
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2307
+ */
2308
+ lago_id: string;
2309
+ /**
2310
+ * The name of your organization.
2311
+ * @example "Name1"
2312
+ */
2313
+ name: string;
2314
+ /**
2315
+ * The date of creation of your organization, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
2316
+ * @format date-time
2317
+ * @example "2022-05-02T13:04:09Z"
2318
+ */
2319
+ created_at: string | null;
2320
+ /**
2321
+ * The URL of your newest updated webhook endpoint. This URL allows your organization to receive important messages, notifications, or data from the Lago system. By configuring your webhook endpoint to this URL, you can ensure that your organization stays informed and receives relevant information in a timely manner.
2322
+ * @example "https://webhook.brex.com"
2323
+ */
2324
+ webhook_url?: string | null;
2325
+ /**
2326
+ * The array containing your webhooks URLs.
2327
+ * @example ["https://webhook.brex.com","https://webhook2.brex.com"]
2328
+ */
2329
+ webhook_urls?: string[] | null;
2330
+ /** The country of your organization. */
2331
+ country?: Country;
2332
+ /**
2333
+ * The first line of your organization’s billing address.
2334
+ * @example "100 Brex Street"
2335
+ */
2336
+ address_line1?: string | null;
2337
+ /**
2338
+ * The second line of your organization’s billing address.
2339
+ * @example null
2340
+ */
2341
+ address_line2?: string | null;
2342
+ /**
2343
+ * The state of your organization’s billing address.
2344
+ * @example "NYC"
2345
+ */
2346
+ state?: string | null;
2347
+ /**
2348
+ * The zipcode of your organization’s billing address.
2349
+ * @example "10000"
2350
+ */
2351
+ zipcode?: string | null;
2352
+ /**
2353
+ * The email address of your organization used to bill your customers.
2354
+ * @format email
2355
+ * @example "brex@brex.com"
2356
+ */
2357
+ email?: string | null;
2358
+ /**
2359
+ * The city of your organization’s billing address.
2360
+ * @example "New York"
2361
+ */
2362
+ city?: string | null;
2363
+ /**
2364
+ * The legal name of your organization.
2365
+ * @example null
2366
+ */
2367
+ legal_name?: string | null;
2368
+ /**
2369
+ * The legal number of your organization.
2370
+ * @example null
2371
+ */
2372
+ legal_number?: string | null;
2373
+ /**
2374
+ * The net payment term, expressed in days, specifies the duration within which a customer is expected to remit payment after the invoice is finalized.
2375
+ * @example 30
2376
+ */
2377
+ net_payment_term?: number;
2378
+ /**
2379
+ * The tax identification number of your organization.
2380
+ * @example "US123456789"
2381
+ */
2382
+ tax_identification_number?: string | null;
2383
+ /** Your organization’s timezone, used for billing purposes in your own local time. Can be overwritten by the customer’s timezone. */
2384
+ timezone?: Timezone;
2385
+ /** The custom billing settings for your organization. */
2386
+ billing_configuration: OrganizationBillingConfiguration;
2387
+ /** List of default organization taxes */
2388
+ taxes?: TaxObject[];
2389
+ }
2390
+ export interface OrganizationUpdateInput {
2391
+ organization: {
2392
+ /**
2393
+ * The URL of your newest updated webhook endpoint. This URL allows your organization to receive important messages, notifications, or data from the Lago system. By configuring your webhook endpoint to this URL, you can ensure that your organization stays informed and receives relevant information in a timely manner.
2394
+ * @example "https://webhook.brex.com"
2395
+ */
2396
+ webhook_url?: string | null;
2397
+ /** The country of your organization. */
2398
+ country?: Country;
2399
+ /**
2400
+ * The first line of your organization’s billing address.
2401
+ * @example "100 Brex Street"
2402
+ */
2403
+ address_line1?: string | null;
2404
+ /**
2405
+ * The second line of your organization’s billing address.
2406
+ * @example null
2407
+ */
2408
+ address_line2?: string | null;
2409
+ /**
2410
+ * The state of your organization’s billing address.
2411
+ * @example "NYC"
2412
+ */
2413
+ state?: string | null;
2414
+ /**
2415
+ * The zipcode of your organization’s billing address.
2416
+ * @example "10000"
2417
+ */
2418
+ zipcode?: string | null;
2419
+ /**
2420
+ * The email address of your organization used to bill your customers.
2421
+ * @format email
2422
+ * @example "brex@brex.com"
2423
+ */
2424
+ email?: string | null;
2425
+ /**
2426
+ * The city of your organization’s billing address.
2427
+ * @example "New York"
2428
+ */
2429
+ city?: string | null;
2430
+ /**
2431
+ * The legal name of your organization.
2432
+ * @example null
2433
+ */
2434
+ legal_name?: string | null;
2435
+ /**
2436
+ * The legal number of your organization.
2437
+ * @example null
2438
+ */
2439
+ legal_number?: string | null;
2440
+ /**
2441
+ * The net payment term, expressed in days, specifies the duration within which a customer is expected to remit payment after the invoice is finalized.
2442
+ * @example 30
2443
+ */
2444
+ net_payment_term?: number;
2445
+ /**
2446
+ * The tax identification number of your organization.
2447
+ * @example "US123456789"
2448
+ */
2449
+ tax_identification_number?: string | null;
2450
+ /** Your organization’s timezone, used for billing purposes in your own local time. Can be overwritten by the customer’s timezone. */
2451
+ timezone?: Timezone;
2452
+ /**
2453
+ * Represents the email settings of the organization. It allows you to define which documents are sent by email. The field value determines the types of documents that trigger email notifications. Possible values for are `invoice.finalized` and `credit_note.created`. By configuring this field, you can specify whether invoices, credit notes, or both should be sent to recipients via email.
2454
+ * @example ["invoice.finalized","credit_note.created"]
2455
+ */
2456
+ email_settings?: ("invoice.finalized" | "credit_note.created")[];
2457
+ /** The custom billing settings for your organization. */
2458
+ billing_configuration?: OrganizationBillingConfiguration;
2459
+ };
2460
+ }
2461
+ export interface PaginationMeta {
2462
+ /**
2463
+ * Current page.
2464
+ * @example 2
2465
+ */
2466
+ current_page: number;
2467
+ /**
2468
+ * Next page.
2469
+ * @example 3
2470
+ */
2471
+ next_page?: number | null;
2472
+ /**
2473
+ * Previous page.
2474
+ * @example 1
2475
+ */
2476
+ prev_page?: number | null;
2477
+ /**
2478
+ * Total number of pages.
2479
+ * @example 4
2480
+ */
2481
+ total_pages: number;
2482
+ /**
2483
+ * Total number of records.
2484
+ * @example 70
2485
+ */
2486
+ total_count: number;
2487
+ }
2488
+ export interface Plan {
2489
+ plan: PlanObject;
2490
+ }
2491
+ export interface PlanCreateInput {
2492
+ plan: {
2493
+ /**
2494
+ * The name of the plan.
2495
+ * @example "Startup"
2496
+ */
2497
+ name?: string;
2498
+ /**
2499
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the plan will be used as the default display name.
2500
+ * @example "Startup plan"
2501
+ */
2502
+ invoice_display_name?: string;
2503
+ /**
2504
+ * The code of the plan. It serves as a unique identifier associated with a particular plan. The code is typically used for internal or system-level identification purposes, like assigning a subscription, for instance.
2505
+ * @example "startup"
2506
+ */
2507
+ code?: string;
2508
+ /**
2509
+ * The interval used for recurring billing. It represents the frequency at which subscription billing occurs. The interval can be one of the following values: `yearly`, `quarterly`, `monthly`, or `weekly`.
2510
+ * @example "monthly"
2511
+ */
2512
+ interval?: "weekly" | "monthly" | "quarterly" | "yearly";
2513
+ /**
2514
+ * The description on the plan.
2515
+ * @example "Plan for early stage startups."
2516
+ */
2517
+ description?: string;
2518
+ /**
2519
+ * The base cost of the plan, excluding any applicable taxes, that is billed on a recurring basis. This value is defined at 0 if your plan is a pay-as-you-go plan.
2520
+ * @example 10000
2521
+ */
2522
+ amount_cents?: number;
2523
+ /** The currency of the plan. It indicates the monetary unit in which the plan's cost, including taxes and usage-based charges, is expressed. */
2524
+ amount_currency?: Currency;
2525
+ /**
2526
+ * The duration in days during which the base cost of the plan is offered for free.
2527
+ * @example 5
2528
+ */
2529
+ trial_period?: number;
2530
+ /**
2531
+ * This field determines the billing timing for the plan. When set to `true`, the base cost of the plan is due at the beginning of each billing period. Conversely, when set to `false`, the base cost of the plan is due at the end of each billing period.
2532
+ * @example true
2533
+ */
2534
+ pay_in_advance?: boolean;
2535
+ /**
2536
+ * This field, when set to `true`, enables to invoice usage-based charges on monthly basis, even if the cadence of the plan is yearly. This allows customers to pay charges overage on a monthly basis. This can be set to true only if the plan’s interval is `yearly`.
2537
+ * @example null
2538
+ */
2539
+ bill_charges_monthly?: boolean | null;
2540
+ /**
2541
+ * List of unique code used to identify the taxes.
2542
+ * @example ["french_standard_vat"]
2543
+ */
2544
+ tax_codes?: string[];
2545
+ /**
2546
+ * Additional usage-based charges for this plan.
2547
+ * @example [{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","charge_model":"package","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"group_properties":[],"tax_codes":["french_standard_vat"]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","charge_model":"graduated","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"to_value":10,"from_value":0,"flat_amount":"10","per_unit_amount":"0.5"},{"to_value":null,"from_value":11,"flat_amount":"0","per_unit_amount":"0.4"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","charge_model":"standard","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{},"group_properties":[{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a01","invoice_display_name":"Europe","values":{"amount":"10"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a02","invoice_display_name":"USA","values":{"amount":"5"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a03","invoice_display_name":"Africa","values":{"amount":"8"}}]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","charge_model":"volume","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","charge_model":"percentage","invoiceable":false,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"},"group_properties":[]}]
2548
+ */
2549
+ charges?: {
2550
+ /**
2551
+ * Unique identifier of the billable metric created by Lago.
2552
+ * @format uuid
2553
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2554
+ */
2555
+ billable_metric_id?: string;
2556
+ /**
2557
+ * Specifies the pricing model used for the calculation of the final fee. It can be `standard`, `graduated`, `graduated_percentage` `package`, `percentage` or `volume`.
2558
+ * @example "standard"
2559
+ */
2560
+ charge_model?: "standard" | "graduated" | "graduated_percentage" | "package" | "percentage" | "volume";
2561
+ /**
2562
+ * This field determines the billing timing for this specific usage-based charge. When set to `true`, the charge is due and invoiced immediately. Conversely, when set to false, the charge is due and invoiced at the end of each billing period.
2563
+ * @example false
2564
+ */
2565
+ pay_in_advance?: boolean;
2566
+ /**
2567
+ * This field specifies whether the charge should be included in a proper invoice. If set to false, no invoice will be issued for this charge. You can only set it to `false` when `pay_in_advance` is `true`.
2568
+ * @example true
2569
+ */
2570
+ invoiceable?: boolean;
2571
+ /**
2572
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
2573
+ * @example "Setup"
2574
+ */
2575
+ invoice_display_name?: string;
2576
+ /**
2577
+ * Specifies whether a charge is prorated based on the remaining number of days in the billing period or billed fully.
2578
+ *
2579
+ * - If set to `true`, the charge is prorated based on the remaining days in the current billing period.
2580
+ * - If set to `false`, the charge is billed in full.
2581
+ * - If not defined in the request, default value is `false`.
2582
+ * @example false
2583
+ */
2584
+ prorated?: boolean;
2585
+ /**
2586
+ * The minimum spending amount required for the charge, measured in cents and excluding any applicable taxes. It indicates the minimum amount that needs to be charged for each billing period.
2587
+ * @example 0
2588
+ */
2589
+ min_amount_cents?: number;
2590
+ /** List of all thresholds utilized for calculating the charge. */
2591
+ properties?: ChargeProperties;
2592
+ /** All charge information, sorted by groups. */
2593
+ group_properties?: {
2594
+ /**
2595
+ * Unique identifier of a billable metric group, created by Lago.
2596
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2597
+ */
2598
+ group_id: string;
2599
+ /** List of all thresholds utilized for calculating a charge, scoped by groups used as dimensions for a single charge. */
2600
+ values: ChargeProperties;
2601
+ }[];
2602
+ /**
2603
+ * List of unique code used to identify the taxes.
2604
+ * @example ["french_standard_vat"]
2605
+ */
2606
+ tax_codes?: string[];
2607
+ }[];
2608
+ };
2609
+ }
2610
+ export interface PlanUpdateInput {
2611
+ plan: {
2612
+ /**
2613
+ * The name of the plan.
2614
+ * @example "Startup"
2615
+ */
2616
+ name?: string;
2617
+ /**
2618
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the plan will be used as the default display name.
2619
+ * @example "Startup plan"
2620
+ */
2621
+ invoice_display_name?: string;
2622
+ /**
2623
+ * The code of the plan. It serves as a unique identifier associated with a particular plan. The code is typically used for internal or system-level identification purposes, like assigning a subscription, for instance.
2624
+ * @example "startup"
2625
+ */
2626
+ code?: string;
2627
+ /**
2628
+ * The interval used for recurring billing. It represents the frequency at which subscription billing occurs. The interval can be one of the following values: `yearly`, `quarterly`, `monthly`, or `weekly`.
2629
+ * @example "monthly"
2630
+ */
2631
+ interval?: "weekly" | "monthly" | "quarterly" | "yearly";
2632
+ /**
2633
+ * The description on the plan.
2634
+ * @example "Plan for early stage startups."
2635
+ */
2636
+ description?: string;
2637
+ /**
2638
+ * The base cost of the plan, excluding any applicable taxes, that is billed on a recurring basis. This value is defined at 0 if your plan is a pay-as-you-go plan.
2639
+ * @example 10000
2640
+ */
2641
+ amount_cents?: number;
2642
+ /** The currency of the plan. It indicates the monetary unit in which the plan's cost, including taxes and usage-based charges, is expressed. */
2643
+ amount_currency?: Currency;
2644
+ /**
2645
+ * The duration in days during which the base cost of the plan is offered for free.
2646
+ * @example 5
2647
+ */
2648
+ trial_period?: number;
2649
+ /**
2650
+ * This field determines the billing timing for the plan. When set to `true`, the base cost of the plan is due at the beginning of each billing period. Conversely, when set to `false`, the base cost of the plan is due at the end of each billing period.
2651
+ * @example true
2652
+ */
2653
+ pay_in_advance?: boolean;
2654
+ /**
2655
+ * This field, when set to `true`, enables to invoice usage-based charges on monthly basis, even if the cadence of the plan is yearly. This allows customers to pay charges overage on a monthly basis. This can be set to true only if the plan’s interval is `yearly`.
2656
+ * @example null
2657
+ */
2658
+ bill_charges_monthly?: boolean | null;
2659
+ /**
2660
+ * List of unique code used to identify the taxes.
2661
+ * @example ["french_standard_vat"]
2662
+ */
2663
+ tax_codes?: string[];
2664
+ /**
2665
+ * Additional usage-based charges for this plan.
2666
+ * @example [{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","charge_model":"package","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"group_properties":[],"tax_codes":["french_standard_vat"]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","charge_model":"graduated","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"to_value":10,"from_value":0,"flat_amount":"10","per_unit_amount":"0.5"},{"to_value":null,"from_value":11,"flat_amount":"0","per_unit_amount":"0.4"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","charge_model":"standard","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{},"group_properties":[{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a01","invoice_display_name":"Europe","values":{"amount":"10"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a02","invoice_display_name":"USA","values":{"amount":"5"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a03","invoice_display_name":"Africa","values":{"amount":"8"}}]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","charge_model":"volume","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]},"group_properties":[]},{"billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","charge_model":"percentage","invoiceable":false,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"},"group_properties":[]}]
2667
+ */
2668
+ charges?: {
2669
+ /**
2670
+ * Unique identifier of the charge created by Lago.
2671
+ * @format uuid
2672
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2673
+ */
2674
+ id?: string;
2675
+ /**
2676
+ * Unique identifier of the billable metric created by Lago.
2677
+ * @format uuid
2678
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2679
+ */
2680
+ billable_metric_id?: string;
2681
+ /**
2682
+ * Specifies the pricing model used for the calculation of the final fee. It can be `standard`, `graduated`, `graduated_percentage`, `package`, `percentage` or `volume`.
2683
+ * @example "standard"
2684
+ */
2685
+ charge_model?: "standard" | "graduated" | "graduated_percentage" | "package" | "percentage" | "volume";
2686
+ /**
2687
+ * This field determines the billing timing for this specific usage-based charge. When set to `true`, the charge is due and invoiced immediately. Conversely, when set to false, the charge is due and invoiced at the end of each billing period.
2688
+ * @example false
2689
+ */
2690
+ pay_in_advance?: boolean;
2691
+ /**
2692
+ * This field specifies whether the charge should be included in a proper invoice. If set to false, no invoice will be issued for this charge. You can only set it to `false` when `pay_in_advance` is `true`.
2693
+ * @example true
2694
+ */
2695
+ invoiceable?: boolean;
2696
+ /**
2697
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the actual charge will be used as the default display name.
2698
+ * @example "Setup"
2699
+ */
2700
+ invoice_display_name?: string;
2701
+ /**
2702
+ * Specifies whether a charge is prorated based on the remaining number of days in the billing period or billed fully.
2703
+ *
2704
+ * - If set to `true`, the charge is prorated based on the remaining days in the current billing period.
2705
+ * - If set to `false`, the charge is billed in full.
2706
+ * - If not defined in the request, default value is `false`.
2707
+ * @example false
2708
+ */
2709
+ prorated?: boolean;
2710
+ /**
2711
+ * The minimum spending amount required for the charge, measured in cents and excluding any applicable taxes. It indicates the minimum amount that needs to be charged for each billing period.
2712
+ * @example 0
2713
+ */
2714
+ min_amount_cents?: number;
2715
+ /** List of all thresholds utilized for calculating the charge. */
2716
+ properties?: ChargeProperties;
2717
+ /** All charge information, sorted by groups. */
2718
+ group_properties?: {
2719
+ /**
2720
+ * Unique identifier of a billable metric group, created by Lago.
2721
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2722
+ */
2723
+ group_id: string;
2724
+ /** List of all thresholds utilized for calculating a charge, scoped by groups used as dimensions for a single charge. */
2725
+ values: ChargeProperties;
2726
+ }[];
2727
+ /**
2728
+ * List of unique code used to identify the taxes.
2729
+ * @example ["french_standard_vat"]
2730
+ */
2731
+ tax_codes?: string[];
2732
+ }[];
2733
+ };
2734
+ }
2735
+ export interface PlanObject {
2736
+ /**
2737
+ * Unique identifier of the plan created by Lago.
2738
+ * @format uuid
2739
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2740
+ */
2741
+ lago_id: string;
2742
+ /**
2743
+ * The name of the plan.
2744
+ * @example "Startup"
2745
+ */
2746
+ name: string;
2747
+ /**
2748
+ * Specifies the name that will be displayed on an invoice. If no value is set for this field, the name of the plan will be used as the default display name.
2749
+ * @example "Startup plan"
2750
+ */
2751
+ invoice_display_name?: string;
2752
+ /**
2753
+ * The date and time when the plan was created. It is expressed in UTC format according to the ISO 8601 datetime standard. This field provides the timestamp for the exact moment when the plan was initially created.
2754
+ * @format date-time
2755
+ * @example "2023-06-27T19:43:42Z"
2756
+ */
2757
+ created_at: string;
2758
+ /**
2759
+ * The code of the plan. It serves as a unique identifier associated with a particular plan. The code is typically used for internal or system-level identification purposes, like assigning a subscription, for instance.
2760
+ * @example "startup"
2761
+ */
2762
+ code: string;
2763
+ /**
2764
+ * The interval used for recurring billing. It represents the frequency at which subscription billing occurs. The interval can be one of the following values: `yearly`, `quarterly`, `monthly` or `weekly`.
2765
+ * @example "monthly"
2766
+ */
2767
+ interval: "weekly" | "monthly" | "quarterly" | "yearly";
2768
+ /**
2769
+ * The description on the plan.
2770
+ * @example ""
2771
+ */
2772
+ description?: string;
2773
+ /**
2774
+ * The base cost of the plan, excluding any applicable taxes, that is billed on a recurring basis. This value is defined at 0 if your plan is a pay-as-you-go plan.
2775
+ * @example 10000
2776
+ */
2777
+ amount_cents: number;
2778
+ /** The currency of the plan. It indicates the monetary unit in which the plan's cost, including taxes and usage-based charges, is expressed. */
2779
+ amount_currency: Currency;
2780
+ /**
2781
+ * The duration in days during which the base cost of the plan is offered for free.
2782
+ * @example 5
2783
+ */
2784
+ trial_period?: number;
2785
+ /**
2786
+ * This field determines the billing timing for the plan. When set to `true`, the base cost of the plan is due at the beginning of each billing period. Conversely, when set to `false`, the base cost of the plan is due at the end of each billing period.
2787
+ * @example true
2788
+ */
2789
+ pay_in_advance?: boolean;
2790
+ /**
2791
+ * This field, when set to `true`, enables to invoice usage-based charges on monthly basis, even if the cadence of the plan is yearly. This allows customers to pay charges overage on a monthly basis. This can be set to true only if the plan’s interval is `yearly`.
2792
+ * @example null
2793
+ */
2794
+ bill_charges_monthly?: boolean | null;
2795
+ /**
2796
+ * 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.
2797
+ * @example 0
2798
+ */
2799
+ active_subscriptions_count: number;
2800
+ /**
2801
+ * 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.
2802
+ * @example 0
2803
+ */
2804
+ draft_invoices_count: number;
2805
+ /**
2806
+ * Additional usage-based charges for this plan.
2807
+ * @example [{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a91","billable_metric_code":"requests","created_at":"2023-06-27T19:43:42Z","charge_model":"package","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":3000,"properties":{"amount":"30","free_units":100,"package_size":1000},"group_properties":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a92","billable_metric_code":"cpu","created_at":"2023-06-27T19:43:42Z","charge_model":"graduated","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"graduated_ranges":[{"from_value":0,"to_value":10,"flat_amount":"10","per_unit_amount":"0.5"},{"from_value":11,"to_value":null,"flat_amount":"0","per_unit_amount":"0.4"}]},"group_properties":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a93","billable_metric_code":"seats","created_at":"2023-06-27T19:43:42Z","charge_model":"standard","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{},"group_properties":[{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a01","invoice_display_name":"Europe","values":{"amount":"10"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a02","invoice_display_name":"USA","values":{"amount":"5"}},{"group_id":"1a901a90-1a90-1a90-1a90-1a901a901a03","invoice_display_name":"Africa","values":{"amount":"8"}}]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a94","billable_metric_code":"storage","created_at":"2023-06-27T19:43:42Z","charge_model":"volume","invoiceable":true,"invoice_display_name":"Setup","pay_in_advance":false,"prorated":false,"min_amount_cents":0,"properties":{"volume_ranges":[{"from_value":0,"to_value":100,"flat_amount":"0","per_unit_amount":"0"},{"from_value":101,"to_value":null,"flat_amount":"0","per_unit_amount":"0.5"}]},"group_properties":[]},{"lago_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","lago_billable_metric_id":"1a901a90-1a90-1a90-1a90-1a901a901a95","billable_metric_code":"payments","created_at":"2023-06-27T19:43:42Z","charge_model":"percentage","invoiceable":false,"invoice_display_name":"Setup","pay_in_advance":true,"prorated":false,"min_amount_cents":0,"properties":{"rate":"1","fixed_amount":"0.5","free_units_per_events":5,"free_units_per_total_aggregation":"500"},"group_properties":[]}]
2808
+ */
2809
+ charges?: ChargeObject[];
2810
+ /** All taxes applied to the plan. */
2811
+ taxes?: TaxObject[];
2812
+ }
2813
+ export interface PlansPaginated {
2814
+ plans: PlanObject[];
2815
+ meta: PaginationMeta;
2816
+ }
2817
+ export interface Subscription {
2818
+ subscription: SubscriptionObject;
2819
+ }
2820
+ export interface SubscriptionCreateInput {
2821
+ subscription: {
2822
+ /**
2823
+ * The customer external unique identifier (provided by your own application)
2824
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
2825
+ */
2826
+ external_customer_id: string;
2827
+ /**
2828
+ * The unique code representing the plan to be attached to the customer. This code must correspond to the `code` property of one of the active plans.
2829
+ * @example "premium"
2830
+ */
2831
+ plan_code: string;
2832
+ /**
2833
+ * The display name of the subscription on an invoice. This field allows for customization of the subscription's name for billing purposes, especially useful when a single customer has multiple subscriptions using the same plan.
2834
+ * @example "Repository A"
2835
+ */
2836
+ name?: string;
2837
+ /**
2838
+ * The unique external identifier for the subscription. This identifier serves as an idempotency key, ensuring that each subscription is unique.
2839
+ * @example "my_sub_1234567890"
2840
+ */
2841
+ external_id: string;
2842
+ /**
2843
+ * The billing time for the subscription, which can be set as either `anniversary` or `calendar`. If not explicitly provided, it will default to `calendar`. The billing time determines the timing of recurring billing cycles for the subscription. By specifying `anniversary`, the billing cycle will be based on the specific date the subscription started (billed fully), while `calendar` sets the billing cycle at the first day of the week/month/year (billed with proration).
2844
+ * @example "anniversary"
2845
+ */
2846
+ billing_time?: "calendar" | "anniversary";
2847
+ /**
2848
+ * The effective end date of the subscription. If this field is set to null, the subscription will automatically renew. This date should be provided in ISO 8601 datetime format, and use Coordinated Universal Time (UTC).
2849
+ * @format date-time
2850
+ * @example "2022-10-08T00:00:00Z"
2851
+ */
2852
+ ending_at?: string;
2853
+ /**
2854
+ * The start date for the subscription, allowing for the creation of subscriptions that can begin in the past or future. Please note that it cannot be used to update the start date of a pending subscription or schedule an upgrade/downgrade. The start_date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
2855
+ * @format date-time
2856
+ * @example "2022-08-08T00:00:00Z"
2857
+ */
2858
+ subscription_at?: string;
2859
+ };
2860
+ }
2861
+ export interface SubscriptionUpdateInput {
2862
+ subscription: {
2863
+ /**
2864
+ * The display name of the subscription on an invoice. This field allows for customization of the subscription's name for billing purposes, especially useful when a single customer has multiple subscriptions using the same plan.
2865
+ * @example "Repository B"
2866
+ */
2867
+ name?: string | null;
2868
+ /**
2869
+ * The effective end date of the subscription. If this field is set to null, the subscription will automatically renew. This date should be provided in ISO 8601 datetime format, and use Coordinated Universal Time (UTC).
2870
+ * @format date-time
2871
+ * @example "2022-10-08T00:00:00Z"
2872
+ */
2873
+ ending_at?: string;
2874
+ /**
2875
+ * The start date and time of the subscription. This field can only be modified for pending subscriptions that have not yet started. This date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
2876
+ * @format date-time
2877
+ * @example "2022-08-08T00:00:00Z"
2878
+ */
2879
+ subscription_at?: string;
2880
+ };
2881
+ }
2882
+ export interface SubscriptionObject {
2883
+ /**
2884
+ * 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
2885
+ * @format uuid
2886
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2887
+ */
2888
+ lago_id: string;
2889
+ /**
2890
+ * The subscription external unique identifier (provided by your own application).
2891
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
2892
+ */
2893
+ external_id: string;
2894
+ /**
2895
+ * 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
2896
+ * @format uuid
2897
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
2898
+ */
2899
+ lago_customer_id: string;
2900
+ /**
2901
+ * The customer external unique identifier (provided by your own application).
2902
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
2903
+ */
2904
+ external_customer_id: string;
2905
+ /**
2906
+ * The billing time for the subscription, which can be set as either `anniversary` or `calendar`. If not explicitly provided, it will default to `calendar`. The billing time determines the timing of recurring billing cycles for the subscription. By specifying `anniversary`, the billing cycle will be based on the specific date the subscription started (billed fully), while `calendar` sets the billing cycle at the first day of the week/month/year (billed with proration).
2907
+ * @example "anniversary"
2908
+ */
2909
+ billing_time: "calendar" | "anniversary";
2910
+ /**
2911
+ * The display name of the subscription on an invoice. This field allows for customization of the subscription's name for billing purposes, especially useful when a single customer has multiple subscriptions using the same plan.
2912
+ * @example "Repository A"
2913
+ */
2914
+ name?: string | null;
2915
+ /**
2916
+ * The unique code representing the plan to be attached to the customer. This code must correspond to the `code` property of one of the active plans.
2917
+ * @example "premium"
2918
+ */
2919
+ plan_code: string;
2920
+ /**
2921
+ * The status of the subscription, which can have the following values:
2922
+ * - `pending`: a previous subscription has been downgraded, and the current one is awaiting automatic activation at the end of the billing period.
2923
+ * - `active`: the subscription is currently active and applied to the customer.
2924
+ * - `terminated`: the subscription is no longer active.
2925
+ * - `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.
2926
+ * @example "active"
2927
+ */
2928
+ status: "active" | "pending" | "terminated" | "canceled";
2929
+ /**
2930
+ * 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.
2931
+ * @format date-time
2932
+ * @example "2022-08-08T00:00:00Z"
2933
+ */
2934
+ created_at: string;
2935
+ /**
2936
+ * The cancellation date of the subscription. This field is not null when the subscription is `canceled`. This date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
2937
+ * @format date-time
2938
+ * @example "2022-09-14T16:35:31Z"
2939
+ */
2940
+ canceled_at?: string | null;
2941
+ /**
2942
+ * The effective start date of the subscription. This field can be null if the subscription is `pending` or `canceled`. This date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
2943
+ * @format date-time
2944
+ * @example "2022-08-08T00:00:00Z"
2945
+ */
2946
+ started_at?: string | null;
2947
+ /**
2948
+ * The effective end date of the subscription. If this field is set to null, the subscription will automatically renew. This date should be provided in ISO 8601 datetime format, and use Coordinated Universal Time (UTC).
2949
+ * @format date-time
2950
+ * @example "2022-10-08T00:00:00Z"
2951
+ */
2952
+ ending_at?: string;
2953
+ /**
2954
+ * 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).
2955
+ * @format date-time
2956
+ * @example "2022-08-08T00:00:00Z"
2957
+ */
2958
+ subscription_at: string;
2959
+ /**
2960
+ * The termination date of the subscription. This field is not null when the subscription is `terminated`. This date should be provided in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC)
2961
+ * @format date-time
2962
+ * @example "2022-09-14T16:35:31Z"
2963
+ */
2964
+ terminated_at?: string | null;
2965
+ /**
2966
+ * The code identifying the previous plan associated with this subscription.
2967
+ * @example null
2968
+ */
2969
+ previous_plan_code?: string | null;
2970
+ /**
2971
+ * The code identifying the next plan in the case of a downgrade.
2972
+ * @example null
2973
+ */
2974
+ next_plan_code?: string | null;
2975
+ /**
2976
+ * The date when the plan will be downgraded, represented in ISO 8601 date format.
2977
+ * @format date-time
2978
+ * @example null
2979
+ */
2980
+ downgrade_plan_date?: string | null;
2981
+ }
2982
+ export interface SubscriptionsPaginated {
2983
+ subscriptions: SubscriptionObject[];
2984
+ meta: PaginationMeta;
2985
+ }
2986
+ export interface Tax {
2987
+ tax: TaxObject;
2988
+ }
2989
+ export interface TaxBaseInput {
2990
+ /**
2991
+ * Name of the tax.
2992
+ * @example "TVA"
2993
+ */
2994
+ name?: string;
2995
+ /**
2996
+ * Unique code used to identify the tax associated with the API request.
2997
+ * @example "french_standard_vat"
2998
+ */
2999
+ code?: string;
3000
+ /**
3001
+ * The percentage rate of the tax
3002
+ * @pattern ^[0-9]+.?[0-9]*$
3003
+ * @example "20.0"
3004
+ */
3005
+ rate?: string;
3006
+ /**
3007
+ * Internal description of the taxe
3008
+ * @example "French standard VAT"
3009
+ */
3010
+ description?: string | null;
3011
+ /**
3012
+ * Set to `true` if the tax is used as one of the organization's default
3013
+ * @example true
3014
+ */
3015
+ applied_to_organization?: boolean;
3016
+ }
3017
+ export interface TaxCreateInput {
3018
+ tax: TaxBaseInput;
3019
+ }
3020
+ export interface TaxesPaginated {
3021
+ taxes: TaxObject[];
3022
+ meta: PaginationMeta;
3023
+ }
3024
+ export interface TaxObject {
3025
+ /**
3026
+ * Unique identifier of the tax, created by Lago.
3027
+ * @format uuid
3028
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3029
+ */
3030
+ lago_id: string;
3031
+ /**
3032
+ * Name of the tax.
3033
+ * @example "TVA"
3034
+ */
3035
+ name: string;
3036
+ /**
3037
+ * Unique code used to identify the tax associated with the API request.
3038
+ * @example "french_standard_vat"
3039
+ */
3040
+ code: string;
3041
+ /**
3042
+ * Internal description of the taxe
3043
+ * @example "French standard VAT"
3044
+ */
3045
+ description?: string;
3046
+ /**
3047
+ * The percentage rate of the tax
3048
+ * @example 20
3049
+ */
3050
+ rate: number;
3051
+ /**
3052
+ * Set to `true` if the tax is used as one of the organization's default
3053
+ * @example true
3054
+ */
3055
+ applied_to_organization: boolean;
3056
+ /**
3057
+ * Number of add-ons this tax is applied to.
3058
+ * @example 0
3059
+ */
3060
+ add_ons_count?: number;
3061
+ /**
3062
+ * Number of charges this tax is applied to.
3063
+ * @example 0
3064
+ */
3065
+ charges_count?: number;
3066
+ /**
3067
+ * Number of customers this tax is applied to (directly or via the organization's default).
3068
+ * @example 0
3069
+ */
3070
+ customers_count: number;
3071
+ /**
3072
+ * Number of plans this tax is applied to.
3073
+ * @example 0
3074
+ */
3075
+ plans_count?: number;
3076
+ /**
3077
+ * Creation date of the tax.
3078
+ * @format date-time
3079
+ * @example "2023-07-06T14:35:58Z"
3080
+ */
3081
+ created_at: string;
3082
+ }
3083
+ export interface TaxUpdateInput {
3084
+ tax: TaxBaseInput;
3085
+ }
3086
+ /** @example "America/Los_Angeles" */
3087
+ export type Timezone = "UTC" | "Africa/Algiers" | "Africa/Cairo" | "Africa/Casablanca" | "Africa/Harare" | "Africa/Johannesburg" | "Africa/Monrovia" | "Africa/Nairobi" | "America/Argentina/Buenos_Aires" | "America/Bogota" | "America/Caracas" | "America/Chicago" | "America/Chihuahua" | "America/Denver" | "America/Godthab" | "America/Guatemala" | "America/Guyana" | "America/Halifax" | "America/Indiana/Indianapolis" | "America/Juneau" | "America/La_Paz" | "America/Lima" | "America/Los_Angeles" | "America/Mazatlan" | "America/Mexico_City" | "America/Monterrey" | "America/Montevideo" | "America/New_York" | "America/Phoenix" | "America/Puerto_Rico" | "America/Regina" | "America/Santiago" | "America/Sao_Paulo" | "America/St_Johns" | "America/Tijuana" | "Asia/Almaty" | "Asia/Baghdad" | "Asia/Baku" | "Asia/Bangkok" | "Asia/Chongqing" | "Asia/Colombo" | "Asia/Dhaka" | "Asia/Hong_Kong" | "Asia/Irkutsk" | "Asia/Jakarta" | "Asia/Jerusalem" | "Asia/Kabul" | "Asia/Kamchatka" | "Asia/Karachi" | "Asia/Kathmandu" | "Asia/Kolkata" | "Asia/Krasnoyarsk" | "Asia/Kuala_Lumpur" | "Asia/Kuwait" | "Asia/Magadan" | "Asia/Muscat" | "Asia/Novosibirsk" | "Asia/Rangoon" | "Asia/Riyadh" | "Asia/Seoul" | "Asia/Shanghai" | "Asia/Singapore" | "Asia/Srednekolymsk" | "Asia/Taipei" | "Asia/Tashkent" | "Asia/Tbilisi" | "Asia/Tehran" | "Asia/Tokyo" | "Asia/Ulaanbaatar" | "Asia/Urumqi" | "Asia/Vladivostok" | "Asia/Yakutsk" | "Asia/Yekaterinburg" | "Asia/Yerevan" | "Atlantic/Azores" | "Atlantic/Cape_Verde" | "Atlantic/South_Georgia" | "Australia/Adelaide" | "Australia/Brisbane" | "Australia/Darwin" | "Australia/Hobart" | "Australia/Melbourne" | "Australia/Perth" | "Australia/Sydney" | "Europe/Amsterdam" | "Europe/Athens" | "Europe/Belgrade" | "Europe/Berlin" | "Europe/Bratislava" | "Europe/Brussels" | "Europe/Bucharest" | "Europe/Budapest" | "Europe/Copenhagen" | "Europe/Dublin" | "Europe/Helsinki" | "Europe/Istanbul" | "Europe/Kaliningrad" | "Europe/Kiev" | "Europe/Lisbon" | "Europe/Ljubljana" | "Europe/London" | "Europe/Madrid" | "Europe/Minsk" | "Europe/Moscow" | "Europe/Paris" | "Europe/Prague" | "Europe/Riga" | "Europe/Rome" | "Europe/Samara" | "Europe/Sarajevo" | "Europe/Skopje" | "Europe/Sofia" | "Europe/Stockholm" | "Europe/Tallinn" | "Europe/Vienna" | "Europe/Vilnius" | "Europe/Volgograd" | "Europe/Warsaw" | "Europe/Zagreb" | "Europe/Zurich" | "GMT+12" | "Pacific/Apia" | "Pacific/Auckland" | "Pacific/Chatham" | "Pacific/Fakaofo" | "Pacific/Fiji" | "Pacific/Guadalcanal" | "Pacific/Guam" | "Pacific/Honolulu" | "Pacific/Majuro" | "Pacific/Midway" | "Pacific/Noumea" | "Pacific/Pago_Pago" | "Pacific/Port_Moresby" | "Pacific/Tongatapu";
3088
+ export interface Wallet {
3089
+ wallet: WalletObject;
3090
+ }
3091
+ export interface WalletCreateInput {
3092
+ wallet?: {
3093
+ /**
3094
+ * The name of the wallet.
3095
+ * @example "Prepaid"
3096
+ */
3097
+ name?: string;
3098
+ /**
3099
+ * The rate of conversion between credits and the amount in the specified currency. It indicates the ratio or factor used to convert credits into the corresponding monetary value in the currency of the transaction.
3100
+ * @pattern ^[0-9]+.?[0-9]*$
3101
+ * @example "1.5"
3102
+ */
3103
+ rate_amount: string;
3104
+ /** The currency of the wallet. */
3105
+ currency: Currency;
3106
+ /**
3107
+ * The number of paid credits. Required only if there is no granted credits.
3108
+ * @pattern ^[0-9]+.?[0-9]*$
3109
+ * @example "20.0"
3110
+ */
3111
+ paid_credits?: string | null;
3112
+ /**
3113
+ * The number of free granted credits. Required only if there is no paid credits.
3114
+ * @pattern ^[0-9]+.?[0-9]*$
3115
+ * @example "10.0"
3116
+ */
3117
+ granted_credits?: string | null;
3118
+ /**
3119
+ * The customer external unique identifier (provided by your own application)
3120
+ * @example "hooli_1234"
3121
+ */
3122
+ external_customer_id: string;
3123
+ /**
3124
+ * The date and time that determines when the wallet will expire. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
3125
+ * @format date-time
3126
+ * @example "2022-07-07T23:59:59Z"
3127
+ */
3128
+ expiration_at?: string | null;
3129
+ };
3130
+ }
3131
+ export interface WalletObject {
3132
+ /**
3133
+ * 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 wallet’s record within the Lago system.
3134
+ * @format uuid
3135
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3136
+ */
3137
+ lago_id: string;
3138
+ /**
3139
+ * 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.
3140
+ * @format uuid
3141
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3142
+ */
3143
+ lago_customer_id: string;
3144
+ /**
3145
+ * The customer external unique identifier (provided by your own application)
3146
+ * @example "hooli_1234"
3147
+ */
3148
+ external_customer_id: string;
3149
+ /**
3150
+ * The status of the wallet. Possible values are `active` or `terminated`.
3151
+ * @example "active"
3152
+ */
3153
+ status: "active" | "terminated";
3154
+ /** The currency of the wallet. */
3155
+ currency: Currency;
3156
+ /**
3157
+ * The name of the wallet.
3158
+ * @example "Prepaid"
3159
+ */
3160
+ name?: string;
3161
+ /**
3162
+ * The rate of conversion between credits and the amount in the specified currency. It indicates the ratio or factor used to convert credits into the corresponding monetary value in the currency of the transaction.
3163
+ * @pattern ^[0-9]+.?[0-9]*$
3164
+ * @example "1.5"
3165
+ */
3166
+ rate_amount: string;
3167
+ /**
3168
+ * The current wallet balance expressed in credits.
3169
+ * @pattern ^[0-9]+.?[0-9]*$
3170
+ * @example "28.0"
3171
+ */
3172
+ credits_balance: string;
3173
+ /**
3174
+ * The current wallet balance expressed in cents.
3175
+ * @example 1000
3176
+ */
3177
+ balance_cents: number;
3178
+ /**
3179
+ * The number of consumed credits.
3180
+ * @pattern ^[0-9]+.?[0-9]*$
3181
+ * @example "2.0"
3182
+ */
3183
+ consumed_credits: string;
3184
+ /**
3185
+ * The date of the wallet creation, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
3186
+ * @format date-time
3187
+ * @example "2022-04-29T08:59:51Z"
3188
+ */
3189
+ created_at: string;
3190
+ /**
3191
+ * The date and time that determines when the wallet will expire. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
3192
+ * @format date-time
3193
+ * @example null
3194
+ */
3195
+ expiration_at?: string | null;
3196
+ /**
3197
+ * The date and time of the last balance top-up. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
3198
+ * @format date-time
3199
+ * @example "2022-04-29T08:59:51Z"
3200
+ */
3201
+ last_balance_sync_at?: string | null;
3202
+ /**
3203
+ * The date and time of the last credits consumption. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
3204
+ * @format date-time
3205
+ * @example "2022-04-29T08:59:51Z"
3206
+ */
3207
+ last_consumed_credit_at?: string | null;
3208
+ /**
3209
+ * The date of terminaison of the wallet. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
3210
+ * @format date-time
3211
+ * @example "2022-09-14T16:35:31Z"
3212
+ */
3213
+ terminated_at?: string | null;
3214
+ }
3215
+ export interface WalletsPaginated {
3216
+ wallets: WalletObject[];
3217
+ meta: PaginationMeta;
3218
+ }
3219
+ export interface WalletTransactionCreateInput {
3220
+ wallet_transaction: {
3221
+ /**
3222
+ * 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 wallet’s record within the Lago system.
3223
+ * @format uuid
3224
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3225
+ */
3226
+ wallet_id: string;
3227
+ /**
3228
+ * The number of paid credits. Required only if there is no granted credits.
3229
+ * @pattern ^[0-9]+.?[0-9]*$
3230
+ * @example "20.0"
3231
+ */
3232
+ paid_credits?: string;
3233
+ /**
3234
+ * The number of free granted credits. Required only if there is no paid credits.
3235
+ * @pattern ^[0-9]+.?[0-9]*$
3236
+ * @example "10.0"
3237
+ */
3238
+ granted_credits?: string;
3239
+ };
3240
+ }
3241
+ export interface WalletTransactionObject {
3242
+ /**
3243
+ * 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.
3244
+ * @format uuid
3245
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3246
+ */
3247
+ lago_id: string;
3248
+ /**
3249
+ * 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 wallet’s record within the Lago system.
3250
+ * @format uuid
3251
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3252
+ */
3253
+ lago_wallet_id: string;
3254
+ /**
3255
+ * The status of the wallet transaction. Possible values are `pending` or `settled`.
3256
+ * @example "settled"
3257
+ */
3258
+ status: "pending" | "settled";
3259
+ /**
3260
+ * The type of transaction. Possible values are `inbound` (increasing the balance) or `outbound` (decreasing the balance).
3261
+ * @example "inbound"
3262
+ */
3263
+ transaction_type: "inbound" | "outbound";
3264
+ /**
3265
+ * The amount of credits based on the rate and the currency.
3266
+ * @pattern ^[0-9]+.?[0-9]*$
3267
+ * @example "10.0"
3268
+ */
3269
+ amount: string;
3270
+ /**
3271
+ * The number of credits used in the wallet transaction.
3272
+ * @pattern ^[0-9]+.?[0-9]*$
3273
+ * @example "100.0"
3274
+ */
3275
+ credit_amount: string;
3276
+ /**
3277
+ * The date when wallet transaction is settled, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
3278
+ * @format date-time
3279
+ * @example "2022-04-29T08:59:51Z"
3280
+ */
3281
+ settled_at?: string;
3282
+ /**
3283
+ * The date of the wallet transaction creation, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
3284
+ * @format date-time
3285
+ * @example "2022-04-29T08:59:51Z"
3286
+ */
3287
+ created_at: string;
3288
+ }
3289
+ export interface WalletTransactions {
3290
+ wallet_transactions: WalletTransactionObject[];
3291
+ }
3292
+ export type WalletTransactionsPaginated = WalletTransactions & {
3293
+ meta: PaginationMeta;
3294
+ };
3295
+ export interface WalletUpdateInput {
3296
+ wallet: {
3297
+ /**
3298
+ * The name of the wallet.
3299
+ * @example "new_name"
3300
+ */
3301
+ name?: string | null;
3302
+ /**
3303
+ * The date and time that determines when the wallet will expire. It follows the ISO 8601 datetime format and is expressed in Coordinated Universal Time (UTC).
3304
+ * @format date-time
3305
+ * @example "2022-07-07T23:59:59Z"
3306
+ */
3307
+ expiration_at?: string | null;
3308
+ };
3309
+ }
3310
+ export interface WebhookEndpoint {
3311
+ webhook_endpoint: WebhookEndpointObject;
3312
+ }
3313
+ export interface WebhookEndpointCreateInput {
3314
+ webhook_endpoint?: {
3315
+ /**
3316
+ * The URL of the webhook endpoint.
3317
+ * @example "https://foo.bar"
3318
+ */
3319
+ webhook_url: string;
3320
+ /**
3321
+ * The signature used for the webhook. If no value is passed,
3322
+ * @example "hmac"
3323
+ */
3324
+ signature_algo?: "jwt" | "hmac" | null;
3325
+ };
3326
+ }
3327
+ export interface WebhookEndpointObject {
3328
+ /**
3329
+ * 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.
3330
+ * @format uuid
3331
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3332
+ */
3333
+ lago_id: string;
3334
+ /**
3335
+ * Unique identifier assigned to the organization attached to the webhook endpoint within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the organization’s record within the Lago system.
3336
+ * @format uuid
3337
+ * @example "1a901a90-1a90-1a90-1a90-1a901a901a90"
3338
+ */
3339
+ lago_organization_id: string;
3340
+ /**
3341
+ * The name of the wallet.
3342
+ * @example "Prepaid"
3343
+ */
3344
+ webhook_url: string;
3345
+ /**
3346
+ * The signature algo for the webhook.
3347
+ * @example "hmac"
3348
+ */
3349
+ signature_algo?: "jwt" | "hmac";
3350
+ /**
3351
+ * The date of the webhook endpoint creation, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
3352
+ * @format date-time
3353
+ * @example "2022-04-29T08:59:51Z"
3354
+ */
3355
+ created_at: string;
3356
+ }
3357
+ export interface WebhookEndpointsPaginated {
3358
+ webhook_endpoints: WebhookEndpointObject[];
3359
+ meta: PaginationMeta;
3360
+ }
3361
+ export interface WebhookEndpointUpdateInput {
3362
+ webhook_endpoint?: {
3363
+ /**
3364
+ * The URL of the webhook endpoint.
3365
+ * @example "https://foo.bar"
3366
+ */
3367
+ webhook_url: string;
3368
+ /**
3369
+ * The signature used for the webhook. If no value is passed,
3370
+ * @example "hmac"
3371
+ */
3372
+ signature_algo?: "jwt" | "hmac" | null;
3373
+ };
3374
+ }
3375
+ export type QueryParamsType = Record<string | number, any>;
3376
+ export type ResponseFormat = keyof Omit<Body, "body" | "bodyUsed">;
3377
+ export interface FullRequestParams extends Omit<RequestInit, "body"> {
3378
+ /** set parameter to `true` for call `securityWorker` for this request */
3379
+ secure?: boolean;
3380
+ /** request path */
3381
+ path: string;
3382
+ /** content type of request body */
3383
+ type?: ContentType;
3384
+ /** query params */
3385
+ query?: QueryParamsType;
3386
+ /** format of response (i.e. response.json() -> format: "json") */
3387
+ format?: ResponseFormat;
3388
+ /** request body */
3389
+ body?: unknown;
3390
+ /** base url */
3391
+ baseUrl?: string;
3392
+ /** request cancellation token */
3393
+ cancelToken?: CancelToken;
3394
+ }
3395
+ export type RequestParams = Omit<FullRequestParams, "body" | "method" | "query" | "path">;
3396
+ export interface ApiConfig<SecurityDataType = unknown> {
3397
+ baseUrl?: string;
3398
+ baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
3399
+ securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
3400
+ customFetch?: typeof fetch;
3401
+ }
3402
+ export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
3403
+ data: D;
3404
+ error: E;
3405
+ }
3406
+ type CancelToken = Symbol | string | number;
3407
+ export declare enum ContentType {
3408
+ Json = "application/json",
3409
+ FormData = "multipart/form-data",
3410
+ UrlEncoded = "application/x-www-form-urlencoded",
3411
+ Text = "text/plain"
3412
+ }
3413
+ export declare class HttpClient<SecurityDataType = unknown> {
3414
+ baseUrl: string;
3415
+ private securityData;
3416
+ private securityWorker?;
3417
+ private abortControllers;
3418
+ private customFetch;
3419
+ private baseApiParams;
3420
+ constructor(apiConfig?: ApiConfig<SecurityDataType>);
3421
+ setSecurityData: (data: SecurityDataType | null) => void;
3422
+ protected encodeQueryParam(key: string, value: any): string;
3423
+ protected addQueryParam(query: QueryParamsType, key: string): string;
3424
+ protected addArrayQueryParam(query: QueryParamsType, key: string): any;
3425
+ protected toQueryString(rawQuery?: QueryParamsType): string;
3426
+ protected addQueryParams(rawQuery?: QueryParamsType): string;
3427
+ private contentFormatters;
3428
+ protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams;
3429
+ protected createAbortSignal: (cancelToken: CancelToken) => AbortSignal | undefined;
3430
+ abortRequest: (cancelToken: CancelToken) => void;
3431
+ request: <T = any, E = any>({ body, secure, path, type, query, format, baseUrl, cancelToken, ...params }: FullRequestParams) => Promise<HttpResponse<T, E>>;
3432
+ }
3433
+ /**
3434
+ * @title Lago API documentation
3435
+ * @version 0.49.0-beta
3436
+ * @license AGPLv3
3437
+ * @baseUrl https://api.getlago.com/api/v1
3438
+ * @externalDocs https://github.com/getlago
3439
+ * @contact <tech@getlago.com>
3440
+ *
3441
+ * Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
3442
+ */
3443
+ export declare class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
3444
+ addOns: {
3445
+ /**
3446
+ * @description This endpoint is used to create an add-on that can be then attached to a one-off invoice.
3447
+ *
3448
+ * @tags add_ons
3449
+ * @name CreateAddOn
3450
+ * @summary Create an add-on
3451
+ * @request POST:/add_ons
3452
+ * @secure
3453
+ */
3454
+ createAddOn: (data: AddOnCreateInput, params?: RequestParams) => Promise<HttpResponse<AddOn, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
3455
+ /**
3456
+ * @description This endpoint is used to list all existing add-ons.
3457
+ *
3458
+ * @tags add_ons
3459
+ * @name FindAllAddOns
3460
+ * @summary List all add-ons
3461
+ * @request GET:/add_ons
3462
+ * @secure
3463
+ */
3464
+ findAllAddOns: (query?: {
3465
+ /**
3466
+ * Page number.
3467
+ * @example 1
3468
+ */
3469
+ page?: number;
3470
+ /**
3471
+ * Number of records per page.
3472
+ * @example 20
3473
+ */
3474
+ per_page?: number;
3475
+ }, params?: RequestParams) => Promise<HttpResponse<AddOnsPaginated, ApiErrorUnauthorized>>;
3476
+ /**
3477
+ * @description This endpoint is used to update an existing add-on.
3478
+ *
3479
+ * @tags add_ons
3480
+ * @name UpdateAddOn
3481
+ * @summary Update an add-on
3482
+ * @request PUT:/add_ons/{code}
3483
+ * @secure
3484
+ */
3485
+ updateAddOn: (code: string, data: AddOnUpdateInput, params?: RequestParams) => Promise<HttpResponse<AddOn, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
3486
+ /**
3487
+ * @description This endpoint is used to retrieve a specific add-on.
3488
+ *
3489
+ * @tags add_ons
3490
+ * @name FindAddOn
3491
+ * @summary Retrieve an add-on
3492
+ * @request GET:/add_ons/{code}
3493
+ * @secure
3494
+ */
3495
+ findAddOn: (code: string, params?: RequestParams) => Promise<HttpResponse<AddOn, ApiErrorUnauthorized | ApiErrorNotFound>>;
3496
+ /**
3497
+ * @description This endpoint is used to delete an existing add-on.
3498
+ *
3499
+ * @tags add_ons
3500
+ * @name DestroyAddOn
3501
+ * @summary Delete an add-on
3502
+ * @request DELETE:/add_ons/{code}
3503
+ * @secure
3504
+ */
3505
+ destroyAddOn: (code: string, params?: RequestParams) => Promise<HttpResponse<AddOn, ApiErrorUnauthorized | ApiErrorNotFound>>;
3506
+ };
3507
+ appliedCoupons: {
3508
+ /**
3509
+ * @description This endpoint is used to apply a specific coupon to a customer, before or during a subscription.
3510
+ *
3511
+ * @tags coupons
3512
+ * @name ApplyCoupon
3513
+ * @summary Apply a coupon to a customer
3514
+ * @request POST:/applied_coupons
3515
+ * @secure
3516
+ */
3517
+ applyCoupon: (data: AppliedCouponInput, params?: RequestParams) => Promise<HttpResponse<AppliedCoupon, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
3518
+ /**
3519
+ * @description This endpoint is used to list all applied coupons. You can filter by coupon status and by customer.
3520
+ *
3521
+ * @tags coupons
3522
+ * @name FindAllAppliedCoupons
3523
+ * @summary List all applied coupons
3524
+ * @request GET:/applied_coupons
3525
+ * @secure
3526
+ */
3527
+ findAllAppliedCoupons: (query?: {
3528
+ /**
3529
+ * Page number.
3530
+ * @example 1
3531
+ */
3532
+ page?: number;
3533
+ /**
3534
+ * Number of records per page.
3535
+ * @example 20
3536
+ */
3537
+ per_page?: number;
3538
+ /**
3539
+ * The status of the coupon. Can be either `active` or `terminated`.
3540
+ * @example "active"
3541
+ */
3542
+ status?: "active" | "terminated";
3543
+ /**
3544
+ * The customer external unique identifier (provided by your own application)
3545
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
3546
+ */
3547
+ external_customer_id?: string;
3548
+ }, params?: RequestParams) => Promise<HttpResponse<AppliedCouponsPaginated, ApiErrorUnauthorized>>;
3549
+ };
3550
+ billableMetrics: {
3551
+ /**
3552
+ * @description This endpoint creates a new billable metric representing a pricing component of your application.
3553
+ *
3554
+ * @tags billable_metrics
3555
+ * @name CreateBillableMetric
3556
+ * @summary Create a billable metric
3557
+ * @request POST:/billable_metrics
3558
+ * @secure
3559
+ */
3560
+ createBillableMetric: (data: BillableMetricCreateInput, params?: RequestParams) => Promise<HttpResponse<BillableMetric, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
3561
+ /**
3562
+ * @description This endpoint retrieves all existing billable metrics that represent pricing components of your application.
3563
+ *
3564
+ * @tags billable_metrics
3565
+ * @name FindAllBillableMetrics
3566
+ * @summary List all billable metrics
3567
+ * @request GET:/billable_metrics
3568
+ * @secure
3569
+ */
3570
+ findAllBillableMetrics: (query?: {
3571
+ /**
3572
+ * Page number.
3573
+ * @example 1
3574
+ */
3575
+ page?: number;
3576
+ /**
3577
+ * Number of records per page.
3578
+ * @example 20
3579
+ */
3580
+ per_page?: number;
3581
+ }, params?: RequestParams) => Promise<HttpResponse<BillableMetricsPaginated, ApiErrorUnauthorized>>;
3582
+ /**
3583
+ * @description This endpoint updates an existing billable metric representing a pricing component of your application.
3584
+ *
3585
+ * @tags billable_metrics
3586
+ * @name UpdateBillableMetric
3587
+ * @summary Update a billable metric
3588
+ * @request PUT:/billable_metrics/{code}
3589
+ * @secure
3590
+ */
3591
+ updateBillableMetric: (code: string, data: BillableMetricUpdateInput, params?: RequestParams) => Promise<HttpResponse<BillableMetric, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
3592
+ /**
3593
+ * @description This endpoint deletes an existing billable metric representing a pricing component of your application.
3594
+ *
3595
+ * @tags billable_metrics
3596
+ * @name DestroyBillableMetric
3597
+ * @summary Delete a billable metric
3598
+ * @request DELETE:/billable_metrics/{code}
3599
+ * @secure
3600
+ */
3601
+ destroyBillableMetric: (code: string, params?: RequestParams) => Promise<HttpResponse<BillableMetric, ApiErrorUnauthorized | ApiErrorNotFound>>;
3602
+ /**
3603
+ * @description This endpoint retrieves an existing billable metric that represents a pricing component of your application. The billable metric is identified by its unique code.
3604
+ *
3605
+ * @tags billable_metrics
3606
+ * @name FindBillableMetric
3607
+ * @summary Retrieve a billable metric
3608
+ * @request GET:/billable_metrics/{code}
3609
+ * @secure
3610
+ */
3611
+ findBillableMetric: (code: string, params?: RequestParams) => Promise<HttpResponse<BillableMetric, ApiErrorUnauthorized | ApiErrorNotFound>>;
3612
+ /**
3613
+ * @description This endpoint retrieves all groups for a billable metric.
3614
+ *
3615
+ * @tags billable_metrics
3616
+ * @name FindAllBillableMetricGroups
3617
+ * @summary Find a billable metric's groups
3618
+ * @request GET:/billable_metrics/{code}/groups
3619
+ * @secure
3620
+ */
3621
+ findAllBillableMetricGroups: (code: string, query?: {
3622
+ /**
3623
+ * Page number.
3624
+ * @example 1
3625
+ */
3626
+ page?: number;
3627
+ /**
3628
+ * Number of records per page.
3629
+ * @example 20
3630
+ */
3631
+ per_page?: number;
3632
+ }, params?: RequestParams) => Promise<HttpResponse<GroupsPaginated, ApiErrorUnauthorized>>;
3633
+ };
3634
+ coupons: {
3635
+ /**
3636
+ * @description This endpoint is used to create a coupon that can be then attached to a customer to create a discount.
3637
+ *
3638
+ * @tags coupons
3639
+ * @name CreateCoupon
3640
+ * @summary Create a coupon
3641
+ * @request POST:/coupons
3642
+ * @secure
3643
+ */
3644
+ createCoupon: (data: CouponCreateInput, params?: RequestParams) => Promise<HttpResponse<Coupon, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
3645
+ /**
3646
+ * @description This endpoint is used to list all existing coupons.
3647
+ *
3648
+ * @tags coupons
3649
+ * @name FindAllCoupons
3650
+ * @summary List all coupons
3651
+ * @request GET:/coupons
3652
+ * @secure
3653
+ */
3654
+ findAllCoupons: (query?: {
3655
+ /**
3656
+ * Page number.
3657
+ * @example 1
3658
+ */
3659
+ page?: number;
3660
+ /**
3661
+ * Number of records per page.
3662
+ * @example 20
3663
+ */
3664
+ per_page?: number;
3665
+ }, params?: RequestParams) => Promise<HttpResponse<CouponsPaginated, ApiErrorUnauthorized>>;
3666
+ /**
3667
+ * @description This endpoint is used to update a coupon that can be then attached to a customer to create a discount.
3668
+ *
3669
+ * @tags coupons
3670
+ * @name UpdateCoupon
3671
+ * @summary Update a coupon
3672
+ * @request PUT:/coupons/{code}
3673
+ * @secure
3674
+ */
3675
+ updateCoupon: (code: string, data: CouponUpdateInput, params?: RequestParams) => Promise<HttpResponse<Coupon, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
3676
+ /**
3677
+ * @description This endpoint is used to retrieve a specific coupon.
3678
+ *
3679
+ * @tags coupons
3680
+ * @name FindCoupon
3681
+ * @summary Retrieve a coupon
3682
+ * @request GET:/coupons/{code}
3683
+ * @secure
3684
+ */
3685
+ findCoupon: (code: string, params?: RequestParams) => Promise<HttpResponse<Coupon, ApiErrorUnauthorized | ApiErrorNotFound>>;
3686
+ /**
3687
+ * @description This endpoint is used to delete a coupon.
3688
+ *
3689
+ * @tags coupons
3690
+ * @name DestroyCoupon
3691
+ * @summary Delete a coupon
3692
+ * @request DELETE:/coupons/{code}
3693
+ * @secure
3694
+ */
3695
+ destroyCoupon: (code: string, params?: RequestParams) => Promise<HttpResponse<Coupon, ApiErrorUnauthorized | ApiErrorNotFound>>;
3696
+ };
3697
+ creditNotes: {
3698
+ /**
3699
+ * @description This endpoint creates a new credit note.
3700
+ *
3701
+ * @tags credit_notes
3702
+ * @name CreateCreditNote
3703
+ * @summary Create a credit note
3704
+ * @request POST:/credit_notes
3705
+ * @secure
3706
+ */
3707
+ createCreditNote: (data: CreditNoteCreateInput, params?: RequestParams) => Promise<HttpResponse<CreditNote, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
3708
+ /**
3709
+ * @description This endpoint list all existing credit notes.
3710
+ *
3711
+ * @tags credit_notes
3712
+ * @name FindAllCreditNotes
3713
+ * @summary List all credit notes
3714
+ * @request GET:/credit_notes
3715
+ * @secure
3716
+ */
3717
+ findAllCreditNotes: (query?: {
3718
+ /**
3719
+ * Page number.
3720
+ * @example 1
3721
+ */
3722
+ page?: number;
3723
+ /**
3724
+ * Number of records per page.
3725
+ * @example 20
3726
+ */
3727
+ per_page?: number;
3728
+ /**
3729
+ * Unique identifier assigned to the customer in your application.
3730
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
3731
+ */
3732
+ external_customer_id?: string;
3733
+ }, params?: RequestParams) => Promise<HttpResponse<CreditNotes, ApiErrorUnauthorized>>;
3734
+ /**
3735
+ * @description This endpoint updates an existing credit note.
3736
+ *
3737
+ * @tags credit_notes
3738
+ * @name UpdateCreditNote
3739
+ * @summary Update a credit note
3740
+ * @request PUT:/credit_notes/{lago_id}
3741
+ * @secure
3742
+ */
3743
+ updateCreditNote: (lagoId: string, data: CreditNoteUpdateInput, params?: RequestParams) => Promise<HttpResponse<CreditNote, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
3744
+ /**
3745
+ * @description This endpoint retrieves an existing credit note.
3746
+ *
3747
+ * @tags credit_notes
3748
+ * @name FindCreditNote
3749
+ * @summary Retrieve a credit note
3750
+ * @request GET:/credit_notes/{lago_id}
3751
+ * @secure
3752
+ */
3753
+ findCreditNote: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<CreditNote, ApiErrorUnauthorized | ApiErrorNotFound>>;
3754
+ /**
3755
+ * @description This endpoint downloads the PDF of an existing credit note.
3756
+ *
3757
+ * @tags credit_notes
3758
+ * @name DownloadCreditNote
3759
+ * @summary Download a credit note PDF
3760
+ * @request POST:/credit_notes/{lago_id}/download
3761
+ * @secure
3762
+ */
3763
+ downloadCreditNote: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<CreditNote, ApiErrorUnauthorized | ApiErrorNotFound>>;
3764
+ /**
3765
+ * @description This endpoint voids an existing credit note.
3766
+ *
3767
+ * @tags credit_notes
3768
+ * @name VoidCreditNote
3769
+ * @summary Void a credit note
3770
+ * @request PUT:/credit_notes/{lago_id}/void
3771
+ * @secure
3772
+ */
3773
+ voidCreditNote: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<CreditNote, ApiErrorUnauthorized | ApiErrorNotAllowed | ApiErrorNotFound>>;
3774
+ };
3775
+ customers: {
3776
+ /**
3777
+ * @description This endpoint creates a new customer.
3778
+ *
3779
+ * @tags customers
3780
+ * @name CreateCustomer
3781
+ * @summary Create a customer
3782
+ * @request POST:/customers
3783
+ * @secure
3784
+ */
3785
+ createCustomer: (data: CustomerCreateInput, params?: RequestParams) => Promise<HttpResponse<Customer, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
3786
+ /**
3787
+ * @description This endpoint retrieves all existing customers.
3788
+ *
3789
+ * @tags customers
3790
+ * @name FindAllCustomers
3791
+ * @summary List all customers
3792
+ * @request GET:/customers
3793
+ * @secure
3794
+ */
3795
+ findAllCustomers: (query?: {
3796
+ /**
3797
+ * Page number.
3798
+ * @example 1
3799
+ */
3800
+ page?: number;
3801
+ /**
3802
+ * Number of records per page.
3803
+ * @example 20
3804
+ */
3805
+ per_page?: number;
3806
+ }, params?: RequestParams) => Promise<HttpResponse<CustomersPaginated, ApiErrorUnauthorized>>;
3807
+ /**
3808
+ * @description This endpoint retrieves an existing customer.
3809
+ *
3810
+ * @tags customers
3811
+ * @name FindCustomer
3812
+ * @summary Retrieve a customer
3813
+ * @request GET:/customers/{external_id}
3814
+ * @secure
3815
+ */
3816
+ findCustomer: (externalId: string, params?: RequestParams) => Promise<HttpResponse<Customer, ApiErrorUnauthorized | ApiErrorNotFound>>;
3817
+ /**
3818
+ * @description This endpoint deletes an existing customer.
3819
+ *
3820
+ * @tags customers
3821
+ * @name DestroyCustomer
3822
+ * @summary Delete a customer
3823
+ * @request DELETE:/customers/{external_id}
3824
+ * @secure
3825
+ */
3826
+ destroyCustomer: (externalId: string, params?: RequestParams) => Promise<HttpResponse<Customer, ApiErrorUnauthorized | ApiErrorNotFound>>;
3827
+ /**
3828
+ * @description This endpoint is used to delete a specific coupon that has been applied to a customer.
3829
+ *
3830
+ * @tags coupons, customers
3831
+ * @name DeleteAppliedCoupon
3832
+ * @summary Delete an applied coupon
3833
+ * @request DELETE:/customers/{external_customer_id}/applied_coupons/{applied_coupon_id}
3834
+ * @secure
3835
+ */
3836
+ deleteAppliedCoupon: (externalCustomerId: string, appliedCouponId: string, params?: RequestParams) => Promise<HttpResponse<AppliedCoupon, ApiErrorUnauthorized | ApiErrorNotFound>>;
3837
+ /**
3838
+ * @description Retrieves an embeddable link for displaying a customer portal. This endpoint allows you to fetch the URL that can be embedded to provide customers access to a dedicated portal
3839
+ *
3840
+ * @tags customers
3841
+ * @name GetCustomerPortalUrl
3842
+ * @summary Get a customer portal URL
3843
+ * @request GET:/customers/{external_customer_id}/portal_url
3844
+ * @secure
3845
+ */
3846
+ getCustomerPortalUrl: (externalCustomerId: string, params?: RequestParams) => Promise<HttpResponse<{
3847
+ customer: {
3848
+ /**
3849
+ * An embeddable link for displaying a customer portal
3850
+ * @example "https://app.lago.com/customer-portal/1234567890"
3851
+ */
3852
+ portal_url: string;
3853
+ };
3854
+ }, ApiErrorForbidden | ApiErrorUnauthorized | ApiErrorNotFound>>;
3855
+ /**
3856
+ * @description This endpoint enables the retrieval of the usage-based billing data for a customer within the current period.
3857
+ *
3858
+ * @tags customers
3859
+ * @name FindCustomerCurrentUsage
3860
+ * @summary Retrieve customer current usage
3861
+ * @request GET:/customers/{external_customer_id}/current_usage
3862
+ * @secure
3863
+ */
3864
+ findCustomerCurrentUsage: (externalCustomerId: string, query: {
3865
+ /**
3866
+ * The unique identifier of the subscription within your application.
3867
+ * @example "sub_1234567890"
3868
+ */
3869
+ external_subscription_id: string;
3870
+ }, params?: RequestParams) => Promise<HttpResponse<CustomerUsage, ApiErrorUnauthorized | ApiErrorNotFound>>;
3871
+ /**
3872
+ * @description This endpoint enables the retrieval of the usage-based billing data for a customer within past periods.
3873
+ *
3874
+ * @tags customers
3875
+ * @name FindAllCustomerPastUsage
3876
+ * @summary Retrieve customer past usage
3877
+ * @request GET:/customers/{external_customer_id}/past_usage
3878
+ * @secure
3879
+ */
3880
+ findAllCustomerPastUsage: (externalCustomerId: string, query: {
3881
+ /**
3882
+ * Page number.
3883
+ * @example 1
3884
+ */
3885
+ page?: number;
3886
+ /**
3887
+ * Number of records per page.
3888
+ * @example 20
3889
+ */
3890
+ per_page?: number;
3891
+ /**
3892
+ * The unique identifier of the subscription within your application.
3893
+ * @example "sub_1234567890"
3894
+ */
3895
+ external_subscription_id: string;
3896
+ /**
3897
+ * Billable metric code filter to apply to the charge usage
3898
+ * @example "cpu"
3899
+ */
3900
+ billable_metric_code?: string;
3901
+ /**
3902
+ * Number of past billing period to returns in the result
3903
+ * @example 5
3904
+ */
3905
+ periods_count?: number;
3906
+ }, params?: RequestParams) => Promise<HttpResponse<CustomerPastUsage, ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
3907
+ };
3908
+ events: {
3909
+ /**
3910
+ * @description This endpoint is used for transmitting usage measurement events to either a designated customer or a specific subscription.
3911
+ *
3912
+ * @tags events
3913
+ * @name CreateEvent
3914
+ * @summary Send usage events
3915
+ * @request POST:/events
3916
+ * @secure
3917
+ */
3918
+ createEvent: (data: EventInput, params?: RequestParams) => Promise<HttpResponse<void, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
3919
+ /**
3920
+ * @description This endpoint is used for transmitting a batch of usage measurement events to multiple subscriptions for a single customer.
3921
+ *
3922
+ * @tags events
3923
+ * @name CreateBatchEvents
3924
+ * @summary Batch multiple events
3925
+ * @request POST:/events/batch
3926
+ * @deprecated
3927
+ * @secure
3928
+ */
3929
+ createBatchEvents: (data: EventBatchInput, params?: RequestParams) => Promise<HttpResponse<void, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
3930
+ /**
3931
+ * @description Estimate the fees that would be created after reception of an event for a billable metric attached to one or multiple pay in advance charges
3932
+ *
3933
+ * @tags events
3934
+ * @name EventEstimateFees
3935
+ * @summary Estimate fees for a pay in advance charge
3936
+ * @request POST:/events/estimate_fees
3937
+ * @secure
3938
+ */
3939
+ eventEstimateFees: (data: EventEstimateFeesInput, params?: RequestParams) => Promise<HttpResponse<Fees, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
3940
+ /**
3941
+ * @description This endpoint is used for retrieving a specific usage measurement event that has been sent to a customer or a subscription.
3942
+ *
3943
+ * @tags events
3944
+ * @name FindEvent
3945
+ * @summary Retrieve a specific event
3946
+ * @request GET:/events/{transaction_id}
3947
+ * @secure
3948
+ */
3949
+ findEvent: (transactionId: string, params?: RequestParams) => Promise<HttpResponse<Event, ApiErrorUnauthorized | ApiErrorNotFound>>;
3950
+ };
3951
+ fees: {
3952
+ /**
3953
+ * @description This endpoint is used for retrieving all fees that has been issued.
3954
+ *
3955
+ * @tags fees
3956
+ * @name FindAllFees
3957
+ * @summary List all fees
3958
+ * @request GET:/fees
3959
+ * @secure
3960
+ */
3961
+ findAllFees: (query?: {
3962
+ /**
3963
+ * Page number.
3964
+ * @example 1
3965
+ */
3966
+ page?: number;
3967
+ /**
3968
+ * Number of records per page.
3969
+ * @example 20
3970
+ */
3971
+ per_page?: number;
3972
+ /**
3973
+ * Unique identifier assigned to the customer in your application.
3974
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
3975
+ */
3976
+ external_customer_id?: string;
3977
+ /**
3978
+ * External subscription ID
3979
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
3980
+ */
3981
+ external_subscription_id?: string;
3982
+ /** Filter results by fee’s currency. */
3983
+ currency?: Currency;
3984
+ /**
3985
+ * The fee type. Possible values are `add-on`, `charge`, `credit` or `subscription`.
3986
+ * @example "charge"
3987
+ */
3988
+ fee_type?: "charge" | "add_on" | "subscription" | "credit" | "instant_charge";
3989
+ /**
3990
+ * Filter results by the `code` of the billable metric attached to the fee. Only applies to `charge` types.
3991
+ * @example "bm_code"
3992
+ */
3993
+ billable_metric_code?: string;
3994
+ /**
3995
+ * Indicates the payment status of the fee. It represents the current status of the payment associated with the fee. The possible values for this field are `pending`, `succeeded`, `failed` and refunded`.
3996
+ * @example "succeeded"
3997
+ */
3998
+ payment_status?: "pending" | "succeeded" | "failed" | "refunded";
3999
+ /**
4000
+ * Filter results created after creation date and time in UTC.
4001
+ * @format date-time
4002
+ * @example "2023-03-28T12:21:51Z"
4003
+ */
4004
+ created_at_from?: string;
4005
+ /**
4006
+ * Filter results created before creation date and time in UTC.
4007
+ * @format date-time
4008
+ * @example "2023-03-28T12:21:51Z"
4009
+ */
4010
+ created_at_to?: string;
4011
+ /**
4012
+ * Filter results with payment success after creation date and time in UTC.
4013
+ * @format date-time
4014
+ * @example "2023-03-28T12:21:51Z"
4015
+ */
4016
+ succeeded_at_from?: string;
4017
+ /**
4018
+ * Filter results with payment success after creation date and time in UTC.
4019
+ * @format date-time
4020
+ * @example "2023-03-28T12:21:51Z"
4021
+ */
4022
+ succeeded_at_to?: string;
4023
+ /**
4024
+ * Filter results with payment failure after creation date and time in UTC.
4025
+ * @format date-time
4026
+ * @example "2023-03-28T12:21:51Z"
4027
+ */
4028
+ failed_at_from?: string;
4029
+ /**
4030
+ * Filter results with payment failure after creation date and time in UTC.
4031
+ * @format date-time
4032
+ * @example "2023-03-28T12:21:51Z"
4033
+ */
4034
+ failed_at_to?: string;
4035
+ /**
4036
+ * Filter results with payment refund after creation date and time in UTC.
4037
+ * @format date-time
4038
+ * @example "2023-03-28T12:21:51Z"
4039
+ */
4040
+ refunded_at_from?: string;
4041
+ /**
4042
+ * Filter results with payment refund after creation date and time in UTC.
4043
+ * @format date-time
4044
+ * @example "2023-03-28T12:21:51Z"
4045
+ */
4046
+ refunded_at_to?: string;
4047
+ }, params?: RequestParams) => Promise<HttpResponse<FeesPaginated, ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
4048
+ /**
4049
+ * @description This endpoint is used for retrieving a specific fee that has been issued.
4050
+ *
4051
+ * @tags fees
4052
+ * @name FindFee
4053
+ * @summary Retrieve a specific fee
4054
+ * @request GET:/fees/{lago_id}
4055
+ * @secure
4056
+ */
4057
+ findFee: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<Fee, ApiErrorUnauthorized | ApiErrorNotFound>>;
4058
+ /**
4059
+ * @description This endpoint is used for updating a specific fee that has been issued.
4060
+ *
4061
+ * @tags fees
4062
+ * @name UpdateFee
4063
+ * @summary Update a fee
4064
+ * @request PUT:/fees/{lago_id}
4065
+ * @secure
4066
+ */
4067
+ updateFee: (lagoId: string, data: FeeUpdateInput, params?: RequestParams) => Promise<HttpResponse<Fee, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
4068
+ };
4069
+ invoices: {
4070
+ /**
4071
+ * @description This endpoint is used for issuing a one-off invoice.
4072
+ *
4073
+ * @tags invoices
4074
+ * @name CreateInvoice
4075
+ * @summary Create a one-off invoice
4076
+ * @request POST:/invoices
4077
+ * @secure
4078
+ */
4079
+ createInvoice: (data: InvoiceOneOffCreateInput, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
4080
+ /**
4081
+ * @description This endpoint is used for retrievign all invoices.
4082
+ *
4083
+ * @tags invoices
4084
+ * @name FindAllInvoices
4085
+ * @summary List all invoices
4086
+ * @request GET:/invoices
4087
+ * @secure
4088
+ */
4089
+ findAllInvoices: (query?: {
4090
+ /**
4091
+ * Page number.
4092
+ * @example 1
4093
+ */
4094
+ page?: number;
4095
+ /**
4096
+ * Number of records per page.
4097
+ * @example 20
4098
+ */
4099
+ per_page?: number;
4100
+ /**
4101
+ * Unique identifier assigned to the customer in your application.
4102
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4103
+ */
4104
+ external_customer_id?: string;
4105
+ /**
4106
+ * Filter invoices starting from a specific date.
4107
+ * @format date
4108
+ * @example "2022-07-08"
4109
+ */
4110
+ issuing_date_from?: string;
4111
+ /**
4112
+ * Filter invoices up to a specific date.
4113
+ * @format date
4114
+ * @example "2022-08-09"
4115
+ */
4116
+ issuing_date_to?: string;
4117
+ /** Filter invoices by status. Possible values are `draft` or `finalized`. */
4118
+ status?: "draft" | "finalized";
4119
+ /** Filter invoices by payment status. Possible values are `pending`, `failed` or `succeeded`. */
4120
+ payment_status?: "pending" | "failed" | "succeeded";
4121
+ }, params?: RequestParams) => Promise<HttpResponse<InvoicesPaginated, ApiErrorUnauthorized>>;
4122
+ /**
4123
+ * @description This endpoint is used for updating an existing invoice.
4124
+ *
4125
+ * @tags invoices
4126
+ * @name UpdateInvoice
4127
+ * @summary Update an invoice
4128
+ * @request PUT:/invoices/{lago_id}
4129
+ * @secure
4130
+ */
4131
+ updateInvoice: (lagoId: string, data: InvoiceUpdateInput, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
4132
+ /**
4133
+ * @description This endpoint is used for retrieving a specific invoice that has been issued.
4134
+ *
4135
+ * @tags invoices
4136
+ * @name FindInvoice
4137
+ * @summary Retrieve an invoice
4138
+ * @request GET:/invoices/{lago_id}
4139
+ * @secure
4140
+ */
4141
+ findInvoice: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiErrorUnauthorized | ApiErrorNotFound>>;
4142
+ /**
4143
+ * @description This endpoint is used for downloading a specific invoice PDF document.
4144
+ *
4145
+ * @tags invoices
4146
+ * @name DownloadInvoice
4147
+ * @summary Download an invoice PDF
4148
+ * @request POST:/invoices/{lago_id}/download
4149
+ * @secure
4150
+ */
4151
+ downloadInvoice: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiErrorUnauthorized | ApiErrorNotFound>>;
4152
+ /**
4153
+ * @description This endpoint is used for finalizing a draft invoice.
4154
+ *
4155
+ * @tags invoices
4156
+ * @name FinalizeInvoice
4157
+ * @summary Finalize a draft invoice
4158
+ * @request PUT:/invoices/{lago_id}/finalize
4159
+ * @secure
4160
+ */
4161
+ finalizeInvoice: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiErrorUnauthorized | ApiErrorNotFound>>;
4162
+ /**
4163
+ * @description This endpoint is used for refreshing a draft invoice.
4164
+ *
4165
+ * @tags invoices
4166
+ * @name RefreshInvoice
4167
+ * @summary Refresh a draft invoice
4168
+ * @request PUT:/invoices/{lago_id}/refresh
4169
+ * @secure
4170
+ */
4171
+ refreshInvoice: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<Invoice, ApiErrorUnauthorized | ApiErrorNotFound>>;
4172
+ /**
4173
+ * @description This endpoint resends an invoice for collection and retry a payment.
4174
+ *
4175
+ * @tags invoices
4176
+ * @name RetryPayment
4177
+ * @summary Retry an invoice payment
4178
+ * @request POST:/invoices/{lago_id}/retry_payment
4179
+ * @secure
4180
+ */
4181
+ retryPayment: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<void, ApiErrorUnauthorized | ApiErrorNotAllowed | ApiErrorNotFound>>;
4182
+ };
4183
+ organizations: {
4184
+ /**
4185
+ * @description This endpoint is used to update your own organization's settings.
4186
+ *
4187
+ * @tags organizations
4188
+ * @name UpdateOrganization
4189
+ * @summary Update your organization
4190
+ * @request PUT:/organizations
4191
+ * @secure
4192
+ */
4193
+ updateOrganization: (data: OrganizationUpdateInput, params?: RequestParams) => Promise<HttpResponse<Organization, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
4194
+ };
4195
+ plans: {
4196
+ /**
4197
+ * @description This endpoint creates a plan with subscription and usage-based charges. It supports flexible billing cadence (in-advance or in-arrears) and allows for both recurring and metered charges.
4198
+ *
4199
+ * @tags plans
4200
+ * @name CreatePlan
4201
+ * @summary Create a plan
4202
+ * @request POST:/plans
4203
+ * @secure
4204
+ */
4205
+ createPlan: (data: PlanCreateInput, params?: RequestParams) => Promise<HttpResponse<Plan, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
4206
+ /**
4207
+ * @description This endpoint retrieves all existing plans.
4208
+ *
4209
+ * @tags plans
4210
+ * @name FindAllPlans
4211
+ * @summary List all plans
4212
+ * @request GET:/plans
4213
+ * @secure
4214
+ */
4215
+ findAllPlans: (query?: {
4216
+ /**
4217
+ * Page number.
4218
+ * @example 1
4219
+ */
4220
+ page?: number;
4221
+ /**
4222
+ * Number of records per page.
4223
+ * @example 20
4224
+ */
4225
+ per_page?: number;
4226
+ }, params?: RequestParams) => Promise<HttpResponse<PlansPaginated, ApiErrorUnauthorized>>;
4227
+ /**
4228
+ * @description This endpoint updates a specific plan with subscription and usage-based charges. It supports flexible billing cadence (in-advance or in-arrears) and allows for both recurring and metered charges.
4229
+ *
4230
+ * @tags plans
4231
+ * @name UpdatePlan
4232
+ * @summary Update a plan
4233
+ * @request PUT:/plans/{code}
4234
+ * @secure
4235
+ */
4236
+ updatePlan: (code: string, data: PlanUpdateInput, params?: RequestParams) => Promise<HttpResponse<Plan, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
4237
+ /**
4238
+ * @description This endpoint retrieves a specific plan.
4239
+ *
4240
+ * @tags plans
4241
+ * @name FindPlan
4242
+ * @summary Retrieve a plan
4243
+ * @request GET:/plans/{code}
4244
+ * @secure
4245
+ */
4246
+ findPlan: (code: string, params?: RequestParams) => Promise<HttpResponse<Plan, ApiErrorUnauthorized | ApiErrorNotFound>>;
4247
+ /**
4248
+ * @description This endpoint deletes a specific plan. Note that this plan could be associated with active subscriptions.
4249
+ *
4250
+ * @tags plans
4251
+ * @name DestroyPlan
4252
+ * @summary Delete a plan
4253
+ * @request DELETE:/plans/{code}
4254
+ * @secure
4255
+ */
4256
+ destroyPlan: (code: string, params?: RequestParams) => Promise<HttpResponse<Plan, ApiErrorUnauthorized | ApiErrorNotFound>>;
4257
+ };
4258
+ subscriptions: {
4259
+ /**
4260
+ * @description This endpoint assigns a plan to a customer, creating or modifying a subscription. Ideal for initial subscriptions or plan changes (upgrades/downgrades).
4261
+ *
4262
+ * @tags subscriptions
4263
+ * @name CreateSubscription
4264
+ * @summary Assign a plan to a customer
4265
+ * @request POST:/subscriptions
4266
+ * @secure
4267
+ */
4268
+ createSubscription: (data: SubscriptionCreateInput, params?: RequestParams) => Promise<HttpResponse<Subscription, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
4269
+ /**
4270
+ * @description This endpoint retrieves all active subscriptions.
4271
+ *
4272
+ * @tags subscriptions
4273
+ * @name FindAllSubscriptions
4274
+ * @summary List all subscriptions
4275
+ * @request GET:/subscriptions
4276
+ * @secure
4277
+ */
4278
+ findAllSubscriptions: (query?: {
4279
+ /**
4280
+ * Page number.
4281
+ * @example 1
4282
+ */
4283
+ page?: number;
4284
+ /**
4285
+ * Number of records per page.
4286
+ * @example 20
4287
+ */
4288
+ per_page?: number;
4289
+ /**
4290
+ * The customer external unique identifier (provided by your own application)
4291
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4292
+ */
4293
+ external_customer_id?: string;
4294
+ /**
4295
+ * The unique code representing the plan to be attached to the customer. This code must correspond to the code property of one of the active plans.
4296
+ * @example "premium"
4297
+ */
4298
+ plan_code?: string;
4299
+ /**
4300
+ * If the field is not defined, Lago will return only `active` subscriptions. However, if you wish to fetch subscriptions by different status you can define them in a status[] query param. Available filter values: `pending`, `canceled`, `terminated`, `active`.
4301
+ * @example ["active","pending"]
4302
+ */
4303
+ status?: ("pending" | "canceled" | "terminated" | "active")[];
4304
+ }, params?: RequestParams) => Promise<HttpResponse<SubscriptionsPaginated, ApiErrorUnauthorized | ApiErrorNotFound>>;
4305
+ /**
4306
+ * @description This endpoint retrieves a specific subscription.
4307
+ *
4308
+ * @tags subscriptions
4309
+ * @name FindSubscription
4310
+ * @summary Retrieve a subscription
4311
+ * @request GET:/subscriptions/{external_id}
4312
+ * @secure
4313
+ */
4314
+ findSubscription: (externalId: string, params?: RequestParams) => Promise<HttpResponse<Subscription, ApiErrorUnauthorized | ApiErrorNotFound>>;
4315
+ /**
4316
+ * @description This endpoint allows you to update a subscription.
4317
+ *
4318
+ * @tags subscriptions
4319
+ * @name UpdateSubscription
4320
+ * @summary Update a subscription
4321
+ * @request PUT:/subscriptions/{external_id}
4322
+ * @secure
4323
+ */
4324
+ updateSubscription: (externalId: string, data: SubscriptionUpdateInput, params?: RequestParams) => Promise<HttpResponse<Subscription, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
4325
+ /**
4326
+ * @description This endpoint allows you to terminate a subscription.
4327
+ *
4328
+ * @tags subscriptions
4329
+ * @name DestroySubscription
4330
+ * @summary Terminate a subscription
4331
+ * @request DELETE:/subscriptions/{external_id}
4332
+ * @secure
4333
+ */
4334
+ destroySubscription: (externalId: string, query?: {
4335
+ /**
4336
+ * 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.
4337
+ * @example "pending"
4338
+ */
4339
+ status?: string;
4340
+ }, params?: RequestParams) => Promise<HttpResponse<Subscription, ApiErrorUnauthorized | ApiErrorNotAllowed | ApiErrorNotFound>>;
4341
+ };
4342
+ taxes: {
4343
+ /**
4344
+ * @description This endpoint creates a new tax representing a customizable tax rate applicable to either the organization or a specific customer.
4345
+ *
4346
+ * @tags taxes
4347
+ * @name CreateTax
4348
+ * @summary Create a tax
4349
+ * @request POST:/taxes
4350
+ * @secure
4351
+ */
4352
+ createTax: (data: TaxCreateInput, params?: RequestParams) => Promise<HttpResponse<Tax, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
4353
+ /**
4354
+ * @description This endpoint retrieves all existing taxes representing a customizable tax rate applicable to either the organization or a specific customer.
4355
+ *
4356
+ * @tags taxes
4357
+ * @name FindAllTaxes
4358
+ * @summary List all taxes
4359
+ * @request GET:/taxes
4360
+ * @secure
4361
+ */
4362
+ findAllTaxes: (query?: {
4363
+ /**
4364
+ * Page number.
4365
+ * @example 1
4366
+ */
4367
+ page?: number;
4368
+ /**
4369
+ * Number of records per page.
4370
+ * @example 20
4371
+ */
4372
+ per_page?: number;
4373
+ }, params?: RequestParams) => Promise<HttpResponse<TaxesPaginated, ApiErrorUnauthorized>>;
4374
+ /**
4375
+ * @description This endpoint updates an existing tax representing a customizable tax rate applicable to either the organization or a specific customer.
4376
+ *
4377
+ * @tags taxes
4378
+ * @name UpdateTax
4379
+ * @summary Update a tax
4380
+ * @request PUT:/taxes/{code}
4381
+ * @secure
4382
+ */
4383
+ updateTax: (code: string, data: TaxUpdateInput, params?: RequestParams) => Promise<HttpResponse<Tax, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
4384
+ /**
4385
+ * @description This endpoint retrieves an existing tax representing a customizable tax rate applicable to either the organization or a specific customer. The tax is identified by its unique code.
4386
+ *
4387
+ * @tags taxes
4388
+ * @name FindTax
4389
+ * @summary Retrieve a Tax
4390
+ * @request GET:/taxes/{code}
4391
+ * @secure
4392
+ */
4393
+ findTax: (code: string, params?: RequestParams) => Promise<HttpResponse<Tax, ApiErrorUnauthorized | ApiErrorNotFound>>;
4394
+ /**
4395
+ * @description This endpoint is used to delete a tax.
4396
+ *
4397
+ * @tags taxes
4398
+ * @name DestroyTax
4399
+ * @summary Delete a tax
4400
+ * @request DELETE:/taxes/{code}
4401
+ * @secure
4402
+ */
4403
+ destroyTax: (code: string, params?: RequestParams) => Promise<HttpResponse<Tax, ApiErrorUnauthorized | ApiErrorNotFound>>;
4404
+ };
4405
+ wallets: {
4406
+ /**
4407
+ * @description This endpoint is used to create a wallet with prepaid credits.
4408
+ *
4409
+ * @tags wallets
4410
+ * @name CreateWallet
4411
+ * @summary Create a wallet
4412
+ * @request POST:/wallets
4413
+ * @secure
4414
+ */
4415
+ createWallet: (data: WalletCreateInput, params?: RequestParams) => Promise<HttpResponse<Wallet, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
4416
+ /**
4417
+ * @description This endpoint is used to list all wallets with prepaid credits.
4418
+ *
4419
+ * @tags wallets
4420
+ * @name FindAllWallets
4421
+ * @summary List all wallets
4422
+ * @request GET:/wallets
4423
+ * @secure
4424
+ */
4425
+ findAllWallets: (query: {
4426
+ /**
4427
+ * Page number.
4428
+ * @example 1
4429
+ */
4430
+ page?: number;
4431
+ /**
4432
+ * Number of records per page.
4433
+ * @example 20
4434
+ */
4435
+ per_page?: number;
4436
+ /**
4437
+ * The customer external unique identifier (provided by your own application).
4438
+ * @example "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
4439
+ */
4440
+ external_customer_id: string;
4441
+ }, params?: RequestParams) => Promise<HttpResponse<WalletsPaginated, ApiErrorUnauthorized>>;
4442
+ /**
4443
+ * @description This endpoint is used to update an existing wallet with prepaid credits.
4444
+ *
4445
+ * @tags wallets
4446
+ * @name UpdateWallet
4447
+ * @summary Update a wallet
4448
+ * @request PUT:/wallets/{lago_id}
4449
+ * @secure
4450
+ */
4451
+ updateWallet: (lagoId: string, data: WalletUpdateInput, params?: RequestParams) => Promise<HttpResponse<Wallet, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
4452
+ /**
4453
+ * @description This endpoint is used to retrieve an existing wallet with prepaid credits.
4454
+ *
4455
+ * @tags wallets
4456
+ * @name FindWallet
4457
+ * @summary Retrieve a wallet
4458
+ * @request GET:/wallets/{lago_id}
4459
+ * @secure
4460
+ */
4461
+ findWallet: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<Wallet, ApiErrorUnauthorized | ApiErrorNotFound>>;
4462
+ /**
4463
+ * @description This endpoint is used to terminate an existing wallet with prepaid credits.
4464
+ *
4465
+ * @tags wallets
4466
+ * @name DestroyWallet
4467
+ * @summary Terminate a wallet
4468
+ * @request DELETE:/wallets/{lago_id}
4469
+ * @secure
4470
+ */
4471
+ destroyWallet: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<Wallet, ApiErrorUnauthorized | ApiErrorNotAllowed | ApiErrorNotFound>>;
4472
+ /**
4473
+ * @description This endpoint is used to list all wallet transactions.
4474
+ *
4475
+ * @tags wallets
4476
+ * @name FindAllWalletTransactions
4477
+ * @summary List all wallet transactions
4478
+ * @request GET:/wallets/{lago_id}/wallet_transactions
4479
+ * @secure
4480
+ */
4481
+ findAllWalletTransactions: (lagoId: string, query?: {
4482
+ /**
4483
+ * Page number.
4484
+ * @example 1
4485
+ */
4486
+ page?: number;
4487
+ /**
4488
+ * Number of records per page.
4489
+ * @example 20
4490
+ */
4491
+ per_page?: number;
4492
+ /**
4493
+ * The status of the wallet transaction. Possible values are `pending` or `settled`.
4494
+ * @example "pending"
4495
+ */
4496
+ status?: string;
4497
+ /**
4498
+ * The transaction type of the wallet transaction. Possible values are `inbound` (increasing the wallet balance) or `outbound` (decreasing the wallet balance).
4499
+ * @example "inbound"
4500
+ */
4501
+ transaction_type?: string;
4502
+ }, params?: RequestParams) => Promise<HttpResponse<WalletTransactionsPaginated, ApiErrorUnauthorized | ApiErrorNotFound>>;
4503
+ };
4504
+ walletTransactions: {
4505
+ /**
4506
+ * @description This endpoint is used to top-up an active wallet.
4507
+ *
4508
+ * @tags wallets
4509
+ * @name CreateWalletTransaction
4510
+ * @summary Top up a wallet
4511
+ * @request POST:/wallet_transactions
4512
+ * @secure
4513
+ */
4514
+ createWalletTransaction: (data: WalletTransactionCreateInput, params?: RequestParams) => Promise<HttpResponse<WalletTransactions, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
4515
+ };
4516
+ webhooks: {
4517
+ /**
4518
+ * @description This endpoint is used to retrieve the public key used to verify the webhooks signature
4519
+ *
4520
+ * @tags webhooks
4521
+ * @name FetchPublicKey
4522
+ * @summary Retrieve webhook public key
4523
+ * @request GET:/webhooks/public_key
4524
+ * @secure
4525
+ */
4526
+ fetchPublicKey: (params?: RequestParams) => Promise<HttpResponse<string, ApiErrorUnauthorized>>;
4527
+ };
4528
+ webhookEndpoints: {
4529
+ /**
4530
+ * @description This endpoint is used to create a webhook endpoint.
4531
+ *
4532
+ * @tags webhook_endpoints
4533
+ * @name CreateWebhookEndpoint
4534
+ * @summary Create a webhook_endpoint
4535
+ * @request POST:/webhook_endpoints
4536
+ * @secure
4537
+ */
4538
+ createWebhookEndpoint: (data: WebhookEndpointCreateInput, params?: RequestParams) => Promise<HttpResponse<WebhookEndpoint, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity>>;
4539
+ /**
4540
+ * @description This endpoint is used to list all webhook endpoints.
4541
+ *
4542
+ * @tags webhook_endpoints
4543
+ * @name FindAllWebhookEndpoints
4544
+ * @summary List all webhook endpoints
4545
+ * @request GET:/webhook_endpoints
4546
+ * @secure
4547
+ */
4548
+ findAllWebhookEndpoints: (query?: {
4549
+ /**
4550
+ * Page number.
4551
+ * @example 1
4552
+ */
4553
+ page?: number;
4554
+ /**
4555
+ * Number of records per page.
4556
+ * @example 20
4557
+ */
4558
+ per_page?: number;
4559
+ }, params?: RequestParams) => Promise<HttpResponse<WebhookEndpointsPaginated, ApiErrorUnauthorized>>;
4560
+ /**
4561
+ * @description This endpoint is used to update an existing webhook endpoint.
4562
+ *
4563
+ * @tags webhook_endpoints
4564
+ * @name UpdateWebhookEndpoint
4565
+ * @summary Update a webhook endpoint
4566
+ * @request PUT:/webhook_endpoints/{lago_id}
4567
+ * @secure
4568
+ */
4569
+ updateWebhookEndpoint: (lagoId: string, data: WebhookEndpointUpdateInput, params?: RequestParams) => Promise<HttpResponse<WebhookEndpoint, ApiErrorBadRequest | ApiErrorUnauthorized | ApiErrorUnprocessableEntity | ApiErrorNotFound>>;
4570
+ /**
4571
+ * @description This endpoint is used to retrieve an existing webhook endpoint.
4572
+ *
4573
+ * @tags webhook_endpoints
4574
+ * @name FindWebhookEndpoint
4575
+ * @summary Retrieve a webhook endpoint
4576
+ * @request GET:/webhook_endpoints/{lago_id}
4577
+ * @secure
4578
+ */
4579
+ findWebhookEndpoint: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<WebhookEndpoint, ApiErrorUnauthorized | ApiErrorNotFound>>;
4580
+ /**
4581
+ * @description This endpoint is used to delete an existing webhook endpoint.
4582
+ *
4583
+ * @tags webhook_endpoints
4584
+ * @name DestroyWebhookEndpoint
4585
+ * @summary Delete a webhook endpoint
4586
+ * @request DELETE:/webhook_endpoints/{lago_id}
4587
+ * @secure
4588
+ */
4589
+ destroyWebhookEndpoint: (lagoId: string, params?: RequestParams) => Promise<HttpResponse<WebhookEndpoint, ApiErrorUnauthorized | ApiErrorNotAllowed | ApiErrorNotFound>>;
4590
+ };
4591
+ }
4592
+ export {};