@leaflow/sdk 0.0.0-dev.375.gbce4ffc → 0.0.0-dev.377.gdbef936

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.
Files changed (61) hide show
  1. package/dist/billing/type/order/v1/generated/models.d.ts +10 -11
  2. package/dist/billing/type/order/v1/generated/models.js +0 -7
  3. package/dist/billing/type/order/v1/generated/validators/invoice.zod.d.ts +1 -0
  4. package/dist/billing/type/order/v1/generated/validators/invoice.zod.js +3 -2
  5. package/dist/billing/type/order/v1/generated/validators/invoiceItem.zod.d.ts +2 -7
  6. package/dist/billing/type/order/v1/generated/validators/invoiceItem.zod.js +4 -1
  7. package/dist/billing/type/order/v1/generated/validators/invoiceItemList.zod.d.ts +2 -7
  8. package/dist/billing/type/order/v1/generated/validators/invoiceList.zod.d.ts +1 -0
  9. package/dist/billing/type/order/v1/generated/validators/monthlyStatement.zod.d.ts +2 -0
  10. package/dist/billing/type/order/v1/generated/validators/monthlyStatementList.zod.d.ts +2 -0
  11. package/dist/billing/type/order/v1/generated/validators/statement.zod.d.ts +1 -0
  12. package/dist/billing/type/order/v1/generated/validators/statementAmounts.zod.d.ts +1 -0
  13. package/dist/billing/type/order/v1/generated/validators/statementAmounts.zod.js +1 -0
  14. package/dist/billing/type/order/v1/generated/validators/statementList.zod.d.ts +1 -0
  15. package/dist/billing/v1/generated/functions.d.ts +3 -2
  16. package/dist/billing/v1/generated/functions.js +3 -2
  17. package/dist/billing/v1/generated/models.d.ts +10 -11
  18. package/dist/billing/v1/generated/models.js +0 -7
  19. package/dist/billing/v1/generated/schemas.zod.d.ts +3 -2
  20. package/dist/billing/v1/generated/schemas.zod.js +3 -2
  21. package/dist/billing/v1/generated/validators/invoice.zod.d.ts +1 -0
  22. package/dist/billing/v1/generated/validators/invoice.zod.js +3 -2
  23. package/dist/billing/v1/generated/validators/invoiceItem.zod.d.ts +2 -7
  24. package/dist/billing/v1/generated/validators/invoiceItem.zod.js +4 -1
  25. package/dist/billing/v1/generated/validators/invoiceItemList.zod.d.ts +2 -7
  26. package/dist/billing/v1/generated/validators/invoiceList.zod.d.ts +1 -0
  27. package/dist/billing/v1/generated/validators/monthlyStatement.zod.d.ts +2 -0
  28. package/dist/billing/v1/generated/validators/monthlyStatementList.zod.d.ts +2 -0
  29. package/dist/billing/v1/generated/validators/statement.zod.d.ts +1 -0
  30. package/dist/billing/v1/generated/validators/statementAmounts.zod.d.ts +1 -0
  31. package/dist/billing/v1/generated/validators/statementAmounts.zod.js +1 -0
  32. package/dist/billing/v1/generated/validators/statementList.zod.d.ts +1 -0
  33. package/dist/canopy/v1/generated/models.d.ts +10 -11
  34. package/dist/canopy/v1/generated/models.js +0 -7
  35. package/dist/canopy/v1/generated/validators/invoice.zod.d.ts +1 -0
  36. package/dist/canopy/v1/generated/validators/invoice.zod.js +3 -2
  37. package/dist/canopy/v1/generated/validators/invoiceItem.zod.d.ts +2 -7
  38. package/dist/canopy/v1/generated/validators/invoiceItem.zod.js +4 -1
  39. package/dist/canopy/v1/generated/validators/invoiceItemList.zod.d.ts +2 -7
  40. package/dist/canopy/v1/generated/validators/invoiceList.zod.d.ts +1 -0
  41. package/dist/canopy/v1/generated/validators/monthlyStatement.zod.d.ts +2 -0
  42. package/dist/canopy/v1/generated/validators/monthlyStatementList.zod.d.ts +2 -0
  43. package/dist/canopy/v1/generated/validators/statement.zod.d.ts +1 -0
  44. package/dist/canopy/v1/generated/validators/statementAmounts.zod.d.ts +1 -0
  45. package/dist/canopy/v1/generated/validators/statementAmounts.zod.js +1 -0
  46. package/dist/canopy/v1/generated/validators/statementList.zod.d.ts +1 -0
  47. package/dist/membership/v1/generated/models.d.ts +10 -11
  48. package/dist/membership/v1/generated/models.js +0 -7
  49. package/dist/membership/v1/generated/validators/invoice.zod.d.ts +1 -0
  50. package/dist/membership/v1/generated/validators/invoice.zod.js +3 -2
  51. package/dist/membership/v1/generated/validators/invoiceItem.zod.d.ts +2 -7
  52. package/dist/membership/v1/generated/validators/invoiceItem.zod.js +4 -1
  53. package/dist/membership/v1/generated/validators/invoiceItemList.zod.d.ts +2 -7
  54. package/dist/membership/v1/generated/validators/invoiceList.zod.d.ts +1 -0
  55. package/dist/membership/v1/generated/validators/monthlyStatement.zod.d.ts +2 -0
  56. package/dist/membership/v1/generated/validators/monthlyStatementList.zod.d.ts +2 -0
  57. package/dist/membership/v1/generated/validators/statement.zod.d.ts +1 -0
  58. package/dist/membership/v1/generated/validators/statementAmounts.zod.d.ts +1 -0
  59. package/dist/membership/v1/generated/validators/statementAmounts.zod.js +1 -0
  60. package/dist/membership/v1/generated/validators/statementList.zod.d.ts +1 -0
  61. package/package.json +1 -1
