# `PaperTiger.Resources.PaymentIntent`
[🔗](https://github.com/EnaiaInc/paper_tiger/blob/v1.2.2/lib/paper_tiger/resources/payment_intent.ex#L1)

Handles PaymentIntent resource endpoints.

## Endpoints

- POST   /v1/payment_intents      - Create payment intent
- GET    /v1/payment_intents/:id  - Retrieve payment intent
- POST   /v1/payment_intents/:id          - Update payment intent
- GET    /v1/payment_intents              - List payment intents
- POST   /v1/payment_intents/:id/confirm  - Confirm payment intent
- POST   /v1/payment_intents/:id/cancel   - Cancel payment intent
- POST   /v1/payment_intents/:id/capture  - Capture manual payment intent

Note: Payment intents cannot be deleted (only canceled).

## PaymentIntent Object

    %{
      id: "pi_...",
      object: "payment_intent",
      created: 1234567890,
      amount: 2000,  # Amount in cents
      currency: "usd",
      status: "requires_payment_method",
      customer: "cus_...",
      payment_method: "pm_...",
      metadata: %{},
      # ... other fields
    }

# `cancel`

```elixir
@spec cancel(Plug.Conn.t(), String.t()) :: Plug.Conn.t()
```

Cancels a payment intent that has not reached a terminal successful state.

# `capture`

```elixir
@spec capture(Plug.Conn.t(), String.t()) :: Plug.Conn.t()
```

Captures a payment intent confirmed with capture_method=manual.

# `confirm`

```elixir
@spec confirm(Plug.Conn.t(), String.t()) :: Plug.Conn.t()
```

Confirms a payment intent, transitioning it to "succeeded" and creating
a charge + balance transaction for automatic capture or an uncaptured charge
for manual capture.

# `create`

```elixir
@spec create(Plug.Conn.t()) :: Plug.Conn.t()
```

Creates a new payment intent.

## Required Parameters

- amount - Amount in cents (e.g., 2000 for $20.00)
- currency - Three-letter ISO currency code (e.g., "usd")

## Optional Parameters

- customer - Customer ID this payment is for
- payment_method - Payment method ID to use
- metadata - Key-value metadata
- description - Payment description
- statement_descriptor - Descriptor for bank statements

# `list`

```elixir
@spec list(Plug.Conn.t()) :: Plug.Conn.t()
```

Lists all payment intents with pagination.

## Parameters

- limit - Number of items (default: 10, max: 100)
- starting_after - Cursor for pagination
- ending_before - Reverse cursor
- customer - Filter by customer ID
- status - Filter by status

# `retrieve`

```elixir
@spec retrieve(Plug.Conn.t(), String.t()) :: Plug.Conn.t()
```

Retrieves a payment intent by ID.

# `search`

```elixir
@spec search(Plug.Conn.t()) :: Plug.Conn.t()
```

Searches payment intents with Stripe-style search query syntax.

# `update`

```elixir
@spec update(Plug.Conn.t(), String.t()) :: Plug.Conn.t()
```

Updates a payment intent.

## Updatable Fields

- amount
- customer
- payment_method
- metadata
- description
- statement_descriptor

---

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