# Paying Pubrio

Payment happens over the standard `402 payment_required` flow: send your request, receive a priced 402, settle it, and retry the same request with the proof attached. There is no separate identity step for a per-call payment - the signed payment proves who you are.

Pay-as-you-go calls are charged per request: one 402 per call. Credit and subscription plans are purchased once (`POST /plans/{planId}/purchase`), then calls draw down the balance or run within the period.

## Rails

- [x402](https://agents.pubrio.com/zcj/1a9mcogbgy5u/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.pubrio.com/zcj/1a9mcogbgy5u/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.pubrio.com/zcj/1a9mcogbgy5u/payment/card.md): plan purchases and pay-as-you-go calls of $0.55 or more. No wallet needed; eligible hosted checkouts support browser agents with Link Pay Tokens (LPT), with human checkout as a fallback.

## 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 [auth.md](https://agents.pubrio.com/zcj/1a9mcogbgy5u/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:
- **Free trial** - free trial granting $1 of credit, claimed once per human with no payment.
- **Starter** - prepaid credit, $50 minimum per purchase. Calls draw it down; top up with `POST /extend`.
- **Scale** - prepaid credit, $495 minimum per purchase. Calls draw it down; top up with `POST /extend`.

- Buy: `POST https://agents.pubrio.com/zcj/1a9mcogbgy5u/plans/{planId}/purchase`. Credit plans take an amount (`{ "amountUsd": "25.000000" }`, a whole-cent value of at least the plan's `purchase.minimumUsd` and, when the plan sets one, at most `purchase.maximumUsd`); subscription plans take no amount (the base price is charged).
- For a NEW card-funded credit purchase use `purchase.cardMinimumUsd`: it is the larger of the plan minimum and the $0.55 card floor, rounded up to whole cents. Card never lowers the plan minimum. Wallet-funded purchases and top-ups must also meet the plan's `purchase.minimumUsd`; a sub-$0.55 top-up is possible with x402 or MPP only when that plan minimum allows it. A fixed-price plan priced under that floor carries `"cardEligible": false` and cannot be bought by card at all.
- Claim the free trial: the same `POST /plans/{planId}/purchase` with your bearer and an empty body - no payment, one per human.
- Plans with `"verifiedEmailPolicy": "required"` in the catalog refuse purchase with `403 verified_email_required` until your credential is claimed by your human with a verified email - the Claim step in [auth.md](https://agents.pubrio.com/zcj/1a9mcogbgy5u/auth.md). Terminal for the current credential state - complete the claim, do not retry.
- Purchases of plans whose `verifiedEmailPolicy` is `"requested"` or `"required"` share your human's verified email with this seller so it can tie what you bought to their account - at purchase when the claim already exists, or later once your human claims your credential.
- Extend / top up: when a credit balance runs low or a call returns `usage_exhausted`, add credit with `POST https://agents.pubrio.com/zcj/1a9mcogbgy5u/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 [manifest.json](https://agents.pubrio.com/zcj/1a9mcogbgy5u/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.

Terms: by completing a purchase through this endpoint, whether directly or through an AI agent acting on your behalf, you agree to be bound by Pubrio's terms of service (https://www.pubrio.com/terms-of-service) and the platform's buyer terms of service (https://www.zeroclick.ai/legal/buyer-terms-of-service). Pubrio's privacy policy: https://www.pubrio.com/privacy-policy. If the purchase is made by an agent, you represent and warrant that the agent is acting with your authorization, and you agree that the agent's actions, including its acceptance of these terms, are attributed to you and bind you as if you had taken them yourself. Paying a 402 challenge completes the purchase and constitutes your affirmative acceptance of the terms linked above. The links travel in every payment challenge and receipt as `terms`.

The full error reference is at [errors.md](https://agents.pubrio.com/zcj/1a9mcogbgy5u/errors.md).

