# `PhoenixKit.Modules.Billing.BillingProfile`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.63/lib/modules/billing/schemas/billing_profile.ex#L1)

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_uuid`: Foreign key to the user
- `type`: Profile type - "individual" or "company"
- `is_default`: Whether this is the user's default billing profile
- `name`: Display name for the profile

### Individual Fields
- `first_name`, `last_name`, `middle_name`: Person's name
- `phone`: Contact phone number
- `email`: Billing email (can differ from user email)

### Company Fields (EU Standard)
- `company_name`: Legal company name
- `company_vat_number`: EU VAT Number (e.g., "EE123456789")
- `company_registration_number`: Company registration number
- `company_legal_address`: Registered legal address

### Billing Address
- `address_line1`, `address_line2`: Street address
- `city`, `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"
    })

# `changeset`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.63/lib/modules/billing/schemas/billing_profile.ex#L104)

Creates a changeset for billing profile creation and updates.

# `display_name`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.63/lib/modules/billing/schemas/billing_profile.ex#L261)

Returns the display name for the billing profile.

# `formatted_address`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.63/lib/modules/billing/schemas/billing_profile.ex#L246)

Returns formatted address as a multi-line string.

# `to_snapshot`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.63/lib/modules/billing/schemas/billing_profile.ex#L213)

Returns a snapshot of billing profile for order/invoice storage.

This creates an immutable copy of billing details at a point in time.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
