# x402 test mode

Extrovert includes a feature-flagged x402 flow for purchasing one or more inboxes with test assets. It
is separate from subscription billing and the human-controlled domain purchase flow.
**Test mode is not production payment:** The endpoint is available only when paid inboxes are enabled for the account. Otherwise it returns
  `404`. The current network and asset are test-only and do not move real money.

## Flow

1. Send `POST /v1/purchase`, or request the paid path on inbox creation when that feature is enabled.

2. The server returns `402 Payment Required` with a `PAYMENT-REQUIRED` challenge. The server computes
   the amount from its configured price and requested quantity.

3. The client signs the supported payment authorization for the exact challenge.

4. Retry the same request with the base64-encoded signed payload in `X-PAYMENT`.
   `PAYMENT-SIGNATURE` remains accepted for compatibility.

5. Extrovert verifies and settles the authorization. Inbox creation starts only after settlement is
   confirmed. settlement required

Receiving a signed payload is not enough. Verification or settlement failure returns `402` and does
not create the inboxes.

## Current test configuration

| Setting | Value |
|---|---|
| Network | Base Sepolia, CAIP-2 `eip155:84532` |
| Asset | Test USDC |
| Authorization | EIP-3009 `transferWithAuthorization` |
| Quantity | One or more inboxes, bounded by the request schema and account settings |
| Completion | `201` only after settlement and provisioning |

The challenge body follows the x402 payment-required document shape and includes an `accepts` array.
Clients should parse the returned challenge instead of hard-coding price, destination, asset, timeout,
or network values.

The TypeScript SDK exposes a `PaymentRequiredError` whose `paymentRequired` field contains the parsed
challenge. Retry with the same logical request and idempotency value after signing.

## Relationship to other controls

x402 does not replace:

- `mailbox:create` permission;
- enrollment and project inbox limits;
- rolling daily recipient accounting;
- review policy on later sends;
- suppression and contact-list checks;
- human approval for domain purchases or plan changes.

It is one optional payment gate around a specific bulk inbox creation endpoint.

## Next

- [API errors](https://docs.extrovert.dev/api/errors/)
- [Rate limits and quotas](https://docs.extrovert.dev/operating/limits/)
- [Purchase approvals for agents](https://docs.extrovert.dev/concepts/purchase-approvals-for-agents/)