# Paying Affiliate.com

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://zeroclick.affiliate.com/zcj/n09siuvceyf4/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://zeroclick.affiliate.com/zcj/n09siuvceyf4/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://zeroclick.affiliate.com/zcj/n09siuvceyf4/payment/card.md): plan purchases and pay-as-you-go calls of $0.50 or more. 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://zeroclick.affiliate.com/zcj/n09siuvceyf4/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:
- **Credits** - prepaid credit, $0.50 minimum per purchase. Calls draw it down; top up with `POST /extend`.

- Buy: `POST https://zeroclick.affiliate.com/zcj/n09siuvceyf4/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).
- 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://zeroclick.affiliate.com/zcj/n09siuvceyf4/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://zeroclick.affiliate.com/zcj/n09siuvceyf4/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 the platform's buyer terms of service (https://www.zeroclick.ai/legal/buyer-terms-of-service). 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 link travels in every payment challenge and receipt as `terms`.

The full error reference is at https://zeroclick.affiliate.com/zcj/n09siuvceyf4/errors.md.

