# Paying Dappier

This seller sells access on plans, not per call: register an identity, buy a plan (`POST /plans/{planId}/purchase`), then call against it. The priced `402 payment_required` you settle is the plan purchase; a bare call with no plan is refused with `401`, never a per-call price.

## Rails

- [x402](https://agents.dappier.com/zcj/grahqhuwea6i/payment/x402.md): Base USDC. The challenge arrives in the `payment-required` response header; sign it and send the payload in `x-payment`.
- [MPP](https://agents.dappier.com/zcj/grahqhuwea6i/payment/mpp.md): Tempo USDC. The challenge arrives in the `www-authenticate` response header; sign a credential and send it as `Authorization: Payment <credential>`.
- [Card](https://agents.dappier.com/zcj/grahqhuwea6i/payment/card.md): plan purchases. No wallet needed; a hosted checkout can hand the payment to your human.

## The 402 body

A priced 402 carries the exact `payment.amountUsd`, the `plan`, and a `protocols` block with a challenge for each rail offered. A bare request (no authenticated rail) is offered both wallet rails; once you authenticate with one, that rail is offered on subsequent challenges. The full signable challenges also arrive as response headers, so a standard x402 or MPP client settles them without reading the body.

## Buying and extending plans

Buying a plan needs a registered agent credential first, registered at https://agents.dappier.com/zcj/grahqhuwea6i/auth.md, presented as `Authorization: Bearer <token>` - or, on MPP where `Authorization` carries the `Payment` credential, as `ZC-Agent-Authorization: Bearer <token>`. A bare purchase with no bearer returns `401 bearer_required` before any price is quoted; with the bearer you receive one priced 402 to settle.

Plans on this storefront:
- **Prepaid credits** - prepaid credit, $0.01 minimum per purchase on a wallet rail, $0.50 by card. Calls draw it down; top up with `POST /extend`.

- Buy: `POST https://agents.dappier.com/zcj/grahqhuwea6i/plans/{planId}/purchase`. Credit plans take an amount (`{ "amountUsd": "25.000000" }`, a whole-cent value of at least the plan's `purchase.minimumUsd`); subscription plans take no amount (the base price is charged).
- Paying by card raises the floor: the amount must also be at least the plan's `purchase.cardMinimumUsd` ($0.50), below which the card rail answers `400 amount_below_card_minimum`. The wallet rails still accept the plan's own `purchase.minimumUsd`, so a sub-$0.50 top-up needs x402 or MPP. A fixed-price plan priced under that floor carries `"cardEligible": false` and cannot be bought by card at all.
- Extend / top up: when a credit balance runs low or a call returns `usage_exhausted`, add credit with `POST https://agents.dappier.com/zcj/grahqhuwea6i/extend` and `{ "amountUsd": "10.000000" }` - the same one-402 payment. Your new balance returns as `access.remainingCreditUsd`.
- Live prices and the exact `purchase.url` per plan are in https://agents.dappier.com/zcj/grahqhuwea6i/manifest.json.

## Ceiling pricing - charging up to a maximum

Some meters (e.g. output tokens) cannot be known before the work runs. The 402 challenge then lists the item as {"meterSlug", "maxQuantity"} and the payment amount is a CEILING, not the price you pay - it is the most you could ever be charged, and you pay only your actual usage once the work runs (the seller may set the ceiling per request, or configure a per-meter default that applies when a request declares no maxQuantity). A ceiling-priced request settles on the RESERVE-AND-PAY-ACTUAL rails by design: your wallet reserves the ceiling up front, then you are charged only actual. Each rail is an entry in the challenge (look for the "billing" note in the entry's extra): the x402 "upto" scheme (Base USDC), where the reserved remainder simply never leaves your wallet, and the MPP "session" escrow channel (Tempo USDC), where you fund a channel to the ceiling, sign one voucher, and ZeroClick closes the channel at your actual usage so the escrow refunds the rest - and if ZeroClick ever fails to close it, you can force-close the channel yourself after the on-chain grace period to reclaim your full deposit, so escrowed funds are never stranded. One-shot prepay ("exact", the MPP charge) is never offered for a ceiling-priced request; that is what guarantees an unspent ceiling can never get stuck as seller credit. (If you already hold a prepaid balance with this seller from a plan purchase, ceiling-priced usage can still draw it down - billed at actual, like everything else.) A failed delivery debits nothing on either rail. Fixed-quantity requests are unchanged: pay "exact" or the one-shot MPP charge as always. Either way you are never charged past the ceiling, and never the full ceiling unless your usage actually reaches it. Every paid response also carries a `zc-billing` header reconciling the numbers for that request: what you authorized (`authorizedUsd`), what you were actually charged (`chargedUsd`), the remainder and where it went (`remainderUsd` + `remainderHandling`: "escrow_returned" means it never left your wallet or was refunded from escrow), plus the on-chain `settleTransactionHash` when one exists. `"status":"settling"` means on-chain settlement is still finishing and the final amounts are not stamped yet. A plan-funded response (drawing a prepaid balance, or covered by a subscription) carries the header in its plan shape instead: `fundingSource` ("credit" or "subscription"), `chargedUsd` = what your balance was actually debited for this request (zero when a flat subscription or included units covered it - never the notional metered cost), and `remainingCreditUsd` = your balance after the debit, when the plan tracks one. A delivered response with no `zc-billing` header billed nothing.

The full error reference is at https://agents.dappier.com/zcj/grahqhuwea6i/errors.md.

