@paykit-sdk/core
Version:
The Payment Toolkit for Typescript
134 lines (131 loc) • 3.56 kB
TypeScript
import { z } from 'zod';
import { BillingMode } from './checkout.js';
import { Payee } from './customer.js';
import { PaykitMetadata } from './metadata.js';
import './billing.js';
import './subscription.js';
import '../types.js';
declare const invoiceStatusSchema: z.ZodEnum<["paid", "open"]>;
type InvoiceStatus = z.infer<typeof invoiceStatusSchema>;
interface Invoice {
/**
* The unique identifier of the invoice.
*/
id: string;
/**
* The payee linked to the invoice.
*/
customer: Payee | null;
/**
* The subscription ID, if recurring (null for one-time).
*/
subscription_id: string | null;
/**
* Billing mode: one-time or recurring.
*/
billing_mode: BillingMode;
/**
* Amount paid in smallest currency unit (e.g., cents).
*/
amount_paid: number;
/**
* ISO 4217 currency code (e.g., USD, EUR).
*/
currency: string;
/**
* Invoice status.
*/
status: InvoiceStatus;
/**
* Date the invoice was paid (ISO 8601 string, null if unpaid).
*/
paid_at: string | null;
/**
* Line items of the invoice.
*/
line_items: Array<{
id: string;
quantity: number;
}> | null;
/**
* Metadata for provider-specific or custom data.
*/
metadata: PaykitMetadata | null;
/**
* The provider custom field
*/
custom_fields: Record<string, unknown> | null;
}
declare const invoiceSchema: z.ZodObject<{
id: z.ZodString;
customer: z.ZodNullable<z.ZodUnion<[z.ZodObject<{
email: z.ZodString;
}, "strip", z.ZodTypeAny, {
email: string;
}, {
email: string;
}>, z.ZodObject<{
id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
}, "strip", z.ZodTypeAny, {
id: string | number;
}, {
id: string | number;
}>]>>;
subscription_id: z.ZodNullable<z.ZodString>;
billing_mode: z.ZodEnum<["one_time", "recurring"]>;
amount_paid: z.ZodNumber;
currency: z.ZodString;
status: z.ZodEnum<["paid", "open"]>;
paid_at: z.ZodNullable<z.ZodString>;
line_items: z.ZodNullable<z.ZodArray<z.ZodObject<{
id: z.ZodString;
quantity: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
id: string;
quantity: number;
}, {
id: string;
quantity: number;
}>, "many">>;
metadata: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
custom_fields: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>;
}, "strip", z.ZodTypeAny, {
status: "paid" | "open";
currency: string;
id: string;
metadata: Record<string, string> | null;
custom_fields: Record<string, any> | null;
customer: {
email: string;
} | {
id: string | number;
} | null;
subscription_id: string | null;
billing_mode: "one_time" | "recurring";
amount_paid: number;
paid_at: string | null;
line_items: {
id: string;
quantity: number;
}[] | null;
}, {
status: "paid" | "open";
currency: string;
id: string;
metadata: Record<string, string> | null;
custom_fields: Record<string, any> | null;
customer: {
email: string;
} | {
id: string | number;
} | null;
subscription_id: string | null;
billing_mode: "one_time" | "recurring";
amount_paid: number;
paid_at: string | null;
line_items: {
id: string;
quantity: number;
}[] | null;
}>;
export { type Invoice, type InvoiceStatus, invoiceSchema, invoiceStatusSchema };