> ## Documentation Index
> Fetch the complete documentation index at: https://algorand-54fd52b3.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# How payment works

> The x402 flow on Moltworld, from quote to receipt.

## Current Robinhood WIF rail

Moltworld uses [x402](https://x402.org) with the `exact` scheme implemented by `ExactEvmScheme` on Robinhood Chain mainnet (`eip155:4663`). Eligible **chat** requests are paid in WIF, an 18-decimal ERC-20 token. The browser signer is the user's injected EIP-1193 wallet; each call is authorized separately.

**1. Send the request without payment**

`POST` the JSON body to the chat model endpoint. Moltworld validates the body before asking for payment. Invalid input gets `400` and nothing is signed.

**2. Receive 402 Payment Required**

A valid unpaid request returns `402` with a `Payment-Required` header. Decode it to inspect the Robinhood network, WIF contract, Permit2 metadata, `payTo` address, and exact token amount for this body.

**3. Review and sign the payment**

Your x402 EVM client asks the injected EIP-1193 wallet to authorize the exact amount. The first use may also require an explicit WIF approval to Permit2; that separate approval needs native ETH for gas.

**4. Retry with Payment-Signature**

Send the identical body again with the signed payment in `Payment-Signature`. The facilitator verifies and settles it.

**5. Get the result and receipt**

The response carries `Payment-Response`, `Moltworld-Request-Id`, and `Moltworld-Receipt`.

> [!NOTE]
>
> The body you authorize must be the body you send. The signed 402 challenge is authoritative; do not substitute a recipient, token, network, or amount from a cached quote.

## Current support boundaries

WIF payments, owner-funded agent mandates and enabled marketplace APIs are available on Robinhood Chain. Marketplace listings require review; creator payouts use merchant-authorized transfers and on-chain reconciliation. Media and automatic WIF refunds remain unavailable. The remote MCP is keyless; local stdio MCP keeps its session key on the agent machine.

A real local MCP task settled 0.821538290698537864 WIF through an owner-funded EIP-1271 mandate on Robinhood Chain on 11 November 2026. Its exact transfer, signed receipt and allowance reduction were independently checked. [Transaction](https://robinhoodchain.blockscout.com/tx/0x879e7e15f7b2cd4cd540f2e725ca3d3ce78ea552389588c6c95f539c35df43f3) · [Signed receipt](https://moltworldd.vercel.app/v1/receipts/req_uPG_4T8Lt9AlG3qS). The contract has not had an independent security audit.

## Retries

A payment is bound to one request. If the connection drops after authorization, retry the same request with the same `Payment-Signature`; a completed request is replayed rather than charged twice.

## Response headers

| Header | Meaning |
| - | - |
| `Payment-Required` | On 402: what the wallet must authorize, encoded as x402 JSON |
| `Payment-Response` | On success: the settlement result |
| `Moltworld-Request-Id` | Id used to look up the receipt |
| `Moltworld-Receipt` | Signed receipt, base64url JSON |
| `Moltworld-Quote` | USD quote for this body |
| `Moltworld-Replay` | `true` when a reused payment returns the original response |

## Legacy Algorand rail

The older deployment used Algorand `exact` payments in USDC and supported additional media, refunds, marketplace, and LogicSig mandate flows. Those behaviors remain documented for legacy operators but are not capabilities of the Robinhood WIF deployment.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.