Test on staging (Base Sepolia, chain id 84532). You need an onboarded borrower with an ACTIVE agent grant, and a merchant that is ACTIVE in the registry with a facilitator credential.
Staging does not skip merchant KYB, and it does not issue sk_test_ keys. Ask SohoPay for a staging merchant if you do not have one.

Merchant loop

1

Return 402

Serve a credit-scheme requirement for eip155:84532 and the staging USDC asset in Environment setup.
2

Let an agent pay

The agent calls prepare_x402_payment, signs the voucher, and retries with PAYMENT-SIGNATURE. Use one idempotency key for that orderRef.
3

Capture

POST /api/v1/facilitator/capture with x402Version: 2. Save receipt.paymentId.
4

Poll

GET /api/v1/facilitator/settle/status/by-payment/:paymentId every 2 seconds. You should see CREATED, then SUBMITTED, then CONFIRMED. Fulfill only on CONFIRMED.The batch flushes about every 60 seconds, so CREATED can last that long.
5

Check the chain

Open the batch txHash on Sepolia Basescan. The merchant transfer is USDC from SohoSettlementV2, net of the fee. It is not an ERC-3009 pull from the agent.

Cases worth forcing

  • Replay capture with the same Idempotency-Key and body. You get the same receipt and replayed: true.
  • Send a V1 payment intent. Capture refuses it (X402_AGENT_VOUCHER_REQUIRED).
  • Call prepare before the workload key is registered. You get X402_AGENT_KEY_NOT_REGISTERED. Register the key and retry the same order and key.
  • Let a voucher intent expire, then retry the same order and the same key (X402_INTENT_EXPIRED).

Next steps

Errors

Which failures to retry.

Payment flow

The agent half of the same test.