Billing profile schema for PhoenixKit Billing system.
Stores user billing information for individuals and companies (EU Standard). Used for generating invoices and order billing snapshots.
Schema Fields
Profile Identity
user_id: Foreign key to the usertype: Profile type - "individual" or "company"is_default: Whether this is the user's default billing profilename: Display name for the profile
Individual Fields
first_name,last_name,middle_name: Person's namephone: Contact phone numberemail: Billing email (can differ from user email)
Company Fields (EU Standard)
company_name: Legal company namecompany_vat_number: EU VAT Number (e.g., "EE123456789")company_registration_number: Company registration numbercompany_legal_address: Registered legal address
Billing Address
address_line1,address_line2: Street addresscity,state,postal_code,country: Location
Usage Examples
# Create individual billing profile
{:ok, profile} = Billing.create_billing_profile(user, %{
type: "individual",
first_name: "John",
last_name: "Doe",
email: "john@example.com",
address_line1: "123 Main St",
city: "Tallinn",
country: "EE",
is_default: true
})
# Create company billing profile
{:ok, profile} = Billing.create_billing_profile(user, %{
type: "company",
company_name: "Acme Corp OÜ",
company_vat_number: "EE123456789",
company_registration_number: "12345678",
address_line1: "Business Park 1",
city: "Tallinn",
country: "EE"
})
Summary
Functions
Creates a changeset for billing profile creation and updates.
Returns the display name for the billing profile.
Returns formatted address as a multi-line string.
Returns a snapshot of billing profile for order/invoice storage.
Functions
Creates a changeset for billing profile creation and updates.
Returns the display name for the billing profile.
Returns formatted address as a multi-line string.
Returns a snapshot of billing profile for order/invoice storage.
This creates an immutable copy of billing details at a point in time.