Get started

Test a paid request

Pay a protected endpoint from a Base Sepolia test wallet and verify its receipt.

This page pays an endpoint you protected with FastAPI, Django, or direct HTTP. The payer uses Coinbase Agentic Wallet (AWAL) with Base Sepolia test USDC.

You need Node.js 24 or newer, an email address for AWAL, and an endpoint that already returns its unpaid 402. The commands use a POSIX shell on macOS or Linux; on Windows, use WSL.

The guides use a fixed 0.01 USD test price. recuut asks the wallet for 10,000 atomic units of Base Sepolia USDC because USDC has six decimal places. The wallet command caps the request at 100,000 atomic units, or 0.10 USDC.

Commands on this page use AWAL 2.12.1. You are ready for the paid retry when the endpoint returns its unpaid 402, AWAL status shows an authenticated wallet, its address command prints an address, and its Base Sepolia balance shows at least 0.01 USDC.

Create and fund the Base Sepolia wallet

AWAL stores its own key. auth login prints a flow ID and emails a one-time code. Pass both to auth verify, then confirm with status:

npx [email protected] auth login "[email protected]"npx [email protected] auth verify "<flow-id>" "<one-time-code>"npx [email protected] status

Print the wallet address:

npx [email protected] address

Open the Circle Faucet, select USDC and Base Sepolia, paste that AWAL address, and choose Send 20 USDC. Then check the balance with npx [email protected] balance --chain base-sepolia.

The fixed exact-USDC payment is gasless, so the AWAL address does not need Base Sepolia ETH. It needs at least 0.01 test USDC. If the balance is still zero, wait for the faucet transaction to confirm, verify that Base Sepolia—not Base—was selected, then check again.

Run the paid retry

Set PROTECTED_RESOURCE_URL to the endpoint you are testing, such as http://127.0.0.1:8000/generate, then let AWAL make the initial request, read the 402, authorize the payment, and retry:

npx [email protected] statusnpx [email protected] balance --chain base-sepolianpx [email protected] x402 pay "$PROTECTED_RESOURCE_URL" \  -X POST \  -h '{"Content-Type":"application/json"}' \  -d '{"prompt":"paid testnet response"}' \  --max-amount 100000 \  --json

Approve only if the wallet shows Base Sepolia USDC and no more than 0.10 USDC.

A successful response carries your protected result and PAYMENT-RESPONSE. The direct HTTP example returns this shape:

HTTP/1.1 200 OKPAYMENT-RESPONSE: <base64 payment receipt>content-type: application/json{"text":"PAID TESTNET RESPONSE","transaction_id":"txn_..."}

If the endpoint returns HTTP 202, payment is still settling or reconciling. The response contains no protected result and no PAYMENT-RESPONSE. Keep the transaction ID, wait briefly, and check the saved transaction instead of treating the request as paid.

Verify the receipt

Copy the transaction ID into TRANSACTION_ID, then query it with the same server key. The direct HTTP example returns it as transaction_id; for any integration, Transactions in the recuut app lists it.

curl --request GET \  --url "${RECUUT_API_URL:-https://api.recuut.com}/merchant/v1/transactions/$TRANSACTION_ID" \  --header "Authorization: Bearer $RECUUT_API_KEY"

Completion is proven only when status is succeeded and receipt is present.

The receipt should name test, Base Sepolia (eip155:84532), USDC, the resource, and the 10,000-atomic-unit payment.

Pending or failed records have no receipt. Transactions and receipts explains each status.

Once the paid test passes, go live.

On this page