Skip to main content

createCustomer

const customer = await billing.createCustomer({
  externalUserId: "user_123",
  email: "jane@example.com",
  name: "Jane Smith",
  metadata: { company: "Acme Inc" },
});

Parameters

NameTypeRequiredDescription
externalUserIdstringYesYour user’s unique ID
externalOrganizationIdstringNoOrganization ID for B2B
emailstringNoCustomer email
namestringNoCustomer name
metadataRecord<string, any>NoCustom key-value pairs

getCustomer

const customer = await billing.getCustomer("cus_123");

getCustomerByExternalId

Look up a customer by their ID in your system.
const customer = await billing.getCustomerByExternalId("user_123");

updateCustomer

const updated = await billing.updateCustomer("cus_123", {
  name: "Jane Doe",
  metadata: { company: "Acme Inc" },
});

deleteCustomer

await billing.deleteCustomer("cus_123");

Customer object

interface Customer {
  id: string
  externalUserId: string
  externalOrganizationId?: string
  email?: string
  name?: string
  stripeCustomerId?: string
  metadata?: Record<string, any>
  createdAt: Date
  updatedAt: Date
}