Customer
The Customer interface represents a client or business entity that receives invoices.
Unique identifier for the customer
Full name of the customer or company
Email address for correspondence and invoice delivery
Street address or address line 1
State, province, or region
Optional URL or path to the customer’s logo image
TypeScript definition
export interface Customer {
id: string;
name: string;
email: string;
address: string;
city: string;
state: string;
zipCode: string;
country: string;
logo?: string;
}
Example
const customer: Customer = {
id: "cust_xyz789",
name: "TechStart Inc.",
email: "[email protected]",
address: "456 Innovation Drive, Suite 200",
city: "Austin",
state: "TX",
zipCode: "78701",
country: "United States",
logo: "https://cdn.example.com/logos/techstart.png"
};
Usage in invoices
Customer objects are embedded directly in invoices:
import type { Invoice, Customer } from './types';
const invoice: Invoice = {
// ... other invoice fields
customer: {
id: "cust_123",
name: "Acme Corporation",
email: "[email protected]",
address: "123 Business St",
city: "San Francisco",
state: "CA",
zipCode: "94105",
country: "United States"
},
// ... remaining fields
};
Partial customer objects
When used in templates, customer fields are optional to allow for reusable templates:
import type { InvoiceTemplate } from './types';
const template: InvoiceTemplate = {
// ... other template fields
customer: {
// Only specify common fields, leave others empty
state: "CA",
country: "United States"
},
// ... remaining fields
};