# Paid on delivery, for your own endpoint

Version 2026.09.1.

Your buyer's money waits in the audited Base escrow (`AuthCaptureEscrow` v1.1,
`0xf96815976523E00e65Be8f34cA5e64b4f41EB19c`) until you have served the call. Then you ask
Teppi to capture it, sending the bytes you served. Teppi checks them the way it checks every
paid call: the answer came back, it is not an error, and it matches the output schema you
published. If they pass, Teppi captures the payment to you, minus its fee. If they do not, Teppi
hands the money back to the buyer. If you never ask, the money goes back to the buyer before the
deadline. Nobody, Teppi included, can send it anywhere else: the escrow pays only you, the fee
recipient you agreed to, or the buyer.

This is x402's `auth-capture` scheme with Teppi's operator as `captureAuthorizer`
(`operatorType: delegated`) and your own key as `receiverAuthorizer`. Any x402 client that
supports `auth-capture` pays it, including the official one with `AuthCaptureEvmScheme`.

## What it costs

Teppi takes a fee only when it captures. The fee is half again what locking and capturing cost in
gas at that minute, read off Base and Chainlink's ETH / USD, and it is fixed when the money is
locked, so you sign exactly what you will pay. Today that is under a cent. It must fit inside the
fee bounds your terms offer (`minFeeBps` 0, `maxFeeBps` 1000): a payment too small for a fee
inside them to cover the gas is refused before anything is locked, and nothing is charged. A void
costs you nothing; its gas is Teppi's.

Using Teppi to capture never changes your grade, your rank or whether the router buys from you.
Whoever settles your payments is not read by any card, and a test holds that.

## The four steps

1. **Terms.** Read `GET https://api.teppi.xyz/v1/facilitator/supported` and copy its
   `captureAuthorizer`, `feeRecipient` and fee bounds into your 402, with your own
   `receiverAuthorizer` and `payTo`. `teppiEscrowTerms()` in `teppi-client` writes it.
2. **Lock.** When a buyer pays, send its payment and your terms to
   `POST /v1/facilitator/settle`, as you would to any facilitator. The answer carries the lock's
   transaction and, under `extensions.teppi`, the `paymentInfoHash` and the `captureFee` your
   capture must name.
3. **Serve** the call.
4. **Capture.** Sign the capture with your `receiverAuthorizer` key (`captureAsk()` gives the
   typed data the spec names) and send it to `POST /v1/facilitator/settle` with the status,
   content type and body you served (`captureRequest()` builds it). The answer is the capture's
   transaction, or a void and the check that failed, and in both cases a statement Teppi signed:
   pass it on to your buyer in `PAYMENT-RESPONSE`.

```ts
import { captureAsk, captureRequest, teppiEscrowTerms } from 'teppi-client';

const kind = (await (await fetch('https://api.teppi.xyz/v1/facilitator/supported')).json()).kinds[0];
const terms = teppiEscrowTerms({ kind, payTo, amount: '1000000', receiverAuthorizer: key.address, resource, outputSchema });
// ... after the buyer paid and /settle locked it (locked = extensions.teppi):
const signature = await key.signTypedData(captureAsk(kind.extra.captureAuthorizer, locked, '1000000'));
const answer = await fetch('https://api.teppi.xyz/v1/facilitator/settle', {
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify(captureRequest(locked, '1000000', signature, { status: 200, contentType, body })),
});
```

## What your buyer can check

The statement names the hash of the bytes you declared. A buyer holding the bytes it received
checks them with `verifyDelivery(statement, body, keys)`; if they differ, it signs a dispute with
its own wallet and `POST /v1/facilitator/disputes` keeps it beside the payment. A dispute is never
a grade and Teppi never decides it. A capture rests on the bytes you declared, and the statement
says so.

## The record

`GET /v1/facilitator/record` lists every payment settled here: who it paid, how it ended, the
check that failed if one did, and how many disputes it carries, each move a transaction on Base.
It never holds the bytes you served.

## Changelog

### 2026.09.1

| Change | Reason |
|---|---|
| First version | Teppi captures escrowed payments for sellers that name it, only for a delivery that passed its checks, with a fee only on a capture that covers its gas |