@@ -1352,14 +1352,16 @@ export interface Invoice {
1352
1352
  tax_amount?: Money;
1353
1353
  /** Successful credit-grant payments, included in amount_paid; they do not reduce the receivable or tax base. */
1354
1354
  credit_applied?: Money;
1355
- /** Subtotal less discount plus tax. Balance and credit grants pay it; they do not reduce it. */
1355
+ /** Subtotal less discount plus tax. Balance and credit grants pay it plus rounding_amount; they do not reduce it. */
1356
1356
  total: Money;
1357
+ /** Added to total to round the amount payable to the currency's minor unit; negative when rounded down. The rounding of a usage invoice carries over to the next invoice of the same billing period. */
1358
+ rounding_amount: Money;
1357
1359
  amount_paid?: Money;
1358
1360
  /** Issued credit notes that reduced unpaid receivables; the original invoice total is unchanged. */
1359
1361
  pre_payment_credit_notes_amount: Money;
1360
1362
  /** Issued credit notes against payments already received; their refunds may not have completed. */
1361
1363
  post_payment_credit_notes_amount: Money;
1362
- /** What is still collectible after unpaid credit notes and successful payments; never below zero. Zero for a draft, whose total is the base price, and for a paid or void invoice. */
1364
+ /** What is still collectible from total plus rounding_amount after unpaid credit notes and successful payments; never below zero. Zero for a draft, whose total is the base price, and for a paid or void invoice. */
1363
1365
  amount_due: Money;
1364
1366
  /** @nullable */
1365
1367
  period_start?: string | null;
@@ -1387,14 +1389,6 @@ export interface InvoiceList {
1387
1389
  items: Invoice[];
1388
1390
  pagination: OffsetPagination;
1389
1391
  }
1390
- export type InvoiceItemType = (typeof InvoiceItemType)[keyof typeof InvoiceItemType];
1391
- export declare const InvoiceItemType: {
1392
- readonly usage: "usage";
1393
- readonly subscription: "subscription";
1394
- readonly one_time: "one_time";
1395
- readonly setup: "setup";
1396
- readonly adjustment: "adjustment";
1397
- };
1398
1392
  /**
1399
1393
  * For a usage line, the values of its meter's presentation dimensions, such as the model and token kind. Empty for other lines.
1400
1394
  */
@@ -1436,7 +1430,6 @@ export interface InvoiceItem {
1436
1430
  /** The part of tax_amount already included in amount. */
1437
1431
  tax_included_amount?: string;
1438
1432
  id: string;
1439
- type?: InvoiceItemType;
1440
1433
  /** @nullable */
1441
1434
  project_id?: string | null;
1442
1435
  /** The project the charge was for and its current name. Absent when the line has no project or the project cannot be read; `project_id` still identifies it. */
@@ -1452,6 +1445,10 @@ export interface InvoiceItem {
1452
1445
  /** The quantity `unit_amount` prices, such as 1000000 tokens or 3600 seconds: `amount` is `quantity` × `unit_amount` ÷ `unit_quantity`. Present together with `unit_amount`. */
1453
1446
  unit_quantity?: string;
1454
1447
  amount: Money;
1448
+ /** This line's share of the invoice's rounding_amount. The line's net amount is amount - discount_amount + tax_amount - tax_included_amount + rounding_amount. */
1449
+ rounding_amount: Money;
1450
+ /** Usage charges billed on this line; zero for other lines. */
1451
+ usage_charge_count: number;
1455
1452
  currency: string;
1456
1453
  /** @nullable */
1457
1454
  period_start?: string | null;
@@ -2789,6 +2786,8 @@ export interface StatementAmounts {
2789
2786
  discount_amount: Money;
2790
2787
  tax_amount: Money;
2791
2788
  total: Money;
2789
+ /** Added to total to round the invoiced amount to the currency's minor unit. Zero for an open statement's estimate. */
2790
+ rounding_amount: Money;
2792
2791
  }
2793
2792
  /**
2794
2793
  * One billing account's usage billing for one UTC calendar month, summed over its statements. Not payable itself; each statement's invoice is collected on its own.
@@ -165,13 +165,6 @@ export const InvoiceCustomerTaxExempt = {
165
165
  exempt: "exempt",
166
166
  reverse: "reverse",
167
167
  };
168
- export const InvoiceItemType = {
169
- usage: "usage",
170
- subscription: "subscription",
171
- one_time: "one_time",
172
- setup: "setup",
173
- adjustment: "adjustment",
174
- };
175
168
  export const CreditGrantStatus = {
176
169
  active: "active",
177
170
  depleted: "depleted",
@@ -36,6 +36,7 @@ export declare const Invoice: zod.ZodObject<{
36
36
  tax_amount: zod.ZodOptional<zod.ZodString>;
37
37
  credit_applied: zod.ZodOptional<zod.ZodString>;
38
38
  total: zod.ZodString;
39
+ rounding_amount: zod.ZodString;
39
40
  amount_paid: zod.ZodOptional<zod.ZodString>;
40
41
  pre_payment_credit_notes_amount: zod.ZodString;
41
42
  post_payment_credit_notes_amount: zod.ZodString;
@@ -26,11 +26,12 @@ export const Invoice = zod.strictObject({
26
26
  discount_amount: Money.optional().describe("Sum of the line discounts, taken off before tax."),
27
27
  tax_amount: Money.optional(),
28
28
  credit_applied: Money.optional().describe("Successful credit-grant payments, included in amount_paid; they do not reduce the receivable or tax base."),
29
- total: Money.describe("Subtotal less discount plus tax. Balance and credit grants pay it; they do not reduce it."),
29
+ total: Money.describe("Subtotal less discount plus tax. Balance and credit grants pay it plus rounding_amount; they do not reduce it."),
30
+ rounding_amount: Money.describe("Added to total to round the amount payable to the currency's minor unit; negative when rounded down. The rounding of a usage invoice carries over to the next invoice of the same billing period."),
30
31
  amount_paid: Money.optional(),
31
32
  pre_payment_credit_notes_amount: Money.describe("Issued credit notes that reduced unpaid receivables; the original invoice total is unchanged."),
32
33
  post_payment_credit_notes_amount: Money.describe("Issued credit notes against payments already received; their refunds may not have completed."),
33
- amount_due: Money.describe("What is still collectible after unpaid credit notes and successful payments; never below zero. Zero for a draft, whose total is the base price, and for a paid or void invoice."),
34
+ amount_due: Money.describe("What is still collectible from total plus rounding_amount after unpaid credit notes and successful payments; never below zero. Zero for a draft, whose total is the base price, and for a paid or void invoice."),
34
35
  period_start: zod.iso.datetime({ offset: true }).nullish(),
35
36
  period_end: zod.iso.datetime({ offset: true }).nullish().describe("Exclusive."),
36
37
  customer_name: zod
@@ -14,13 +14,6 @@ export declare const InvoiceItem: zod.ZodObject<{
14
14
  tax_amount: zod.ZodOptional<zod.ZodString>;
15
15
  tax_included_amount: zod.ZodOptional<zod.ZodString>;
16
16
  id: zod.ZodUUID;
17
- type: zod.ZodOptional<zod.ZodEnum<{
18
- one_time: "one_time";
19
- adjustment: "adjustment";
20
- usage: "usage";
21
- subscription: "subscription";
22
- setup: "setup";
23
- }>>;
24
17
  project_id: zod.ZodOptional<zod.ZodNullable<zod.ZodUUID>>;
25
18
  project: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
26
19
  id: zod.ZodUUID;
@@ -34,6 +27,8 @@ export declare const InvoiceItem: zod.ZodObject<{
34
27
  unit_amount: zod.ZodOptional<zod.ZodString>;
35
28
  unit_quantity: zod.ZodOptional<zod.ZodString>;
36
29
  amount: zod.ZodString;
30
+ rounding_amount: zod.ZodString;
31
+ usage_charge_count: zod.ZodInt;
37
32
  currency: zod.ZodString;
38
33
  period_start: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
39
34
  period_end: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
@@ -23,7 +23,6 @@ export const InvoiceItem = zod.strictObject({
23
23
  .optional()
24
24
  .describe("The part of tax_amount already included in amount."),
25
25
  id: zod.uuid(),
26
- type: zod.enum(["usage", "subscription", "one_time", "setup", "adjustment"]).optional(),
27
26
  project_id: zod.uuid().nullish(),
28
27
  project: zod
29
28
  .union([NamedIdentity, zod.null()])
@@ -43,6 +42,10 @@ export const InvoiceItem = zod.strictObject({
43
42
  .optional()
44
43
  .describe("The quantity `unit_amount` prices, such as 1000000 tokens or 3600 seconds: `amount` is `quantity` × `unit_amount` ÷ `unit_quantity`. Present together with `unit_amount`."),
45
44
  amount: Money,
45
+ rounding_amount: Money.describe("This line's share of the invoice's rounding_amount. The line's net amount is amount - discount_amount + tax_amount - tax_included_amount + rounding_amount."),
46
+ usage_charge_count: zod
47
+ .int()
48
+ .describe("Usage charges billed on this line; zero for other lines."),
46
49
  currency: zod.string(),
47
50
  period_start: zod.iso.datetime({ offset: true }).nullish(),
48
51
  period_end: zod.iso.datetime({ offset: true }).nullish(),
@@ -15,13 +15,6 @@ export declare const InvoiceItemList: zod.ZodObject<{
15
15
  tax_amount: zod.ZodOptional<zod.ZodString>;
16
16
  tax_included_amount: zod.ZodOptional<zod.ZodString>;
17
17
  id: zod.ZodUUID;
18
- type: zod.ZodOptional<zod.ZodEnum<{
19
- one_time: "one_time";
20
- adjustment: "adjustment";
21
- usage: "usage";
22
- subscription: "subscription";
23
- setup: "setup";
24
- }>>;
25
18
  project_id: zod.ZodOptional<zod.ZodNullable<zod.ZodUUID>>;
26
19
  project: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
27
20
  id: zod.ZodUUID;
@@ -35,6 +28,8 @@ export declare const InvoiceItemList: zod.ZodObject<{
35
28
  unit_amount: zod.ZodOptional<zod.ZodString>;
36
29
  unit_quantity: zod.ZodOptional<zod.ZodString>;
37
30
  amount: zod.ZodString;
31
+ rounding_amount: zod.ZodString;
32
+ usage_charge_count: zod.ZodInt;
38
33
  currency: zod.ZodString;
39
34
  period_start: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
40
35
  period_end: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
@@ -37,6 +37,7 @@ export declare const InvoiceList: zod.ZodObject<{
37
37
  tax_amount: zod.ZodOptional<zod.ZodString>;
38
38
  credit_applied: zod.ZodOptional<zod.ZodString>;
39
39
  total: zod.ZodString;
40
+ rounding_amount: zod.ZodString;
40
41
  amount_paid: zod.ZodOptional<zod.ZodString>;
41
42
  pre_payment_credit_notes_amount: zod.ZodString;
42
43
  post_payment_credit_notes_amount: zod.ZodString;
@@ -19,6 +19,7 @@ export declare const MonthlyStatement: zod.ZodObject<{
19
19
  discount_amount: zod.ZodString;
20
20
  tax_amount: zod.ZodString;
21
21
  total: zod.ZodString;
22
+ rounding_amount: zod.ZodString;
22
23
  }, zod.z.core.$strict>;
23
24
  credited_amount: zod.ZodString;
24
25
  unbilled: zod.ZodOptional<zod.ZodObject<{
@@ -26,6 +27,7 @@ export declare const MonthlyStatement: zod.ZodObject<{
26
27
  discount_amount: zod.ZodString;
27
28
  tax_amount: zod.ZodString;
28
29
  total: zod.ZodString;
30
+ rounding_amount: zod.ZodString;
29
31
  }, zod.z.core.$strict>>;
30
32
  credit_applied: zod.ZodString;
31
33
  amount_paid: zod.ZodString;
@@ -20,6 +20,7 @@ export declare const MonthlyStatementList: zod.ZodObject<{
20
20
  discount_amount: zod.ZodString;
21
21
  tax_amount: zod.ZodString;
22
22
  total: zod.ZodString;
23
+ rounding_amount: zod.ZodString;
23
24
  }, zod.z.core.$strict>;
24
25
  credited_amount: zod.ZodString;
25
26
  unbilled: zod.ZodOptional<zod.ZodObject<{
@@ -27,6 +28,7 @@ export declare const MonthlyStatementList: zod.ZodObject<{
27
28
  discount_amount: zod.ZodString;
28
29
  tax_amount: zod.ZodString;
29
30
  total: zod.ZodString;
31
+ rounding_amount: zod.ZodString;
30
32
  }, zod.z.core.$strict>>;
31
33
  credit_applied: zod.ZodString;
32
34
  amount_paid: zod.ZodString;
@@ -28,6 +28,7 @@ export declare const Statement: zod.ZodObject<{
28
28
  discount_amount: zod.ZodString;
29
29
  tax_amount: zod.ZodString;
30
30
  total: zod.ZodString;
31
+ rounding_amount: zod.ZodString;
31
32
  }, zod.z.core.$strict>;
32
33
  closed_at: zod.ZodOptional<zod.z.ZodISODateTime>;
33
34
  invoice_id: zod.ZodOptional<zod.ZodUUID>;
@@ -11,6 +11,7 @@ export declare const StatementAmounts: zod.ZodObject<{
11
11
  discount_amount: zod.ZodString;
12
12
  tax_amount: zod.ZodString;
13
13
  total: zod.ZodString;
14
+ rounding_amount: zod.ZodString;
14
15
  }, zod.z.core.$strict>;
15
16
  export type StatementAmounts = zod.input<typeof StatementAmounts>;
16
17
  export type StatementAmountsOutput = zod.output<typeof StatementAmounts>;
@@ -12,4 +12,5 @@ export const StatementAmounts = zod.strictObject({
12
12
  discount_amount: Money,
13
13
  tax_amount: Money,
14
14
  total: Money,
15
+ rounding_amount: Money.describe("Added to total to round the invoiced amount to the currency's minor unit. Zero for an open statement's estimate."),
15
16
  });
@@ -29,6 +29,7 @@ export declare const StatementList: zod.ZodObject<{
29
29
  discount_amount: zod.ZodString;
30
30
  tax_amount: zod.ZodString;
31
31
  total: zod.ZodString;
32
+ rounding_amount: zod.ZodString;
32
33
  }, zod.z.core.$strict>;
33
34
  closed_at: zod.ZodOptional<zod.z.ZodISODateTime>;
34
35
  invoice_id: zod.ZodOptional<zod.ZodUUID>;
@@ -750,8 +750,9 @@ export declare const getPayInvoiceUrl: (invoiceId: string) => string;
750
750
  * order; `BILLING_ORDER_EXPIRED` after the order's payment deadline; `BILLING_INVOICE_NOT_PAYABLE` with
751
751
  * `meta.reason` `subscription_canceling`, `subscription_reclaiming` or `subscription_ended` for a renewal
752
752
  * invoice whose subscription is being canceled, is being reclaimed or has ended; and
753
- * `BILLING_INVOICE_NOT_PAYABLE` with `meta.reason` `usage_invoice` for a usage invoice, which is collected from
754
- * credit grants and balance automatically, including right after a top-up.
753
+ * `BILLING_INVOICE_NOT_PAYABLE` with `meta.reason` `fractional_amount` when the amount left for the gateway is
754
+ * not a whole number of the currency's minor unit; such an invoice is collected from credit grants and balance
755
+ * automatically, including right after a top-up.
755
756
  * @summary Pay an invoice
756
757
  */
757
758
  export declare const payInvoice: (invoiceId: string, payInvoiceRequest?: PayInvoiceRequest, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<payInvoiceResponse>;
@@ -793,8 +793,9 @@ export const getPayInvoiceUrl = (invoiceId) => {
793
793
  * order; `BILLING_ORDER_EXPIRED` after the order's payment deadline; `BILLING_INVOICE_NOT_PAYABLE` with
794
794
  * `meta.reason` `subscription_canceling`, `subscription_reclaiming` or `subscription_ended` for a renewal
795
795
  * invoice whose subscription is being canceled, is being reclaimed or has ended; and
796
- * `BILLING_INVOICE_NOT_PAYABLE` with `meta.reason` `usage_invoice` for a usage invoice, which is collected from
797
- * credit grants and balance automatically, including right after a top-up.
796
+ * `BILLING_INVOICE_NOT_PAYABLE` with `meta.reason` `fractional_amount` when the amount left for the gateway is
797
+ * not a whole number of the currency's minor unit; such an invoice is collected from credit grants and balance
798
+ * automatically, including right after a top-up.
798
799
  * @summary Pay an invoice
799
800
  */
800
801
  export const payInvoice = async (invoiceId, payInvoiceRequest, options, fetchFn) => {
@@ -1141,14 +1141,16 @@ export interface Invoice {
1141
1141
  tax_amount?: Money;
1142
1142
  /** Successful credit-grant payments, included in amount_paid; they do not reduce the receivable or tax base. */
1143
1143
  credit_applied?: Money;
1144
- /** Subtotal less discount plus tax. Balance and credit grants pay it; they do not reduce it. */
1144
+ /** Subtotal less discount plus tax. Balance and credit grants pay it plus rounding_amount; they do not reduce it. */
1145
1145
  total: Money;
1146
+ /** Added to total to round the amount payable to the currency's minor unit; negative when rounded down. The rounding of a usage invoice carries over to the next invoice of the same billing period. */
1147
+ rounding_amount: Money;
1146
1148
  amount_paid?: Money;
1147
1149
  /** Issued credit notes that reduced unpaid receivables; the original invoice total is unchanged. */
1148
1150
  pre_payment_credit_notes_amount: Money;
1149
1151
  /** Issued credit notes against payments already received; their refunds may not have completed. */
1150
1152
  post_payment_credit_notes_amount: Money;
1151
- /** What is still collectible after unpaid credit notes and successful payments; never below zero. Zero for a draft, whose total is the base price, and for a paid or void invoice. */
1153
+ /** What is still collectible from total plus rounding_amount after unpaid credit notes and successful payments; never below zero. Zero for a draft, whose total is the base price, and for a paid or void invoice. */
1152
1154
  amount_due: Money;
1153
1155
  /** @nullable */
1154
1156
  period_start?: string | null;
@@ -1176,14 +1178,6 @@ export interface InvoiceList {
1176
1178
  items: Invoice[];
1177
1179
  pagination: OffsetPagination;
1178
1180
  }
1179
- export type InvoiceItemType = (typeof InvoiceItemType)[keyof typeof InvoiceItemType];
1180
- export declare const InvoiceItemType: {
1181
- readonly usage: "usage";
1182
- readonly subscription: "subscription";
1183
- readonly one_time: "one_time";
1184
- readonly setup: "setup";
1185
- readonly adjustment: "adjustment";
1186
- };
1187
1181
  /**
1188
1182
  * For a usage line, the values of its meter's presentation dimensions, such as the model and token kind. Empty for other lines.
1189
1183
  */
@@ -1225,7 +1219,6 @@ export interface InvoiceItem {
1225
1219
  /** The part of tax_amount already included in amount. */
1226
1220
  tax_included_amount?: string;
1227
1221
  id: string;
1228
- type?: InvoiceItemType;
1229
1222
  /** @nullable */
1230
1223
  project_id?: string | null;
1231
1224
  /** The project the charge was for and its current name. Absent when the line has no project or the project cannot be read; `project_id` still identifies it. */
@@ -1241,6 +1234,10 @@ export interface InvoiceItem {
1241
1234
  /** The quantity `unit_amount` prices, such as 1000000 tokens or 3600 seconds: `amount` is `quantity` × `unit_amount` ÷ `unit_quantity`. Present together with `unit_amount`. */
1242
1235
  unit_quantity?: string;
1243
1236
  amount: Money;
1237
+ /** This line's share of the invoice's rounding_amount. The line's net amount is amount - discount_amount + tax_amount - tax_included_amount + rounding_amount. */
1238
+ rounding_amount: Money;
1239
+ /** Usage charges billed on this line; zero for other lines. */
1240
+ usage_charge_count: number;
1244
1241
  currency: string;
1245
1242
  /** @nullable */
1246
1243
  period_start?: string | null;
@@ -2773,6 +2770,8 @@ export interface StatementAmounts {
2773
2770
  discount_amount: Money;
2774
2771
  tax_amount: Money;
2775
2772
  total: Money;
2773
+ /** Added to total to round the invoiced amount to the currency's minor unit. Zero for an open statement's estimate. */
2774
+ rounding_amount: Money;
2776
2775
  }
2777
2776
  /**
2778
2777
  * One billing account's usage billing for one UTC calendar month, summed over its statements. Not payable itself; each statement's invoice is collected on its own.
@@ -151,13 +151,6 @@ export const InvoiceCustomerTaxExempt = {
151
151
  exempt: "exempt",
152
152
  reverse: "reverse",
153
153
  };
154
- export const InvoiceItemType = {
155
- usage: "usage",
156
- subscription: "subscription",
157
- one_time: "one_time",
158
- setup: "setup",
159
- adjustment: "adjustment",
160
- };
161
154
  export const CreditGrantStatus = {
162
155
  active: "active",
163
156
  depleted: "depleted",
@@ -369,8 +369,9 @@ export declare const DeletePaymentMethodParams: zod.ZodObject<{
369
369
  * order; `BILLING_ORDER_EXPIRED` after the order's payment deadline; `BILLING_INVOICE_NOT_PAYABLE` with
370
370
  * `meta.reason` `subscription_canceling`, `subscription_reclaiming` or `subscription_ended` for a renewal
371
371
  * invoice whose subscription is being canceled, is being reclaimed or has ended; and
372
- * `BILLING_INVOICE_NOT_PAYABLE` with `meta.reason` `usage_invoice` for a usage invoice, which is collected from
373
- * credit grants and balance automatically, including right after a top-up.
372
+ * `BILLING_INVOICE_NOT_PAYABLE` with `meta.reason` `fractional_amount` when the amount left for the gateway is
373
+ * not a whole number of the currency's minor unit; such an invoice is collected from credit grants and balance
374
+ * automatically, including right after a top-up.
374
375
  * @summary Pay an invoice
375
376
  */
376
377
  export declare const PayInvoiceParams: zod.ZodObject<{
@@ -433,8 +433,9 @@ export const DeletePaymentMethodParams = zod.strictObject({
433
433
  * order; `BILLING_ORDER_EXPIRED` after the order's payment deadline; `BILLING_INVOICE_NOT_PAYABLE` with
434
434
  * `meta.reason` `subscription_canceling`, `subscription_reclaiming` or `subscription_ended` for a renewal
435
435
  * invoice whose subscription is being canceled, is being reclaimed or has ended; and
436
- * `BILLING_INVOICE_NOT_PAYABLE` with `meta.reason` `usage_invoice` for a usage invoice, which is collected from
437
- * credit grants and balance automatically, including right after a top-up.
436
+ * `BILLING_INVOICE_NOT_PAYABLE` with `meta.reason` `fractional_amount` when the amount left for the gateway is
437
+ * not a whole number of the currency's minor unit; such an invoice is collected from credit grants and balance
438
+ * automatically, including right after a top-up.
438
439
  * @summary Pay an invoice
439
440
  */
440
441
  export const PayInvoiceParams = zod.strictObject({
@@ -36,6 +36,7 @@ export declare const Invoice: zod.ZodObject<{
36
36
  tax_amount: zod.ZodOptional<zod.ZodString>;
37
37
  credit_applied: zod.ZodOptional<zod.ZodString>;
38
38
  total: zod.ZodString;
39
+ rounding_amount: zod.ZodString;
39
40
  amount_paid: zod.ZodOptional<zod.ZodString>;
40
41
  pre_payment_credit_notes_amount: zod.ZodString;
41
42
  post_payment_credit_notes_amount: zod.ZodString;
@@ -26,11 +26,12 @@ export const Invoice = zod.strictObject({
26
26
  discount_amount: Money.optional().describe("Sum of the line discounts, taken off before tax."),
27
27
  tax_amount: Money.optional(),
28
28
  credit_applied: Money.optional().describe("Successful credit-grant payments, included in amount_paid; they do not reduce the receivable or tax base."),
29
- total: Money.describe("Subtotal less discount plus tax. Balance and credit grants pay it; they do not reduce it."),
29
+ total: Money.describe("Subtotal less discount plus tax. Balance and credit grants pay it plus rounding_amount; they do not reduce it."),
30
+ rounding_amount: Money.describe("Added to total to round the amount payable to the currency's minor unit; negative when rounded down. The rounding of a usage invoice carries over to the next invoice of the same billing period."),
30
31
  amount_paid: Money.optional(),
31
32
  pre_payment_credit_notes_amount: Money.describe("Issued credit notes that reduced unpaid receivables; the original invoice total is unchanged."),
32
33
  post_payment_credit_notes_amount: Money.describe("Issued credit notes against payments already received; their refunds may not have completed."),
33
- amount_due: Money.describe("What is still collectible after unpaid credit notes and successful payments; never below zero. Zero for a draft, whose total is the base price, and for a paid or void invoice."),
34
+ amount_due: Money.describe("What is still collectible from total plus rounding_amount after unpaid credit notes and successful payments; never below zero. Zero for a draft, whose total is the base price, and for a paid or void invoice."),
34
35
  period_start: zod.iso.datetime({ offset: true }).nullish(),
35
36
  period_end: zod.iso.datetime({ offset: true }).nullish().describe("Exclusive."),
36
37
  customer_name: zod
@@ -14,13 +14,6 @@ export declare const InvoiceItem: zod.ZodObject<{
14
14
  tax_amount: zod.ZodOptional<zod.ZodString>;
15
15
  tax_included_amount: zod.ZodOptional<zod.ZodString>;
16
16
  id: zod.ZodUUID;
17
- type: zod.ZodOptional<zod.ZodEnum<{
18
- one_time: "one_time";
19
- adjustment: "adjustment";
20
- usage: "usage";
21
- subscription: "subscription";
22
- setup: "setup";
23
- }>>;
24
17
  project_id: zod.ZodOptional<zod.ZodNullable<zod.ZodUUID>>;
25
18
  project: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
26
19
  id: zod.ZodUUID;
@@ -34,6 +27,8 @@ export declare const InvoiceItem: zod.ZodObject<{
34
27
  unit_amount: zod.ZodOptional<zod.ZodString>;
35
28
  unit_quantity: zod.ZodOptional<zod.ZodString>;
36
29
  amount: zod.ZodString;
30
+ rounding_amount: zod.ZodString;
31
+ usage_charge_count: zod.ZodInt;
37
32
  currency: zod.ZodString;
38
33
  period_start: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
39
34
  period_end: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
@@ -23,7 +23,6 @@ export const InvoiceItem = zod.strictObject({
23
23
  .optional()
24
24
  .describe("The part of tax_amount already included in amount."),
25
25
  id: zod.uuid(),
26
- type: zod.enum(["usage", "subscription", "one_time", "setup", "adjustment"]).optional(),
27
26
  project_id: zod.uuid().nullish(),
28
27
  project: zod
29
28
  .union([NamedIdentity, zod.null()])
@@ -43,6 +42,10 @@ export const InvoiceItem = zod.strictObject({
43
42
  .optional()
44
43
  .describe("The quantity `unit_amount` prices, such as 1000000 tokens or 3600 seconds: `amount` is `quantity` × `unit_amount` ÷ `unit_quantity`. Present together with `unit_amount`."),
45
44
  amount: Money,
45
+ rounding_amount: Money.describe("This line's share of the invoice's rounding_amount. The line's net amount is amount - discount_amount + tax_amount - tax_included_amount + rounding_amount."),
46
+ usage_charge_count: zod
47
+ .int()
48
+ .describe("Usage charges billed on this line; zero for other lines."),
46
49
  currency: zod.string(),
47
50
  period_start: zod.iso.datetime({ offset: true }).nullish(),
48
51
  period_end: zod.iso.datetime({ offset: true }).nullish(),
@@ -15,13 +15,6 @@ export declare const InvoiceItemList: zod.ZodObject<{
15
15
  tax_amount: zod.ZodOptional<zod.ZodString>;
16
16
  tax_included_amount: zod.ZodOptional<zod.ZodString>;
17
17
  id: zod.ZodUUID;
18
- type: zod.ZodOptional<zod.ZodEnum<{
19
- one_time: "one_time";
20
- adjustment: "adjustment";
21
- usage: "usage";
22
- subscription: "subscription";
23
- setup: "setup";
24
- }>>;
25
18
  project_id: zod.ZodOptional<zod.ZodNullable<zod.ZodUUID>>;
26
19
  project: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
27
20
  id: zod.ZodUUID;
@@ -35,6 +28,8 @@ export declare const InvoiceItemList: zod.ZodObject<{
35
28
  unit_amount: zod.ZodOptional<zod.ZodString>;
36
29
  unit_quantity: zod.ZodOptional<zod.ZodString>;
37
30
  amount: zod.ZodString;
31
+ rounding_amount: zod.ZodString;
32
+ usage_charge_count: zod.ZodInt;
38
33
  currency: zod.ZodString;
39
34
  period_start: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
40
35
  period_end: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
@@ -37,6 +37,7 @@ export declare const InvoiceList: zod.ZodObject<{
37
37
  tax_amount: zod.ZodOptional<zod.ZodString>;
38
38
  credit_applied: zod.ZodOptional<zod.ZodString>;
39
39
  total: zod.ZodString;
40
+ rounding_amount: zod.ZodString;
40
41
  amount_paid: zod.ZodOptional<zod.ZodString>;
41
42
  pre_payment_credit_notes_amount: zod.ZodString;
42
43
  post_payment_credit_notes_amount: zod.ZodString;
@@ -19,6 +19,7 @@ export declare const MonthlyStatement: zod.ZodObject<{
19
19
  discount_amount: zod.ZodString;
20
20
  tax_amount: zod.ZodString;
21
21
  total: zod.ZodString;
22
+ rounding_amount: zod.ZodString;
22
23
  }, zod.z.core.$strict>;
23
24
  credited_amount: zod.ZodString;
24
25
  unbilled: zod.ZodOptional<zod.ZodObject<{
@@ -26,6 +27,7 @@ export declare const MonthlyStatement: zod.ZodObject<{
26
27
  discount_amount: zod.ZodString;
27
28
  tax_amount: zod.ZodString;
28
29
  total: zod.ZodString;
30
+ rounding_amount: zod.ZodString;
29
31
  }, zod.z.core.$strict>>;
30
32
  credit_applied: zod.ZodString;
31
33
  amount_paid: zod.ZodString;
@@ -20,6 +20,7 @@ export declare const MonthlyStatementList: zod.ZodObject<{
20
20
  discount_amount: zod.ZodString;
21
21
  tax_amount: zod.ZodString;
22
22
  total: zod.ZodString;
23
+ rounding_amount: zod.ZodString;
23
24
  }, zod.z.core.$strict>;
24
25
  credited_amount: zod.ZodString;
25
26
  unbilled: zod.ZodOptional<zod.ZodObject<{
@@ -27,6 +28,7 @@ export declare const MonthlyStatementList: zod.ZodObject<{
27
28
  discount_amount: zod.ZodString;
28
29
  tax_amount: zod.ZodString;
29
30
  total: zod.ZodString;
31
+ rounding_amount: zod.ZodString;
30
32
  }, zod.z.core.$strict>>;
31
33
  credit_applied: zod.ZodString;
32
34
  amount_paid: zod.ZodString;
@@ -28,6 +28,7 @@ export declare const Statement: zod.ZodObject<{
28
28
  discount_amount: zod.ZodString;
29
29
  tax_amount: zod.ZodString;
30
30
  total: zod.ZodString;
31
+ rounding_amount: zod.ZodString;
31
32
  }, zod.z.core.$strict>;
32
33
  closed_at: zod.ZodOptional<zod.z.ZodISODateTime>;
33
34
  invoice_id: zod.ZodOptional<zod.ZodUUID>;
@@ -11,6 +11,7 @@ export declare const StatementAmounts: zod.ZodObject<{
11
11
  discount_amount: zod.ZodString;
12
12
  tax_amount: zod.ZodString;
13
13
  total: zod.ZodString;
14
+ rounding_amount: zod.ZodString;
14
15
  }, zod.z.core.$strict>;
15
16
  export type StatementAmounts = zod.input<typeof StatementAmounts>;
16
17
  export type StatementAmountsOutput = zod.output<typeof StatementAmounts>;
@@ -12,4 +12,5 @@ export const StatementAmounts = zod.strictObject({
12
12
  discount_amount: Money,
13
13
  tax_amount: Money,
14
14
  total: Money,
15
+ rounding_amount: Money.describe("Added to total to round the invoiced amount to the currency's minor unit. Zero for an open statement's estimate."),
15
16
  });
@@ -29,6 +29,7 @@ export declare const StatementList: zod.ZodObject<{
29
29
  discount_amount: zod.ZodString;
30
30
  tax_amount: zod.ZodString;
31
31
  total: zod.ZodString;
32
+ rounding_amount: zod.ZodString;
32
33
  }, zod.z.core.$strict>;
33
34
  closed_at: zod.ZodOptional<zod.z.ZodISODateTime>;
34
35
  invoice_id: zod.ZodOptional<zod.ZodUUID>;
@@ -2043,14 +2043,16 @@ export interface Invoice {
2043
2043
  tax_amount?: Money;
2044
2044
  /** Successful credit-grant payments, included in amount_paid; they do not reduce the receivable or tax base. */
2045
2045
  credit_applied?: Money;
2046
- /** Subtotal less discount plus tax. Balance and credit grants pay it; they do not reduce it. */
2046
+ /** Subtotal less discount plus tax. Balance and credit grants pay it plus rounding_amount; they do not reduce it. */
2047
2047
  total: Money;
2048
+ /** Added to total to round the amount payable to the currency's minor unit; negative when rounded down. The rounding of a usage invoice carries over to the next invoice of the same billing period. */
2049
+ rounding_amount: Money;
2048
2050
  amount_paid?: Money;
2049
2051
  /** Issued credit notes that reduced unpaid receivables; the original invoice total is unchanged. */
2050
2052
  pre_payment_credit_notes_amount: Money;
2051
2053
  /** Issued credit notes against payments already received; their refunds may not have completed. */
2052
2054
  post_payment_credit_notes_amount: Money;
2053
- /** What is still collectible after unpaid credit notes and successful payments; never below zero. Zero for a draft, whose total is the base price, and for a paid or void invoice. */
2055
+ /** What is still collectible from total plus rounding_amount after unpaid credit notes and successful payments; never below zero. Zero for a draft, whose total is the base price, and for a paid or void invoice. */
2054
2056
  amount_due: Money;
2055
2057
  /** @nullable */
2056
2058
  period_start?: string | null;
@@ -2078,14 +2080,6 @@ export interface InvoiceList {
2078
2080
  items: Invoice[];
2079
2081
  pagination: OffsetPagination;
2080
2082
  }
2081
- export type InvoiceItemType = (typeof InvoiceItemType)[keyof typeof InvoiceItemType];
2082
- export declare const InvoiceItemType: {
2083
- readonly usage: "usage";
2084
- readonly subscription: "subscription";
2085
- readonly one_time: "one_time";
2086
- readonly setup: "setup";
2087
- readonly adjustment: "adjustment";
2088
- };
2089
2083
  /**
2090
2084
  * For a usage line, the values of its meter's presentation dimensions, such as the model and token kind. Empty for other lines.
2091
2085
  */
@@ -2127,7 +2121,6 @@ export interface InvoiceItem {
2127
2121
  /** The part of tax_amount already included in amount. */
2128
2122
  tax_included_amount?: string;
2129
2123
  id: string;
2130
- type?: InvoiceItemType;
2131
2124
  /** @nullable */
2132
2125
  project_id?: string | null;
2133
2126
  /** The project the charge was for and its current name. Absent when the line has no project or the project cannot be read; `project_id` still identifies it. */
@@ -2143,6 +2136,10 @@ export interface InvoiceItem {
2143
2136
  /** The quantity `unit_amount` prices, such as 1000000 tokens or 3600 seconds: `amount` is `quantity` × `unit_amount` ÷ `unit_quantity`. Present together with `unit_amount`. */
2144
2137
  unit_quantity?: string;
2145
2138
  amount: Money;
2139
+ /** This line's share of the invoice's rounding_amount. The line's net amount is amount - discount_amount + tax_amount - tax_included_amount + rounding_amount. */
2140
+ rounding_amount: Money;
2141
+ /** Usage charges billed on this line; zero for other lines. */
2142
+ usage_charge_count: number;
2146
2143
  currency: string;
2147
2144
  /** @nullable */
2148
2145
  period_start?: string | null;
@@ -3480,6 +3477,8 @@ export interface StatementAmounts {
3480
3477
  discount_amount: Money;
3481
3478
  tax_amount: Money;
3482
3479
  total: Money;
3480
+ /** Added to total to round the invoiced amount to the currency's minor unit. Zero for an open statement's estimate. */
3481
+ rounding_amount: Money;
3483
3482
  }
3484
3483
  /**
3485
3484
  * One billing account's usage billing for one UTC calendar month, summed over its statements. Not payable itself; each statement's invoice is collected on its own.
@@ -239,13 +239,6 @@ export const InvoiceCustomerTaxExempt = {
239
239
  exempt: "exempt",
240
240
  reverse: "reverse",
241
241
  };
242
- export const InvoiceItemType = {
243
- usage: "usage",
244
- subscription: "subscription",
245
- one_time: "one_time",
246
- setup: "setup",
247
- adjustment: "adjustment",
248
- };
249
242
  export const CreditGrantStatus = {
250
243
  active: "active",
251
244
  depleted: "depleted",
@@ -69,6 +69,7 @@ export declare const Invoice: zod.ZodObject<{
69
69
  tax_amount: zod.ZodOptional<zod.ZodString>;
70
70
  credit_applied: zod.ZodOptional<zod.ZodString>;
71
71
  total: zod.ZodString;
72
+ rounding_amount: zod.ZodString;
72
73
  amount_paid: zod.ZodOptional<zod.ZodString>;
73
74
  pre_payment_credit_notes_amount: zod.ZodString;
74
75
  post_payment_credit_notes_amount: zod.ZodString;
@@ -59,11 +59,12 @@ export const Invoice = zod.strictObject({
59
59
  discount_amount: Money.optional().describe("Sum of the line discounts, taken off before tax."),
60
60
  tax_amount: Money.optional(),
61
61
  credit_applied: Money.optional().describe("Successful credit-grant payments, included in amount_paid; they do not reduce the receivable or tax base."),
62
- total: Money.describe("Subtotal less discount plus tax. Balance and credit grants pay it; they do not reduce it."),
62
+ total: Money.describe("Subtotal less discount plus tax. Balance and credit grants pay it plus rounding_amount; they do not reduce it."),
63
+ rounding_amount: Money.describe("Added to total to round the amount payable to the currency's minor unit; negative when rounded down. The rounding of a usage invoice carries over to the next invoice of the same billing period."),
63
64
  amount_paid: Money.optional(),
64
65
  pre_payment_credit_notes_amount: Money.describe("Issued credit notes that reduced unpaid receivables; the original invoice total is unchanged."),
65
66
  post_payment_credit_notes_amount: Money.describe("Issued credit notes against payments already received; their refunds may not have completed."),
66
- amount_due: Money.describe("What is still collectible after unpaid credit notes and successful payments; never below zero. Zero for a draft, whose total is the base price, and for a paid or void invoice."),
67
+ amount_due: Money.describe("What is still collectible from total plus rounding_amount after unpaid credit notes and successful payments; never below zero. Zero for a draft, whose total is the base price, and for a paid or void invoice."),
67
68
  period_start: zod.iso.datetime({ offset: true }).nullish(),
68
69
  period_end: zod.iso.datetime({ offset: true }).nullish().describe("Exclusive."),
69
70
  customer_name: zod
@@ -47,13 +47,6 @@ export declare const InvoiceItem: zod.ZodObject<{
47
47
  tax_amount: zod.ZodOptional<zod.ZodString>;
48
48
  tax_included_amount: zod.ZodOptional<zod.ZodString>;
49
49
  id: zod.ZodUUID;
50
- type: zod.ZodOptional<zod.ZodEnum<{
51
- one_time: "one_time";
52
- adjustment: "adjustment";
53
- usage: "usage";
54
- subscription: "subscription";
55
- setup: "setup";
56
- }>>;
57
50
  project_id: zod.ZodOptional<zod.ZodNullable<zod.ZodUUID>>;
58
51
  project: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
59
52
  id: zod.ZodUUID;
@@ -67,6 +60,8 @@ export declare const InvoiceItem: zod.ZodObject<{
67
60
  unit_amount: zod.ZodOptional<zod.ZodString>;
68
61
  unit_quantity: zod.ZodOptional<zod.ZodString>;
69
62
  amount: zod.ZodString;
63
+ rounding_amount: zod.ZodString;
64
+ usage_charge_count: zod.ZodInt;
70
65
  currency: zod.ZodString;
71
66
  period_start: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
72
67
  period_end: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
@@ -56,7 +56,6 @@ export const InvoiceItem = zod.strictObject({
56
56
  .optional()
57
57
  .describe("The part of tax_amount already included in amount."),
58
58
  id: zod.uuid(),
59
- type: zod.enum(["usage", "subscription", "one_time", "setup", "adjustment"]).optional(),
60
59
  project_id: zod.uuid().nullish(),
61
60
  project: zod
62
61
  .union([NamedIdentity, zod.null()])
@@ -76,6 +75,10 @@ export const InvoiceItem = zod.strictObject({
76
75
  .optional()
77
76
  .describe("The quantity `unit_amount` prices, such as 1000000 tokens or 3600 seconds: `amount` is `quantity` × `unit_amount` ÷ `unit_quantity`. Present together with `unit_amount`."),
78
77
  amount: Money,
78
+ rounding_amount: Money.describe("This line's share of the invoice's rounding_amount. The line's net amount is amount - discount_amount + tax_amount - tax_included_amount + rounding_amount."),
79
+ usage_charge_count: zod
80
+ .int()
81
+ .describe("Usage charges billed on this line; zero for other lines."),
79
82
  currency: zod.string(),
80
83
  period_start: zod.iso.datetime({ offset: true }).nullish(),
81
84
  period_end: zod.iso.datetime({ offset: true }).nullish(),
@@ -48,13 +48,6 @@ export declare const InvoiceItemList: zod.ZodObject<{
48
48
  tax_amount: zod.ZodOptional<zod.ZodString>;
49
49
  tax_included_amount: zod.ZodOptional<zod.ZodString>;
50
50
  id: zod.ZodUUID;
51
- type: zod.ZodOptional<zod.ZodEnum<{
52
- one_time: "one_time";
53
- adjustment: "adjustment";
54
- usage: "usage";
55
- subscription: "subscription";
56
- setup: "setup";
57
- }>>;
58
51
  project_id: zod.ZodOptional<zod.ZodNullable<zod.ZodUUID>>;
59
52
  project: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
60
53
  id: zod.ZodUUID;
@@ -68,6 +61,8 @@ export declare const InvoiceItemList: zod.ZodObject<{
68
61
  unit_amount: zod.ZodOptional<zod.ZodString>;
69
62
  unit_quantity: zod.ZodOptional<zod.ZodString>;
70
63
  amount: zod.ZodString;
64
+ rounding_amount: zod.ZodString;
65
+ usage_charge_count: zod.ZodInt;
71
66
  currency: zod.ZodString;
72
67
  period_start: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
73
68
  period_end: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
@@ -70,6 +70,7 @@ export declare const InvoiceList: zod.ZodObject<{
70
70
  tax_amount: zod.ZodOptional<zod.ZodString>;
71
71
  credit_applied: zod.ZodOptional<zod.ZodString>;
72
72
  total: zod.ZodString;
73
+ rounding_amount: zod.ZodString;
73
74
  amount_paid: zod.ZodOptional<zod.ZodString>;
74
75
  pre_payment_credit_notes_amount: zod.ZodString;
75
76
  post_payment_credit_notes_amount: zod.ZodString;
@@ -52,6 +52,7 @@ export declare const MonthlyStatement: zod.ZodObject<{
52
52
  discount_amount: zod.ZodString;
53
53
  tax_amount: zod.ZodString;
54
54
  total: zod.ZodString;
55
+ rounding_amount: zod.ZodString;
55
56
  }, zod.z.core.$strict>;
56
57
  credited_amount: zod.ZodString;
57
58
  unbilled: zod.ZodOptional<zod.ZodObject<{
@@ -59,6 +60,7 @@ export declare const MonthlyStatement: zod.ZodObject<{
59
60
  discount_amount: zod.ZodString;
60
61
  tax_amount: zod.ZodString;
61
62
  total: zod.ZodString;
63
+ rounding_amount: zod.ZodString;
62
64
  }, zod.z.core.$strict>>;
63
65
  credit_applied: zod.ZodString;
64
66
  amount_paid: zod.ZodString;
@@ -53,6 +53,7 @@ export declare const MonthlyStatementList: zod.ZodObject<{
53
53
  discount_amount: zod.ZodString;
54
54
  tax_amount: zod.ZodString;
55
55
  total: zod.ZodString;
56
+ rounding_amount: zod.ZodString;
56
57
  }, zod.z.core.$strict>;
57
58
  credited_amount: zod.ZodString;
58
59
  unbilled: zod.ZodOptional<zod.ZodObject<{
@@ -60,6 +61,7 @@ export declare const MonthlyStatementList: zod.ZodObject<{
60
61
  discount_amount: zod.ZodString;
61
62
  tax_amount: zod.ZodString;
62
63
  total: zod.ZodString;
64
+ rounding_amount: zod.ZodString;
63
65
  }, zod.z.core.$strict>>;
64
66
  credit_applied: zod.ZodString;
65
67
  amount_paid: zod.ZodString;
@@ -61,6 +61,7 @@ export declare const Statement: zod.ZodObject<{
61
61
  discount_amount: zod.ZodString;
62
62
  tax_amount: zod.ZodString;
63
63
  total: zod.ZodString;
64
+ rounding_amount: zod.ZodString;
64
65
  }, zod.z.core.$strict>;
65
66
  closed_at: zod.ZodOptional<zod.z.ZodISODateTime>;
66
67
  invoice_id: zod.ZodOptional<zod.ZodUUID>;
@@ -44,6 +44,7 @@ export declare const StatementAmounts: zod.ZodObject<{
44
44
  discount_amount: zod.ZodString;
45
45
  tax_amount: zod.ZodString;
46
46
  total: zod.ZodString;
47
+ rounding_amount: zod.ZodString;
47
48
  }, zod.z.core.$strict>;
48
49
  export type StatementAmounts = zod.input<typeof StatementAmounts>;
49
50
  export type StatementAmountsOutput = zod.output<typeof StatementAmounts>;
@@ -45,4 +45,5 @@ export const StatementAmounts = zod.strictObject({
45
45
  discount_amount: Money,
46
46
  tax_amount: Money,
47
47
  total: Money,
48
+ rounding_amount: Money.describe("Added to total to round the invoiced amount to the currency's minor unit. Zero for an open statement's estimate."),
48
49
  });
@@ -62,6 +62,7 @@ export declare const StatementList: zod.ZodObject<{
62
62
  discount_amount: zod.ZodString;
63
63
  tax_amount: zod.ZodString;
64
64
  total: zod.ZodString;
65
+ rounding_amount: zod.ZodString;
65
66
  }, zod.z.core.$strict>;
66
67
  closed_at: zod.ZodOptional<zod.z.ZodISODateTime>;
67
68
  invoice_id: zod.ZodOptional<zod.ZodUUID>;
@@ -1647,14 +1647,16 @@ export interface Invoice {
1647
1647
  tax_amount?: Money;
1648
1648
  /** Successful credit-grant payments, included in amount_paid; they do not reduce the receivable or tax base. */
1649
1649
  credit_applied?: Money;
1650
- /** Subtotal less discount plus tax. Balance and credit grants pay it; they do not reduce it. */
1650
+ /** Subtotal less discount plus tax. Balance and credit grants pay it plus rounding_amount; they do not reduce it. */
1651
1651
  total: Money;
1652
+ /** Added to total to round the amount payable to the currency's minor unit; negative when rounded down. The rounding of a usage invoice carries over to the next invoice of the same billing period. */
1653
+ rounding_amount: Money;
1652
1654
  amount_paid?: Money;
1653
1655
  /** Issued credit notes that reduced unpaid receivables; the original invoice total is unchanged. */
1654
1656
  pre_payment_credit_notes_amount: Money;
1655
1657
  /** Issued credit notes against payments already received; their refunds may not have completed. */
1656
1658
  post_payment_credit_notes_amount: Money;
1657
- /** What is still collectible after unpaid credit notes and successful payments; never below zero. Zero for a draft, whose total is the base price, and for a paid or void invoice. */
1659
+ /** What is still collectible from total plus rounding_amount after unpaid credit notes and successful payments; never below zero. Zero for a draft, whose total is the base price, and for a paid or void invoice. */
1658
1660
  amount_due: Money;
1659
1661
  /** @nullable */
1660
1662
  period_start?: string | null;
@@ -1682,14 +1684,6 @@ export interface InvoiceList {
1682
1684
  items: Invoice[];
1683
1685
  pagination: OffsetPagination;
1684
1686
  }
1685
- export type InvoiceItemType = (typeof InvoiceItemType)[keyof typeof InvoiceItemType];
1686
- export declare const InvoiceItemType: {
1687
- readonly usage: "usage";
1688
- readonly subscription: "subscription";
1689
- readonly one_time: "one_time";
1690
- readonly setup: "setup";
1691
- readonly adjustment: "adjustment";
1692
- };
1693
1687
  /**
1694
1688
  * For a usage line, the values of its meter's presentation dimensions, such as the model and token kind. Empty for other lines.
1695
1689
  */
@@ -1731,7 +1725,6 @@ export interface InvoiceItem {
1731
1725
  /** The part of tax_amount already included in amount. */
1732
1726
  tax_included_amount?: string;
1733
1727
  id: string;
1734
- type?: InvoiceItemType;
1735
1728
  /** @nullable */
1736
1729
  project_id?: string | null;
1737
1730
  /** The project the charge was for and its current name. Absent when the line has no project or the project cannot be read; `project_id` still identifies it. */
@@ -1747,6 +1740,10 @@ export interface InvoiceItem {
1747
1740
  /** The quantity `unit_amount` prices, such as 1000000 tokens or 3600 seconds: `amount` is `quantity` × `unit_amount` ÷ `unit_quantity`. Present together with `unit_amount`. */
1748
1741
  unit_quantity?: string;
1749
1742
  amount: Money;
1743
+ /** This line's share of the invoice's rounding_amount. The line's net amount is amount - discount_amount + tax_amount - tax_included_amount + rounding_amount. */
1744
+ rounding_amount: Money;
1745
+ /** Usage charges billed on this line; zero for other lines. */
1746
+ usage_charge_count: number;
1750
1747
  currency: string;
1751
1748
  /** @nullable */
1752
1749
  period_start?: string | null;
@@ -3086,6 +3083,8 @@ export interface StatementAmounts {
3086
3083
  discount_amount: Money;
3087
3084
  tax_amount: Money;
3088
3085
  total: Money;
3086
+ /** Added to total to round the invoiced amount to the currency's minor unit. Zero for an open statement's estimate. */
3087
+ rounding_amount: Money;
3089
3088
  }
3090
3089
  /**
3091
3090
  * One billing account's usage billing for one UTC calendar month, summed over its statements. Not payable itself; each statement's invoice is collected on its own.
@@ -206,13 +206,6 @@ export const InvoiceCustomerTaxExempt = {
206
206
  exempt: "exempt",
207
207
  reverse: "reverse",
208
208
  };
209
- export const InvoiceItemType = {
210
- usage: "usage",
211
- subscription: "subscription",
212
- one_time: "one_time",
213
- setup: "setup",
214
- adjustment: "adjustment",
215
- };
216
209
  export const CreditGrantStatus = {
217
210
  active: "active",
218
211
  depleted: "depleted",
@@ -36,6 +36,7 @@ export declare const Invoice: zod.ZodObject<{
36
36
  tax_amount: zod.ZodOptional<zod.ZodString>;
37
37
  credit_applied: zod.ZodOptional<zod.ZodString>;
38
38
  total: zod.ZodString;
39
+ rounding_amount: zod.ZodString;
39
40
  amount_paid: zod.ZodOptional<zod.ZodString>;
40
41
  pre_payment_credit_notes_amount: zod.ZodString;
41
42
  post_payment_credit_notes_amount: zod.ZodString;
@@ -26,11 +26,12 @@ export const Invoice = zod.strictObject({
26
26
  discount_amount: Money.optional().describe("Sum of the line discounts, taken off before tax."),
27
27
  tax_amount: Money.optional(),
28
28
  credit_applied: Money.optional().describe("Successful credit-grant payments, included in amount_paid; they do not reduce the receivable or tax base."),
29
- total: Money.describe("Subtotal less discount plus tax. Balance and credit grants pay it; they do not reduce it."),
29
+ total: Money.describe("Subtotal less discount plus tax. Balance and credit grants pay it plus rounding_amount; they do not reduce it."),
30
+ rounding_amount: Money.describe("Added to total to round the amount payable to the currency's minor unit; negative when rounded down. The rounding of a usage invoice carries over to the next invoice of the same billing period."),
30
31
  amount_paid: Money.optional(),
31
32
  pre_payment_credit_notes_amount: Money.describe("Issued credit notes that reduced unpaid receivables; the original invoice total is unchanged."),
32
33
  post_payment_credit_notes_amount: Money.describe("Issued credit notes against payments already received; their refunds may not have completed."),
33
- amount_due: Money.describe("What is still collectible after unpaid credit notes and successful payments; never below zero. Zero for a draft, whose total is the base price, and for a paid or void invoice."),
34
+ amount_due: Money.describe("What is still collectible from total plus rounding_amount after unpaid credit notes and successful payments; never below zero. Zero for a draft, whose total is the base price, and for a paid or void invoice."),
34
35
  period_start: zod.iso.datetime({ offset: true }).nullish(),
35
36
  period_end: zod.iso.datetime({ offset: true }).nullish().describe("Exclusive."),
36
37
  customer_name: zod
@@ -14,13 +14,6 @@ export declare const InvoiceItem: zod.ZodObject<{
14
14
  tax_amount: zod.ZodOptional<zod.ZodString>;
15
15
  tax_included_amount: zod.ZodOptional<zod.ZodString>;
16
16
  id: zod.ZodUUID;
17
- type: zod.ZodOptional<zod.ZodEnum<{
18
- one_time: "one_time";
19
- adjustment: "adjustment";
20
- usage: "usage";
21
- subscription: "subscription";
22
- setup: "setup";
23
- }>>;
24
17
  project_id: zod.ZodOptional<zod.ZodNullable<zod.ZodUUID>>;
25
18
  project: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
26
19
  id: zod.ZodUUID;
@@ -34,6 +27,8 @@ export declare const InvoiceItem: zod.ZodObject<{
34
27
  unit_amount: zod.ZodOptional<zod.ZodString>;
35
28
  unit_quantity: zod.ZodOptional<zod.ZodString>;
36
29
  amount: zod.ZodString;
30
+ rounding_amount: zod.ZodString;
31
+ usage_charge_count: zod.ZodInt;
37
32
  currency: zod.ZodString;
38
33
  period_start: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
39
34
  period_end: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
@@ -23,7 +23,6 @@ export const InvoiceItem = zod.strictObject({
23
23
  .optional()
24
24
  .describe("The part of tax_amount already included in amount."),
25
25
  id: zod.uuid(),
26
- type: zod.enum(["usage", "subscription", "one_time", "setup", "adjustment"]).optional(),
27
26
  project_id: zod.uuid().nullish(),
28
27
  project: zod
29
28
  .union([NamedIdentity, zod.null()])
@@ -43,6 +42,10 @@ export const InvoiceItem = zod.strictObject({
43
42
  .optional()
44
43
  .describe("The quantity `unit_amount` prices, such as 1000000 tokens or 3600 seconds: `amount` is `quantity` × `unit_amount` ÷ `unit_quantity`. Present together with `unit_amount`."),
45
44
  amount: Money,
45
+ rounding_amount: Money.describe("This line's share of the invoice's rounding_amount. The line's net amount is amount - discount_amount + tax_amount - tax_included_amount + rounding_amount."),
46
+ usage_charge_count: zod
47
+ .int()
48
+ .describe("Usage charges billed on this line; zero for other lines."),
46
49
  currency: zod.string(),
47
50
  period_start: zod.iso.datetime({ offset: true }).nullish(),
48
51
  period_end: zod.iso.datetime({ offset: true }).nullish(),
@@ -15,13 +15,6 @@ export declare const InvoiceItemList: zod.ZodObject<{
15
15
  tax_amount: zod.ZodOptional<zod.ZodString>;
16
16
  tax_included_amount: zod.ZodOptional<zod.ZodString>;
17
17
  id: zod.ZodUUID;
18
- type: zod.ZodOptional<zod.ZodEnum<{
19
- one_time: "one_time";
20
- adjustment: "adjustment";
21
- usage: "usage";
22
- subscription: "subscription";
23
- setup: "setup";
24
- }>>;
25
18
  project_id: zod.ZodOptional<zod.ZodNullable<zod.ZodUUID>>;
26
19
  project: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
27
20
  id: zod.ZodUUID;
@@ -35,6 +28,8 @@ export declare const InvoiceItemList: zod.ZodObject<{
35
28
  unit_amount: zod.ZodOptional<zod.ZodString>;
36
29
  unit_quantity: zod.ZodOptional<zod.ZodString>;
37
30
  amount: zod.ZodString;
31
+ rounding_amount: zod.ZodString;
32
+ usage_charge_count: zod.ZodInt;
38
33
  currency: zod.ZodString;
39
34
  period_start: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
40
35
  period_end: zod.ZodOptional<zod.ZodNullable<zod.z.ZodISODateTime>>;
@@ -37,6 +37,7 @@ export declare const InvoiceList: zod.ZodObject<{
37
37
  tax_amount: zod.ZodOptional<zod.ZodString>;
38
38
  credit_applied: zod.ZodOptional<zod.ZodString>;
39
39
  total: zod.ZodString;
40
+ rounding_amount: zod.ZodString;
40
41
  amount_paid: zod.ZodOptional<zod.ZodString>;
41
42
  pre_payment_credit_notes_amount: zod.ZodString;
42
43
  post_payment_credit_notes_amount: zod.ZodString;
@@ -19,6 +19,7 @@ export declare const MonthlyStatement: zod.ZodObject<{
19
19
  discount_amount: zod.ZodString;
20
20
  tax_amount: zod.ZodString;
21
21
  total: zod.ZodString;
22
+ rounding_amount: zod.ZodString;
22
23
  }, zod.z.core.$strict>;
23
24
  credited_amount: zod.ZodString;
24
25
  unbilled: zod.ZodOptional<zod.ZodObject<{
@@ -26,6 +27,7 @@ export declare const MonthlyStatement: zod.ZodObject<{
26
27
  discount_amount: zod.ZodString;
27
28
  tax_amount: zod.ZodString;
28
29
  total: zod.ZodString;
30
+ rounding_amount: zod.ZodString;
29
31
  }, zod.z.core.$strict>>;
30
32
  credit_applied: zod.ZodString;
31
33
  amount_paid: zod.ZodString;
@@ -20,6 +20,7 @@ export declare const MonthlyStatementList: zod.ZodObject<{
20
20
  discount_amount: zod.ZodString;
21
21
  tax_amount: zod.ZodString;
22
22
  total: zod.ZodString;
23
+ rounding_amount: zod.ZodString;
23
24
  }, zod.z.core.$strict>;
24
25
  credited_amount: zod.ZodString;
25
26
  unbilled: zod.ZodOptional<zod.ZodObject<{
@@ -27,6 +28,7 @@ export declare const MonthlyStatementList: zod.ZodObject<{
27
28
  discount_amount: zod.ZodString;
28
29
  tax_amount: zod.ZodString;
29
30
  total: zod.ZodString;
31
+ rounding_amount: zod.ZodString;
30
32
  }, zod.z.core.$strict>>;
31
33
  credit_applied: zod.ZodString;
32
34
  amount_paid: zod.ZodString;
@@ -28,6 +28,7 @@ export declare const Statement: zod.ZodObject<{
28
28
  discount_amount: zod.ZodString;
29
29
  tax_amount: zod.ZodString;
30
30
  total: zod.ZodString;
31
+ rounding_amount: zod.ZodString;
31
32
  }, zod.z.core.$strict>;
32
33
  closed_at: zod.ZodOptional<zod.z.ZodISODateTime>;
33
34
  invoice_id: zod.ZodOptional<zod.ZodUUID>;
@@ -11,6 +11,7 @@ export declare const StatementAmounts: zod.ZodObject<{
11
11
  discount_amount: zod.ZodString;
12
12
  tax_amount: zod.ZodString;
13
13
  total: zod.ZodString;
14
+ rounding_amount: zod.ZodString;
14
15
  }, zod.z.core.$strict>;
15
16
  export type StatementAmounts = zod.input<typeof StatementAmounts>;
16
17
  export type StatementAmountsOutput = zod.output<typeof StatementAmounts>;
@@ -12,4 +12,5 @@ export const StatementAmounts = zod.strictObject({
12
12
  discount_amount: Money,
13
13
  tax_amount: Money,
14
14
  total: Money,
15
+ rounding_amount: Money.describe("Added to total to round the invoiced amount to the currency's minor unit. Zero for an open statement's estimate."),
15
16
  });
@@ -29,6 +29,7 @@ export declare const StatementList: zod.ZodObject<{
29
29
  discount_amount: zod.ZodString;
30
30
  tax_amount: zod.ZodString;
31
31
  total: zod.ZodString;
32
+ rounding_amount: zod.ZodString;
32
33
  }, zod.z.core.$strict>;
33
34
  closed_at: zod.ZodOptional<zod.z.ZodISODateTime>;
34
35
  invoice_id: zod.ZodOptional<zod.ZodUUID>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leaflow/sdk",
3
- "version": "0.0.0-dev.375.gbce4ffc",
3
+ "version": "0.0.0-dev.377.gdbef936",
4
4
  "description": "Leaflow 平台 API 的 TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "repository": {