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

Creates Charge objects from PaymentIntents.

Handles the PI -> Charge -> BalanceTransaction chain that Stripe performs
when a PaymentIntent succeeds. This is used by checkout session completion
and the billing engine to produce the same object graph that real Stripe does.

# `capture_payment_intent_charge`

```elixir
@spec capture_payment_intent_charge(map(), integer(), boolean()) ::
  {:ok, map()} | {:error, :not_found}
```

Captures an authorized PaymentIntent charge and links the resulting balance transaction.

# `create_for_payment_intent`

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

Creates a Charge (and its BalanceTransaction) for a succeeded PaymentIntent.

1. Builds a charge map from the PI fields
2. Inserts into the Charges store
3. Creates a BalanceTransaction via BalanceTransactionHelper
4. Updates the charge with the balance_transaction ID
5. Updates the PI with `latest_charge`
6. Fires telemetry
7. Returns `{:ok, charge}`

---

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