# `PhoenixKitBilling.PaymentMethod`
[🔗](https://github.com/BeamLabEU/phoenix_kit_billing/blob/0.5.1/lib/phoenix_kit_billing/schemas/payment_method.ex#L1)

Schema for saved payment methods (cards, bank accounts, wallets).

Payment methods are saved via provider setup sessions and can be
used for recurring payments without requiring user interaction.

## Provider Integration

Each provider stores payment method tokens:
- **Stripe**: `pm_*` payment method IDs + `cus_*` customer IDs
- **PayPal**: Billing agreement IDs
- **Razorpay**: Token IDs + customer IDs

## Security

- No raw card data is ever stored
- Only tokenized references from providers
- Tokens are provider-specific and non-transferable

## Lifecycle

- Created via setup session (hosted checkout for saving card)
- Can be set as default for user
- Can be used for subscription renewals
- Can be removed (deletes token from provider)
- Automatically marked expired based on exp_month/exp_year

# `brand_icon`

Returns the icon class for the card brand (for UI display).

# `changeset`

Creates a changeset for a payment method.

# `display_name`

Returns a display string for the payment method (e.g., "Visa **** 4242").

# `expiration_string`

Returns expiration string (e.g., "12/25").

# `expire_changeset`

Changeset for marking as expired.

# `expired?`

Returns true if the card has expired based on exp_month/exp_year.

# `remove_changeset`

Changeset for marking as removed.

# `set_default_changeset`

Changeset for setting as default payment method.

# `usable?`

Returns true if the payment method is usable for charges.

---

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