@openmeter/client 1.0.0-beta-c16cbe1e4650 → 1.0.0-beta-d30d21dce71a
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.
- package/README.md +7 -0
- package/dist/funcs/index.d.ts +1 -0
- package/dist/funcs/index.js +1 -0
- package/dist/funcs/invoices.d.ts +5 -0
- package/dist/funcs/invoices.js +10 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -0
- package/dist/models/operations/customers.d.ts +2 -2
- package/dist/models/operations/invoices.d.ts +7 -0
- package/dist/models/operations/invoices.js +2 -0
- package/dist/models/schemas.d.ts +2000 -208
- package/dist/models/schemas.js +386 -37
- package/dist/models/types.d.ts +475 -32
- package/dist/sdk/invoices.d.ts +9 -0
- package/dist/sdk/invoices.js +12 -0
- package/dist/sdk/sdk.d.ts +3 -0
- package/dist/sdk/sdk.js +5 -0
- package/package.json +1 -1
package/dist/models/schemas.js
CHANGED
|
@@ -417,9 +417,9 @@ export const creditTransactionType = z
|
|
|
417
417
|
export const chargesExpand = z
|
|
418
418
|
.enum(['real_time_usage'])
|
|
419
419
|
.describe("Expands for customer charges. Values: - `real_time_usage`: The charge's real-time usage.");
|
|
420
|
-
export const
|
|
421
|
-
.enum(['
|
|
422
|
-
.describe('Identifies
|
|
420
|
+
export const lifecycleController = z
|
|
421
|
+
.enum(['system', 'manual'])
|
|
422
|
+
.describe('Identifies whether a resource lifecycle is controlled by OpenMeter or manually overridden by the API user. Values: - `system`: The resource lifecycle is controlled by OpenMeter. - `manual`: The resource lifecycle was manually overridden by the API user.');
|
|
423
423
|
export const chargeStatus = z
|
|
424
424
|
.enum(['created', 'active', 'final', 'deleted'])
|
|
425
425
|
.describe('Lifecycle status of a charge. Values: - `created`: The charge has been created but is not active yet. - `active`: The charge is active. - `final`: The charge is fully finalized and no further changes are expected. - `deleted`: The charge has been deleted.');
|
|
@@ -445,7 +445,7 @@ export const taxConfigExternalInvoicing = z
|
|
|
445
445
|
export const pricePaymentTerm = z
|
|
446
446
|
.union([z.literal('in_advance'), z.literal('in_arrears')])
|
|
447
447
|
.describe('The payment term of a flat price.');
|
|
448
|
-
export const
|
|
448
|
+
export const chargeFlatFeeDiscounts = z
|
|
449
449
|
.object({
|
|
450
450
|
percentage: z
|
|
451
451
|
.number()
|
|
@@ -507,6 +507,73 @@ export const workflowPaymentSendInvoiceSettings = z
|
|
|
507
507
|
.describe("The period after which the invoice is due. With some payment solutions it's only applicable for manual collection method."),
|
|
508
508
|
})
|
|
509
509
|
.describe('Payment settings for a billing workflow when the collection method is send invoice.');
|
|
510
|
+
export const invoiceNumber = z
|
|
511
|
+
.string()
|
|
512
|
+
.min(1)
|
|
513
|
+
.max(256)
|
|
514
|
+
.describe('InvoiceNumber is a unique identifier for the invoice, generated by the invoicing app. The uniqueness depends on a lot of factors: - app setting (unique per app or unique per customer) - multiple app scenarios (multiple apps generating invoices with the same prefix)');
|
|
515
|
+
export const invoiceValidationIssueSeverity = z
|
|
516
|
+
.enum(['critical', 'warning'])
|
|
517
|
+
.describe('Severity level of an invoice validation issue.');
|
|
518
|
+
export const invoiceExternalReferences = z
|
|
519
|
+
.object({
|
|
520
|
+
invoicing_id: z
|
|
521
|
+
.string()
|
|
522
|
+
.optional()
|
|
523
|
+
.describe('The ID assigned by the external invoicing app (e.g. Stripe invoice ID).'),
|
|
524
|
+
payment_id: z
|
|
525
|
+
.string()
|
|
526
|
+
.optional()
|
|
527
|
+
.describe('The ID assigned by the external payment app (e.g. Stripe payment intent ID).'),
|
|
528
|
+
})
|
|
529
|
+
.describe('External identifiers assigned to an invoice by third-party systems.');
|
|
530
|
+
export const invoiceStandardStatus = z
|
|
531
|
+
.enum([
|
|
532
|
+
'draft',
|
|
533
|
+
'issuing',
|
|
534
|
+
'issued',
|
|
535
|
+
'payment_processing',
|
|
536
|
+
'overdue',
|
|
537
|
+
'paid',
|
|
538
|
+
'uncollectible',
|
|
539
|
+
'voided',
|
|
540
|
+
])
|
|
541
|
+
.describe('Lifecycle status of a standard invoice.');
|
|
542
|
+
export const invoiceAvailableActionDetails = z
|
|
543
|
+
.object({
|
|
544
|
+
resulting_state: z
|
|
545
|
+
.string()
|
|
546
|
+
.describe('The extended status the invoice will transition to after performing this action.'),
|
|
547
|
+
})
|
|
548
|
+
.describe('Details about an available invoice action including the resulting state.');
|
|
549
|
+
export const invoiceWorkflowInvoicingSettings = z
|
|
550
|
+
.object({
|
|
551
|
+
auto_advance: z
|
|
552
|
+
.boolean()
|
|
553
|
+
.optional()
|
|
554
|
+
.default(true)
|
|
555
|
+
.describe('Whether to automatically issue the invoice after the draft_period has passed.'),
|
|
556
|
+
draft_period: z
|
|
557
|
+
.string()
|
|
558
|
+
.optional()
|
|
559
|
+
.default('P0D')
|
|
560
|
+
.describe('The period for the invoice to be kept in draft status for manual reviews.'),
|
|
561
|
+
})
|
|
562
|
+
.describe('Invoice-level invoicing settings. A subset of BillingWorkflowInvoicingSettings limited to fields that are meaningful per-invoice. progressive_billing is omitted as it is a gather-time / profile-level decision.');
|
|
563
|
+
export const invoiceDiscountReason = z
|
|
564
|
+
.enum(['maximum_spend', 'ratecard_percentage', 'ratecard_usage'])
|
|
565
|
+
.describe('The reason a discount was applied to an invoice line.');
|
|
566
|
+
export const invoiceLineExternalReferences = z
|
|
567
|
+
.object({
|
|
568
|
+
invoicing_id: z
|
|
569
|
+
.string()
|
|
570
|
+
.optional()
|
|
571
|
+
.describe('The ID assigned by the external invoicing app.'),
|
|
572
|
+
})
|
|
573
|
+
.describe('External identifiers for an invoice line item assigned by third-party systems.');
|
|
574
|
+
export const invoiceDetailedLineCostCategory = z
|
|
575
|
+
.enum(['regular', 'commitment'])
|
|
576
|
+
.describe('Cost category of a detailed invoice line item.');
|
|
510
577
|
export const currencyType = z
|
|
511
578
|
.enum(['fiat', 'custom'])
|
|
512
579
|
.describe('Currency type for custom currencies. It should be a unique code but not conflicting with any existing standard currency codes.');
|
|
@@ -792,20 +859,21 @@ export const numericFieldFilter = z
|
|
|
792
859
|
export const chargeType = z
|
|
793
860
|
.enum(['flat_fee', 'usage_based'])
|
|
794
861
|
.describe('Type of a charge. Values: - `flat_fee`: A fixed-amount charge. - `usage_based`: A usage-priced charge.');
|
|
795
|
-
export const
|
|
796
|
-
.
|
|
797
|
-
.
|
|
798
|
-
|
|
799
|
-
.
|
|
862
|
+
export const invoiceType = z
|
|
863
|
+
.enum(['standard'])
|
|
864
|
+
.describe('The type of a billing invoice.');
|
|
865
|
+
export const invoiceLineType = z
|
|
866
|
+
.enum(['standard_line'])
|
|
867
|
+
.describe('Line item type discriminator.');
|
|
868
|
+
export const priceType = z
|
|
869
|
+
.enum(['free', 'flat', 'unit', 'graduated', 'volume'])
|
|
870
|
+
.describe("The type of the price. - `free`: No charge, the rate card is included at no cost. - `flat`: A fixed amount charged once per billing period, regardless of usage. - `unit`: A fixed rate charged per billing unit consumed. - `graduated`: Tiered pricing where each tier's rate applies only to usage within that tier. - `volume`: Tiered pricing where the rate for the highest tier reached applies to all units in the period.");
|
|
800
871
|
export const collectionAlignment = z
|
|
801
872
|
.enum(['subscription', 'anchored'])
|
|
802
873
|
.describe('BillingCollectionAlignment specifies when the pending line items should be collected into an invoice.');
|
|
803
874
|
export const collectionMethod = z
|
|
804
875
|
.enum(['charge_automatically', 'send_invoice'])
|
|
805
876
|
.describe('Collection method specifies how the invoice should be collected (automatic or manual).');
|
|
806
|
-
export const priceType = z
|
|
807
|
-
.enum(['free', 'flat', 'unit', 'graduated', 'volume'])
|
|
808
|
-
.describe("The type of the price. - `free`: No charge, the rate card is included at no cost. - `flat`: A fixed amount charged once per billing period, regardless of usage. - `unit`: A fixed rate charged per billing unit consumed. - `graduated`: Tiered pricing where each tier's rate applies only to usage within that tier. - `volume`: Tiered pricing where the rate for the highest tier reached applies to all units in the period.");
|
|
809
877
|
export const featureUnitCostType = z
|
|
810
878
|
.enum(['llm', 'manual'])
|
|
811
879
|
.describe('The type of unit cost.');
|
|
@@ -914,6 +982,15 @@ export const totals = z
|
|
|
914
982
|
total: numeric,
|
|
915
983
|
})
|
|
916
984
|
.describe('Totals contains the summaries of all calculations for a billing resource.');
|
|
985
|
+
export const invoiceLineCreditsApplied = z
|
|
986
|
+
.object({
|
|
987
|
+
amount: numeric,
|
|
988
|
+
description: z
|
|
989
|
+
.string()
|
|
990
|
+
.optional()
|
|
991
|
+
.describe('Optional human-readable description of the credit allocation.'),
|
|
992
|
+
})
|
|
993
|
+
.describe('A credit allocation applied to an invoice line item.');
|
|
917
994
|
export const featureManualUnitCost = z
|
|
918
995
|
.object({
|
|
919
996
|
type: z
|
|
@@ -1067,6 +1144,11 @@ export const appReference = z
|
|
|
1067
1144
|
id: ulid,
|
|
1068
1145
|
})
|
|
1069
1146
|
.describe('App reference.');
|
|
1147
|
+
export const chargeReference = z
|
|
1148
|
+
.object({
|
|
1149
|
+
id: ulid,
|
|
1150
|
+
})
|
|
1151
|
+
.describe('Reference to a charge associated with an invoice line.');
|
|
1070
1152
|
export const currencyFiat = z
|
|
1071
1153
|
.object({
|
|
1072
1154
|
id: ulid,
|
|
@@ -1562,17 +1644,6 @@ export const customerUsageAttribution = z
|
|
|
1562
1644
|
.describe('The subjects that are attributed to the customer. Can be empty when no usage event subjects are associated with the customer.'),
|
|
1563
1645
|
})
|
|
1564
1646
|
.describe('Mapping to attribute metered usage to the customer. One customer can have zero or more subjects, but one subject can only belong to one customer.');
|
|
1565
|
-
export const billingAddress = z
|
|
1566
|
-
.object({
|
|
1567
|
-
country: countryCode.optional(),
|
|
1568
|
-
postal_code: z.string().optional().describe('Postal code.'),
|
|
1569
|
-
state: z.string().optional().describe('State or province.'),
|
|
1570
|
-
city: z.string().optional().describe('City.'),
|
|
1571
|
-
line1: z.string().optional().describe('First line of the address.'),
|
|
1572
|
-
line2: z.string().optional().describe('Second line of the address.'),
|
|
1573
|
-
phone_number: z.string().optional().describe('Phone number.'),
|
|
1574
|
-
})
|
|
1575
|
-
.describe('Address');
|
|
1576
1647
|
export const address = z
|
|
1577
1648
|
.object({
|
|
1578
1649
|
country: countryCode.optional(),
|
|
@@ -1848,6 +1919,65 @@ export const workflowPaymentSettings = z
|
|
|
1848
1919
|
workflowPaymentSendInvoiceSettings,
|
|
1849
1920
|
])
|
|
1850
1921
|
.describe('Payment settings for a billing workflow.');
|
|
1922
|
+
export const invoiceValidationIssue = z
|
|
1923
|
+
.object({
|
|
1924
|
+
code: z.string().describe('Machine-readable error code.'),
|
|
1925
|
+
message: z.string().describe('Human-readable description of the error.'),
|
|
1926
|
+
attributes: z
|
|
1927
|
+
.record(z.string(), z.unknown())
|
|
1928
|
+
.optional()
|
|
1929
|
+
.describe('Additional structured context.'),
|
|
1930
|
+
severity: invoiceValidationIssueSeverity,
|
|
1931
|
+
field: z
|
|
1932
|
+
.string()
|
|
1933
|
+
.optional()
|
|
1934
|
+
.describe('JSON path to the field that caused this validation issue, if applicable. For example: `lines/0/rate_card/price`.'),
|
|
1935
|
+
})
|
|
1936
|
+
.describe('A validation issue found during invoice processing. Converges on the same structure used by plan and subscription validation errors: a machine-readable `code`, a human-readable `message`, optional structured `attributes`, plus a `severity` and optional `field` path.');
|
|
1937
|
+
export const invoiceAvailableActions = z
|
|
1938
|
+
.object({
|
|
1939
|
+
advance: invoiceAvailableActionDetails.optional(),
|
|
1940
|
+
approve: invoiceAvailableActionDetails.optional(),
|
|
1941
|
+
delete: invoiceAvailableActionDetails.optional(),
|
|
1942
|
+
retry: invoiceAvailableActionDetails.optional(),
|
|
1943
|
+
snapshot_quantities: invoiceAvailableActionDetails.optional(),
|
|
1944
|
+
})
|
|
1945
|
+
.describe('The set of state-transition actions available for an invoice in its current status. A field is present only when that action is permitted from the current state.');
|
|
1946
|
+
export const invoiceLineAmountDiscount = z
|
|
1947
|
+
.object({
|
|
1948
|
+
id: ulid,
|
|
1949
|
+
reason: invoiceDiscountReason,
|
|
1950
|
+
description: z
|
|
1951
|
+
.string()
|
|
1952
|
+
.optional()
|
|
1953
|
+
.describe('Optional human-readable description of the discount.'),
|
|
1954
|
+
external_references: invoiceLineExternalReferences.optional(),
|
|
1955
|
+
amount: numeric,
|
|
1956
|
+
})
|
|
1957
|
+
.describe('A monetary amount discount applied to an invoice line item.');
|
|
1958
|
+
export const invoiceLineUsageDiscount = z
|
|
1959
|
+
.object({
|
|
1960
|
+
id: ulid,
|
|
1961
|
+
reason: invoiceDiscountReason,
|
|
1962
|
+
description: z
|
|
1963
|
+
.string()
|
|
1964
|
+
.optional()
|
|
1965
|
+
.describe('Optional human-readable description of the discount.'),
|
|
1966
|
+
external_references: invoiceLineExternalReferences.optional(),
|
|
1967
|
+
quantity: numeric,
|
|
1968
|
+
})
|
|
1969
|
+
.describe('A usage quantity discount applied to an invoice line item.');
|
|
1970
|
+
export const invoiceLineBaseDiscount = z
|
|
1971
|
+
.object({
|
|
1972
|
+
id: ulid,
|
|
1973
|
+
reason: invoiceDiscountReason,
|
|
1974
|
+
description: z
|
|
1975
|
+
.string()
|
|
1976
|
+
.optional()
|
|
1977
|
+
.describe('Optional human-readable description of the discount.'),
|
|
1978
|
+
external_references: invoiceLineExternalReferences.optional(),
|
|
1979
|
+
})
|
|
1980
|
+
.describe('Base fields shared by all invoice line item discounts.');
|
|
1851
1981
|
export const listCurrenciesParamsFilter = z
|
|
1852
1982
|
.object({
|
|
1853
1983
|
type: currencyType.optional(),
|
|
@@ -2270,6 +2400,13 @@ export const profileAppReferences = z
|
|
|
2270
2400
|
payment: appReference,
|
|
2271
2401
|
})
|
|
2272
2402
|
.describe('References to the applications used by a billing profile.');
|
|
2403
|
+
export const invoiceWorkflowAppsReferences = z
|
|
2404
|
+
.object({
|
|
2405
|
+
tax: appReference,
|
|
2406
|
+
invoicing: appReference,
|
|
2407
|
+
payment: appReference,
|
|
2408
|
+
})
|
|
2409
|
+
.describe('BillingInvoiceWorkflowAppsReferences represents the references (id) to the apps used by a billing profile');
|
|
2273
2410
|
export const listEventsParamsFilter = z
|
|
2274
2411
|
.object({
|
|
2275
2412
|
id: stringFieldFilter.optional(),
|
|
@@ -2389,7 +2526,7 @@ export const createCustomerRequest = z
|
|
|
2389
2526
|
.optional()
|
|
2390
2527
|
.describe('The primary email address of the customer.'),
|
|
2391
2528
|
currency: currencyCode.optional(),
|
|
2392
|
-
billing_address:
|
|
2529
|
+
billing_address: address.optional(),
|
|
2393
2530
|
})
|
|
2394
2531
|
.describe('Customer create request.');
|
|
2395
2532
|
export const customer = z
|
|
@@ -2416,7 +2553,7 @@ export const customer = z
|
|
|
2416
2553
|
.optional()
|
|
2417
2554
|
.describe('The primary email address of the customer.'),
|
|
2418
2555
|
currency: currencyCode.optional(),
|
|
2419
|
-
billing_address:
|
|
2556
|
+
billing_address: address.optional(),
|
|
2420
2557
|
})
|
|
2421
2558
|
.describe('Customers can be individuals or organizations that can subscribe to plans and have access to features.');
|
|
2422
2559
|
export const upsertCustomerRequest = z
|
|
@@ -2438,7 +2575,7 @@ export const upsertCustomerRequest = z
|
|
|
2438
2575
|
.optional()
|
|
2439
2576
|
.describe('The primary email address of the customer.'),
|
|
2440
2577
|
currency: currencyCode.optional(),
|
|
2441
|
-
billing_address:
|
|
2578
|
+
billing_address: address.optional(),
|
|
2442
2579
|
})
|
|
2443
2580
|
.describe('Customer upsert request.');
|
|
2444
2581
|
export const partyAddresses = z
|
|
@@ -2446,6 +2583,19 @@ export const partyAddresses = z
|
|
|
2446
2583
|
billing_address: address,
|
|
2447
2584
|
})
|
|
2448
2585
|
.describe('A collection of addresses for the party.');
|
|
2586
|
+
export const invoiceCustomer = z
|
|
2587
|
+
.object({
|
|
2588
|
+
id: ulid,
|
|
2589
|
+
name: z
|
|
2590
|
+
.string()
|
|
2591
|
+
.min(1)
|
|
2592
|
+
.max(256)
|
|
2593
|
+
.describe('Display name of the resource. Between 1 and 256 characters.'),
|
|
2594
|
+
usage_attribution: customerUsageAttribution.optional(),
|
|
2595
|
+
billing_address: address.optional(),
|
|
2596
|
+
key: externalResourceKey.optional(),
|
|
2597
|
+
})
|
|
2598
|
+
.describe("Snapshot of the customer's information at the time the invoice was issued.");
|
|
2449
2599
|
export const appStripeCreateCheckoutSessionConsentCollection = z
|
|
2450
2600
|
.object({
|
|
2451
2601
|
payment_method_reuse_agreement: appStripeCreateCheckoutSessionConsentCollectionPaymentMethodReuseAgreement.optional(),
|
|
@@ -2660,6 +2810,36 @@ export const upsertTaxCodeRequest = z
|
|
|
2660
2810
|
.describe('Mapping of app types to tax codes.'),
|
|
2661
2811
|
})
|
|
2662
2812
|
.describe('TaxCode upsert request.');
|
|
2813
|
+
export const invoiceWorkflow = z
|
|
2814
|
+
.object({
|
|
2815
|
+
invoicing: invoiceWorkflowInvoicingSettings.optional(),
|
|
2816
|
+
payment: workflowPaymentSettings.optional(),
|
|
2817
|
+
})
|
|
2818
|
+
.describe('Invoice-level snapshot of the workflow configuration. Contains only the settings that are meaningful for an already-created invoice: invoicing behaviour and payment settings. Collection alignment and tax policy are gather-time / profile-wide concerns and are not included.');
|
|
2819
|
+
export const invoiceStatusDetails = z
|
|
2820
|
+
.object({
|
|
2821
|
+
immutable: z
|
|
2822
|
+
.boolean()
|
|
2823
|
+
.describe('Whether the invoice is immutable (i.e. cannot be modified or deleted).'),
|
|
2824
|
+
failed: z.boolean().describe('Whether the invoice is in a failed state.'),
|
|
2825
|
+
extended_status: z
|
|
2826
|
+
.string()
|
|
2827
|
+
.describe('Fine-grained internal status string providing additional workflow detail beyond the top-level status enum.'),
|
|
2828
|
+
available_actions: invoiceAvailableActions,
|
|
2829
|
+
})
|
|
2830
|
+
.describe('Detailed status information for a standard invoice.');
|
|
2831
|
+
export const invoiceLineDiscounts = z
|
|
2832
|
+
.object({
|
|
2833
|
+
amount: z
|
|
2834
|
+
.array(invoiceLineAmountDiscount)
|
|
2835
|
+
.optional()
|
|
2836
|
+
.describe('Monetary amount discounts (e.g. from maximum spend commitments).'),
|
|
2837
|
+
usage: z
|
|
2838
|
+
.array(invoiceLineUsageDiscount)
|
|
2839
|
+
.optional()
|
|
2840
|
+
.describe('Usage quantity discounts (e.g. free tier usage allowances).'),
|
|
2841
|
+
})
|
|
2842
|
+
.describe('Discounts applied to an invoice line item.');
|
|
2663
2843
|
export const currency = z
|
|
2664
2844
|
.discriminatedUnion('type', [currencyFiat, currencyCustom])
|
|
2665
2845
|
.describe('Fiat or custom currency.');
|
|
@@ -2802,7 +2982,7 @@ export const creditGrant = z
|
|
|
2802
2982
|
status: creditGrantStatus,
|
|
2803
2983
|
})
|
|
2804
2984
|
.describe('A credit grant allocates credits to a customer. Credits are drawn down against charges according to the settlement mode configured on the rate card.');
|
|
2805
|
-
export const
|
|
2985
|
+
export const createChargeFlatFeeRequest = z
|
|
2806
2986
|
.object({
|
|
2807
2987
|
name: z
|
|
2808
2988
|
.string()
|
|
@@ -2826,7 +3006,7 @@ export const createFlatFeeChargeRequest = z
|
|
|
2826
3006
|
settlement_mode: settlementMode,
|
|
2827
3007
|
tax_config: taxConfig.optional(),
|
|
2828
3008
|
payment_term: pricePaymentTerm,
|
|
2829
|
-
discounts:
|
|
3009
|
+
discounts: chargeFlatFeeDiscounts.optional(),
|
|
2830
3010
|
feature_key: z
|
|
2831
3011
|
.string()
|
|
2832
3012
|
.optional()
|
|
@@ -2910,6 +3090,17 @@ export const party = z
|
|
|
2910
3090
|
addresses: partyAddresses.optional(),
|
|
2911
3091
|
})
|
|
2912
3092
|
.describe('Party represents a person or business entity.');
|
|
3093
|
+
export const supplier = z
|
|
3094
|
+
.object({
|
|
3095
|
+
id: z.string().optional().describe('Unique identifier for the party.'),
|
|
3096
|
+
name: z
|
|
3097
|
+
.string()
|
|
3098
|
+
.optional()
|
|
3099
|
+
.describe('Legal name or representation of the party.'),
|
|
3100
|
+
tax_id: partyTaxIdentity.optional(),
|
|
3101
|
+
addresses: partyAddresses.optional(),
|
|
3102
|
+
})
|
|
3103
|
+
.describe("Snapshot of the supplier's information at the time the invoice was issued. Structurally a read-only subset of `BillingParty` (the type configured on the billing profile), so the snapshot stays aligned with the source. `key` is omitted because it is not part of the snapshotted supplier data.");
|
|
2913
3104
|
export const appStripeCreateCheckoutSessionRequestOptions = z
|
|
2914
3105
|
.object({
|
|
2915
3106
|
billing_address_collection: appStripeCreateCheckoutSessionBillingAddressCollection
|
|
@@ -2973,6 +3164,43 @@ export const taxCodePagePaginatedResponse = z
|
|
|
2973
3164
|
meta: paginatedMeta,
|
|
2974
3165
|
})
|
|
2975
3166
|
.describe('Page paginated response.');
|
|
3167
|
+
export const invoiceWorkflowSettings = z
|
|
3168
|
+
.object({
|
|
3169
|
+
apps: invoiceWorkflowAppsReferences.optional(),
|
|
3170
|
+
source_billing_profile: profileReference,
|
|
3171
|
+
workflow: invoiceWorkflow,
|
|
3172
|
+
})
|
|
3173
|
+
.describe('Snapshot of the billing workflow configuration captured at invoice creation.');
|
|
3174
|
+
export const invoiceDetailedLine = z
|
|
3175
|
+
.object({
|
|
3176
|
+
id: ulid,
|
|
3177
|
+
name: z
|
|
3178
|
+
.string()
|
|
3179
|
+
.min(1)
|
|
3180
|
+
.max(256)
|
|
3181
|
+
.describe('Display name of the resource. Between 1 and 256 characters.'),
|
|
3182
|
+
description: z
|
|
3183
|
+
.string()
|
|
3184
|
+
.max(1024)
|
|
3185
|
+
.optional()
|
|
3186
|
+
.describe('Optional description of the resource. Maximum 1024 characters.'),
|
|
3187
|
+
labels: labels.optional(),
|
|
3188
|
+
created_at: dateTime,
|
|
3189
|
+
updated_at: dateTime,
|
|
3190
|
+
deleted_at: dateTime.optional(),
|
|
3191
|
+
service_period: closedPeriod,
|
|
3192
|
+
totals: totals,
|
|
3193
|
+
category: invoiceDetailedLineCostCategory.default('regular'),
|
|
3194
|
+
discounts: invoiceLineDiscounts.optional(),
|
|
3195
|
+
credits_applied: z
|
|
3196
|
+
.array(invoiceLineCreditsApplied)
|
|
3197
|
+
.optional()
|
|
3198
|
+
.describe('Credit applied to this detailed line.'),
|
|
3199
|
+
external_references: invoiceLineExternalReferences.optional(),
|
|
3200
|
+
quantity: numeric,
|
|
3201
|
+
unit_price: numeric,
|
|
3202
|
+
})
|
|
3203
|
+
.describe('A detailed (child) sub-line belonging to a parent invoice line. Detailed lines represent the individual flat-fee components that make up a usage-based parent line after quantity snapshotting.');
|
|
2976
3204
|
export const currencyPagePaginatedResponse = z
|
|
2977
3205
|
.object({
|
|
2978
3206
|
data: z.array(currency),
|
|
@@ -3062,6 +3290,31 @@ export const badRequest = z
|
|
|
3062
3290
|
invalid_parameters: invalidParameters,
|
|
3063
3291
|
}))
|
|
3064
3292
|
.describe('Bad Request.');
|
|
3293
|
+
export const invoiceBase = z
|
|
3294
|
+
.object({
|
|
3295
|
+
id: ulid,
|
|
3296
|
+
description: z
|
|
3297
|
+
.string()
|
|
3298
|
+
.max(1024)
|
|
3299
|
+
.optional()
|
|
3300
|
+
.describe('Optional description of the resource. Maximum 1024 characters.'),
|
|
3301
|
+
labels: labels.optional(),
|
|
3302
|
+
created_at: dateTime,
|
|
3303
|
+
updated_at: dateTime,
|
|
3304
|
+
deleted_at: dateTime.optional(),
|
|
3305
|
+
number: invoiceNumber,
|
|
3306
|
+
currency: currencyCode,
|
|
3307
|
+
supplier: supplier,
|
|
3308
|
+
customer: invoiceCustomer,
|
|
3309
|
+
totals: totals,
|
|
3310
|
+
service_period: closedPeriod,
|
|
3311
|
+
validation_issues: z
|
|
3312
|
+
.array(invoiceValidationIssue)
|
|
3313
|
+
.optional()
|
|
3314
|
+
.describe('Validation issues found during invoice processing. Present only when there are one or more validation findings. An empty list is omitted.'),
|
|
3315
|
+
external_references: invoiceExternalReferences.optional(),
|
|
3316
|
+
})
|
|
3317
|
+
.describe('Base fields shared by all invoice types. Spread this model into each concrete invoice variant.');
|
|
3065
3318
|
export const customerStripeCreateCheckoutSessionRequest = z
|
|
3066
3319
|
.object({
|
|
3067
3320
|
stripe_options: appStripeCreateCheckoutSessionRequestOptions,
|
|
@@ -3103,7 +3356,7 @@ export const governanceQueryResponse = z
|
|
|
3103
3356
|
meta: cursorMeta,
|
|
3104
3357
|
})
|
|
3105
3358
|
.describe('Response of the governance query.');
|
|
3106
|
-
export const
|
|
3359
|
+
export const chargeFlatFee = z
|
|
3107
3360
|
.object({
|
|
3108
3361
|
id: ulid,
|
|
3109
3362
|
name: z
|
|
@@ -3122,7 +3375,7 @@ export const flatFeeCharge = z
|
|
|
3122
3375
|
deleted_at: dateTime.optional(),
|
|
3123
3376
|
type: z.literal('flat_fee').describe('The type of the charge.'),
|
|
3124
3377
|
customer: billingCustomerReference,
|
|
3125
|
-
|
|
3378
|
+
lifecycle_controller: lifecycleController,
|
|
3126
3379
|
subscription: subscriptionReference.optional(),
|
|
3127
3380
|
currency: currencyCode,
|
|
3128
3381
|
status: chargeStatus,
|
|
@@ -3138,7 +3391,7 @@ export const flatFeeCharge = z
|
|
|
3138
3391
|
settlement_mode: settlementMode,
|
|
3139
3392
|
tax_config: taxConfig.optional(),
|
|
3140
3393
|
payment_term: pricePaymentTerm,
|
|
3141
|
-
discounts:
|
|
3394
|
+
discounts: chargeFlatFeeDiscounts.optional(),
|
|
3142
3395
|
feature_key: z
|
|
3143
3396
|
.string()
|
|
3144
3397
|
.optional()
|
|
@@ -3149,7 +3402,7 @@ export const flatFeeCharge = z
|
|
|
3149
3402
|
price: price,
|
|
3150
3403
|
})
|
|
3151
3404
|
.describe('A flat fee charge for a customer.');
|
|
3152
|
-
export const
|
|
3405
|
+
export const chargeUsageBased = z
|
|
3153
3406
|
.object({
|
|
3154
3407
|
id: ulid,
|
|
3155
3408
|
name: z
|
|
@@ -3168,7 +3421,7 @@ export const usageBasedCharge = z
|
|
|
3168
3421
|
deleted_at: dateTime.optional(),
|
|
3169
3422
|
type: z.literal('usage_based').describe('The type of the charge.'),
|
|
3170
3423
|
customer: billingCustomerReference,
|
|
3171
|
-
|
|
3424
|
+
lifecycle_controller: lifecycleController,
|
|
3172
3425
|
subscription: subscriptionReference.optional(),
|
|
3173
3426
|
currency: currencyCode,
|
|
3174
3427
|
status: chargeStatus,
|
|
@@ -3189,7 +3442,7 @@ export const usageBasedCharge = z
|
|
|
3189
3442
|
price: price,
|
|
3190
3443
|
})
|
|
3191
3444
|
.describe('A usage-based charge for a customer.');
|
|
3192
|
-
export const
|
|
3445
|
+
export const createChargeUsageBasedRequest = z
|
|
3193
3446
|
.object({
|
|
3194
3447
|
name: z
|
|
3195
3448
|
.string()
|
|
@@ -3219,6 +3472,14 @@ export const createUsageBasedChargeRequest = z
|
|
|
3219
3472
|
billing_period: closedPeriod.optional(),
|
|
3220
3473
|
})
|
|
3221
3474
|
.describe('Usage-based charge create request.');
|
|
3475
|
+
export const invoiceLineRateCard = z
|
|
3476
|
+
.object({
|
|
3477
|
+
price: price,
|
|
3478
|
+
tax_config: rateCardTaxConfig.optional(),
|
|
3479
|
+
feature_key: resourceKey.optional(),
|
|
3480
|
+
discounts: rateCardDiscounts.optional(),
|
|
3481
|
+
})
|
|
3482
|
+
.describe('Rate card configuration snapshot for a usage-based invoice line.');
|
|
3222
3483
|
export const rateCard = z
|
|
3223
3484
|
.object({
|
|
3224
3485
|
name: z
|
|
@@ -3259,14 +3520,51 @@ export const workflow = z
|
|
|
3259
3520
|
})
|
|
3260
3521
|
.describe('Billing workflow settings.');
|
|
3261
3522
|
export const charge = z
|
|
3262
|
-
.discriminatedUnion('type', [
|
|
3523
|
+
.discriminatedUnion('type', [chargeFlatFee, chargeUsageBased])
|
|
3263
3524
|
.describe('Customer charge.');
|
|
3264
3525
|
export const createChargeRequest = z
|
|
3265
3526
|
.discriminatedUnion('type', [
|
|
3266
|
-
|
|
3267
|
-
|
|
3527
|
+
createChargeFlatFeeRequest,
|
|
3528
|
+
createChargeUsageBasedRequest,
|
|
3268
3529
|
])
|
|
3269
3530
|
.describe('Customer charge.');
|
|
3531
|
+
export const invoiceStandardLine = z
|
|
3532
|
+
.object({
|
|
3533
|
+
id: ulid,
|
|
3534
|
+
name: z
|
|
3535
|
+
.string()
|
|
3536
|
+
.min(1)
|
|
3537
|
+
.max(256)
|
|
3538
|
+
.describe('Display name of the resource. Between 1 and 256 characters.'),
|
|
3539
|
+
description: z
|
|
3540
|
+
.string()
|
|
3541
|
+
.max(1024)
|
|
3542
|
+
.optional()
|
|
3543
|
+
.describe('Optional description of the resource. Maximum 1024 characters.'),
|
|
3544
|
+
labels: labels.optional(),
|
|
3545
|
+
created_at: dateTime,
|
|
3546
|
+
updated_at: dateTime,
|
|
3547
|
+
deleted_at: dateTime.optional(),
|
|
3548
|
+
type: z
|
|
3549
|
+
.literal('standard_line')
|
|
3550
|
+
.describe('The type of charge this line item represents.'),
|
|
3551
|
+
lifecycle_controller: lifecycleController,
|
|
3552
|
+
service_period: closedPeriod,
|
|
3553
|
+
totals: totals,
|
|
3554
|
+
discounts: invoiceLineDiscounts.optional(),
|
|
3555
|
+
credits_applied: z
|
|
3556
|
+
.array(invoiceLineCreditsApplied)
|
|
3557
|
+
.optional()
|
|
3558
|
+
.describe('Credit applied to this line item.'),
|
|
3559
|
+
external_references: invoiceLineExternalReferences.optional(),
|
|
3560
|
+
subscription: subscriptionReference.optional(),
|
|
3561
|
+
rate_card: invoiceLineRateCard,
|
|
3562
|
+
detailed_lines: z
|
|
3563
|
+
.array(invoiceDetailedLine)
|
|
3564
|
+
.describe('Detailed sub-lines that this line has been broken down into. Present when line has individual details.'),
|
|
3565
|
+
charge: chargeReference.optional(),
|
|
3566
|
+
})
|
|
3567
|
+
.describe('A top-level line item on an invoice. Each line represents a single charge, typically associated with a rate card from a subscription. Detailed (child) lines are nested under `detailed_lines` when present.');
|
|
3270
3568
|
export const planPhase = z
|
|
3271
3569
|
.object({
|
|
3272
3570
|
name: z
|
|
@@ -3423,6 +3721,9 @@ export const chargePagePaginatedResponse = z
|
|
|
3423
3721
|
meta: paginatedMeta,
|
|
3424
3722
|
})
|
|
3425
3723
|
.describe('Page paginated response.');
|
|
3724
|
+
export const invoiceLine = z
|
|
3725
|
+
.discriminatedUnion('type', [invoiceStandardLine])
|
|
3726
|
+
.describe('A top-level line item on an invoice. Each line represents a single charge, typically associated with a rate card from a subscription. Detailed (child) lines are nested under `detailed_lines` when present.');
|
|
3426
3727
|
export const plan = z
|
|
3427
3728
|
.object({
|
|
3428
3729
|
id: ulid,
|
|
@@ -3531,12 +3832,56 @@ export const profilePagePaginatedResponse = z
|
|
|
3531
3832
|
meta: paginatedMeta,
|
|
3532
3833
|
})
|
|
3533
3834
|
.describe('Page paginated response.');
|
|
3835
|
+
export const invoiceStandard = z
|
|
3836
|
+
.object({
|
|
3837
|
+
id: ulid,
|
|
3838
|
+
description: z
|
|
3839
|
+
.string()
|
|
3840
|
+
.max(1024)
|
|
3841
|
+
.optional()
|
|
3842
|
+
.describe('Optional description of the resource. Maximum 1024 characters.'),
|
|
3843
|
+
labels: labels.optional(),
|
|
3844
|
+
created_at: dateTime,
|
|
3845
|
+
updated_at: dateTime,
|
|
3846
|
+
deleted_at: dateTime.optional(),
|
|
3847
|
+
number: invoiceNumber,
|
|
3848
|
+
currency: currencyCode,
|
|
3849
|
+
supplier: supplier,
|
|
3850
|
+
customer: invoiceCustomer,
|
|
3851
|
+
totals: totals,
|
|
3852
|
+
service_period: closedPeriod,
|
|
3853
|
+
validation_issues: z
|
|
3854
|
+
.array(invoiceValidationIssue)
|
|
3855
|
+
.optional()
|
|
3856
|
+
.describe('Validation issues found during invoice processing. Present only when there are one or more validation findings. An empty list is omitted.'),
|
|
3857
|
+
external_references: invoiceExternalReferences.optional(),
|
|
3858
|
+
type: z
|
|
3859
|
+
.literal('standard')
|
|
3860
|
+
.describe('Discriminator field identifying this as a standard invoice.'),
|
|
3861
|
+
status: invoiceStandardStatus,
|
|
3862
|
+
status_details: invoiceStatusDetails,
|
|
3863
|
+
issued_at: dateTime.optional(),
|
|
3864
|
+
draft_until: dateTime.optional(),
|
|
3865
|
+
quantity_snapshotted_at: dateTime.optional(),
|
|
3866
|
+
collection_at: dateTime.optional(),
|
|
3867
|
+
due_at: dateTime.optional(),
|
|
3868
|
+
sent_to_customer_at: dateTime.optional(),
|
|
3869
|
+
workflow: invoiceWorkflowSettings,
|
|
3870
|
+
lines: z
|
|
3871
|
+
.array(invoiceLine)
|
|
3872
|
+
.optional()
|
|
3873
|
+
.describe('Line items on this invoice. Always returned on single-resource GET; omitted on list endpoints unless explicitly expanded.'),
|
|
3874
|
+
})
|
|
3875
|
+
.describe('A standard invoice for charges owed by the customer.');
|
|
3534
3876
|
export const planPagePaginatedResponse = z
|
|
3535
3877
|
.object({
|
|
3536
3878
|
data: z.array(plan),
|
|
3537
3879
|
meta: paginatedMeta,
|
|
3538
3880
|
})
|
|
3539
3881
|
.describe('Page paginated response.');
|
|
3882
|
+
export const invoice = z
|
|
3883
|
+
.discriminatedUnion('type', [invoiceStandard])
|
|
3884
|
+
.describe('An invoice issued to a customer. The `type` field determines the concrete variant: - `standard`: a standard invoice for charges owed.');
|
|
3540
3885
|
export const listMeteringEventsQueryParams = z.object({
|
|
3541
3886
|
page: cursorPaginationQueryPage.optional(),
|
|
3542
3887
|
filter: listEventsParamsFilter.optional(),
|
|
@@ -3859,6 +4204,10 @@ export const updateBillingProfileResponse = profile;
|
|
|
3859
4204
|
export const deleteBillingProfilePathParams = z.object({
|
|
3860
4205
|
id: ulid,
|
|
3861
4206
|
});
|
|
4207
|
+
export const getInvoicePathParams = z.object({
|
|
4208
|
+
invoiceId: ulid,
|
|
4209
|
+
});
|
|
4210
|
+
export const getInvoiceResponse = invoice;
|
|
3862
4211
|
export const createTaxCodeBody = createTaxCodeRequest;
|
|
3863
4212
|
export const createTaxCodeResponse = taxCode;
|
|
3864
4213
|
export const getTaxCodePathParams = z.object({
|