# Payment schemes

> The three ways a solana_pay_kit gate charges — fixed charge, metered usage (upto), and session — and the decorator/dependency each uses.

A gate's scheme is decided by which gating primitive you mount. All three ship across the framework shims (the session gate is FastAPI-first).

| Scheme        | Primitive                            | What it does                                                                         |
| ------------- | ------------------------------------ | ------------------------------------------------------------------------------------ |
| Fixed charge  | `require_payment` / `RequirePayment` | Charge a fixed amount once, settled before the view runs.                            |
| Metered usage | `require_usage` / `RequireUsage`     | Authorize a ceiling, meter actual usage, settle the real amount and refund the rest. |
| Session       | `RequireSession`                     | Open a metered payment channel, bill per delivery, settle on idle-close.             |

<Callout type="info">
  Usage gates settle via x402 `upto`, so they are **x402-only and cannot carry fees**. `subscription` and x402
  `batch-settlement` are not implemented in Python.
</Callout>

## Fixed charge

The default gate: a fixed price the client settles over **MPP or x402** (its choice). Settlement runs before your view.

<Snippet lang="python" name="charge.server" path="/quote" />

The client side pays in one call through the x402 transport — see [Client](/docs/sdk/python/client):

<Snippet lang="python" name="charge.client" url="https://api.example.com/quote" />

## Metered usage (`upto`)

A usage gate advertises `amount` as the **ceiling**. The client opens a payment channel depositing that maximum; the handler meters real usage and reports it through the `Charge` dependency (`charge.charge(base_units)`); the gate settles the actual amount and refunds the remainder after the handler returns.

<Snippet lang="python" name="upto.server" path="/summarize" />

## Session

A session gate opens a metered payment channel (MPP). `RequireSession` is the 402 gate — it verifies a credential/voucher or answers with a fresh challenge — and the reserve/commit metering side channel is mounted from `session_routes`. Settlement runs on idle-close when an operator signer and RPC are configured.

<Snippet lang="python" name="session.server" path="/stream" />
