Skip to main content

Customer

The Customer interface represents a client or business entity that receives invoices.
id
string
required
Unique identifier for the customer
name
string
required
Full name of the customer or company
email
string
required
Email address for correspondence and invoice delivery
address
string
required
Street address or address line 1
city
string
required
City name
state
string
required
State, province, or region
zipCode
string
required
Postal or ZIP code
country
string
required
Country name
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
};

Build docs developers (and LLMs) love