# `PaperTiger.TestTokens`
[🔗](https://github.com/EnaiaInc/paper_tiger/blob/v1.2.2/lib/paper_tiger/test_tokens.ex#L1)

Pre-defined Stripe test tokens that are always available in PaperTiger.

Stripe provides special test tokens like `pm_card_visa` and `tok_visa` that work
without creating payment methods from card details. PaperTiger must provide these
same tokens so that library users don't have to change their code when switching
between real Stripe and PaperTiger.

## Supported Payment Method Tokens (pm_card_*)

### By Card Brand
- `pm_card_visa` - Visa (4242424242424242)
- `pm_card_visa_debit` - Visa Debit
- `pm_card_mastercard` - Mastercard (5555555555554444)
- `pm_card_mastercard_debit` - Mastercard Debit
- `pm_card_mastercard_prepaid` - Mastercard Prepaid
- `pm_card_amex` - American Express (378282246310005)
- `pm_card_discover` - Discover (6011111111111117)
- `pm_card_diners` - Diners Club (3056930009020004)
- `pm_card_jcb` - JCB (3566002020360505)
- `pm_card_unionpay` - UnionPay (6200000000000005)

### Special Behavior Cards
- `pm_card_chargeDeclined` - Always declines
- `pm_card_chargeDeclinedInsufficientFunds` - Declines with insufficient funds
- `pm_card_chargeDeclinedFraudulent` - Declines as fraudulent

## Supported Token Tokens (tok_*)

- `tok_visa`, `tok_mastercard`, `tok_amex`, etc. (same brands as pm_card_*)

## Usage

These tokens are automatically loaded when PaperTiger starts.

# `load`

```elixir
@spec load() :: {:ok, map()}
```

Loads all pre-defined test tokens into PaperTiger stores.

Called automatically on PaperTiger startup.
Returns `{:ok, stats}` with counts of loaded tokens.

# `materialize_payment_method`

```elixir
@spec materialize_payment_method(String.t(), map()) ::
  {:ok, map()} | {:error, :not_found}
```

Materializes a fresh PaymentMethod from a predefined `pm_card_*` test token.

Stripe treats these fixtures as reusable tokens in attach/setup flows: each
use yields an ordinary PaymentMethod instance that can be attached to one
customer without consuming the named fixture globally.

# `payment_method_ids`

```elixir
@spec payment_method_ids() :: [String.t()]
```

Returns a list of all supported pm_card_* token IDs.

# `test_payment_method_id?`

```elixir
@spec test_payment_method_id?(term()) :: boolean()
```

Returns true when the given ID is one of Stripe's predefined `pm_card_*`
test payment method tokens.

# `token_ids`

```elixir
@spec token_ids() :: [String.t()]
```

Returns a list of all supported tok_* token IDs.

---

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