# `PhoenixKit.Modules.Billing.PaymentMethod`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.63/lib/modules/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`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.63/lib/modules/billing/schemas/payment_method.ex#L189)

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

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

Creates a changeset for a payment method.

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

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

# `expiration_string`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.63/lib/modules/billing/schemas/payment_method.ex#L177)

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

# `expire_changeset`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.63/lib/modules/billing/schemas/payment_method.ex#L117)

Changeset for marking as expired.

# `expired?`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.63/lib/modules/billing/schemas/payment_method.ex#L138)

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

# `remove_changeset`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.63/lib/modules/billing/schemas/payment_method.ex#L109)

Changeset for marking as removed.

# `set_default_changeset`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.63/lib/modules/billing/schemas/payment_method.ex#L101)

Changeset for setting as default payment method.

# `usable?`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.63/lib/modules/billing/schemas/payment_method.ex#L129)

Returns true if the payment method is usable for charges.

---

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