StableOps

Online x402 test

Request an x402 Sandbox resource online, inspect the payment requirements in its HTTP 402 response, and verify the Agent Payments flow.

x402 is an HTTP-native machine-payment protocol. The resource server first returns 402 Payment Required with a PAYMENT-REQUIRED header. After authorization, the payer requests the same resource with PAYMENT-SIGNATURE.

Inspect payment requirements

The panel below only reads the 402 challenge actually returned by the resource URL you enter. Network, asset, amount, recipient, and payment scheme come from the response; the panel does not assume Base Sepolia, USDC, or exact. It does not hold a private key, create an Intent, or pay from the browser.

Online x402 test

Request the resource URL you enter and inspect the HTTP 402 payment challenge it actually returns.

This is the URL your Agent should pass to x402Fetch.

This page only inspects the seller challenge. Use @stableops/agent-sdk and your signer sidecar to complete the payment.

const result = await agent.x402Fetch("https://x402-base-sepolia-resource.vercel.app/api/x402/resource")
Reading a challenge does not establish that the resource or quote is trustworthy. Before paying, compare its network, asset, amount, recipient, and payment scheme with your expected configuration. This panel never connects a wallet or initiates payment.

Request the resource from an Agent

The complete payment must run in a server-side Node.js Agent:

import { SettlementUnknownError } from '@stableops/agent-sdk'

try {
  const result = await agent.x402Fetch(process.env.X402_RESOURCE_URL!, {
    idempotencyKey: 'sandbox-resource:demo-1',
  })

  if (result.status === 'paid') {
    const body = await result.response.text()
    const payment = await agent.getPayment(result.intentId)
    console.log({ body, paymentStatus: payment.status })
  } else if (result.status === 'awaiting_approval') {
    console.log(`Waiting for approval: ${result.intentId}`)
  } else {
    console.log(await result.response.text())
  }
} catch (error) {
  if (error instanceof SettlementUnknownError) {
    console.error(`Settlement is unknown; reconcile Intent ${error.intentId}`)
  }
  throw error
}

Reuse the same idempotency key when retrying one purchase. After approval, resume with the original intentId as resumeIntentId; do not create a replacement Intent.

status: 'paid' means the paid HTTP request produced a reliable response. It does not guarantee that the control plane has confirmed settled. Use agent.getPayment(intentId), the management client, or signed Webhooks for final state.

See the quickstart for policy, budget, wallet, and signer configuration.

How is this guide?

Last updated

On this page