Saltar al contenido principal
POST
/
api
/
v1
/
x402
/
pay
x402 Pay
curl --request POST \
  --url https://api.agentwallex.com/api/v1/x402/pay \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "agent_id": "agent_abc123",
  "target_url": "https://paid-api.example.com/v1/data",
  "session_id": "sess_xyz789",
  "chain": "eip155:84532"
}
'
{
  "ledger_id": "ldg_abc123",
  "amount": "0.10",
  "fee_amount": "0.002",
  "fee_rate": "2.0",
  "token": "USDC",
  "chain": "eip155:84532",
  "status": "completed",
  "payment_signature": "base64_encoded_signature..."
}
Negocie y complete un pago x402 para una URL objetivo. AgentWallex evalúa las políticas del agente, firma el pago mediante MPC y devuelve la información de pago necesaria para acceder al recurso pagado.

Cuerpo de la solicitud

agent_id
string
requerido
El agente cuya billetera financiará el pago.
target_url
string
requerido
La URL habilitada para x402 por la que se pagará (por ejemplo, https://paid-api.example.com/v1/data).
session_id
string
ID de sesión opcional para deducir de un presupuesto de sesión existente. Consulte Sesiones x402.
chain
string
Identificador de cadena CAIP-2 para la liquidación del pago (por ejemplo, eip155:84532). Si se omite, se usa la cadena predeterminada del agente.

Respuesta

Ejemplo

curl -X POST https://api.agentwallex.com/api/v1/x402/pay \
  -H "X-API-Key: awx_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "agent_abc123",
    "target_url": "https://paid-api.example.com/v1/data",
    "session_id": "sess_xyz789",
    "chain": "eip155:84532"
  }'
Response
{
  "ledger_id": "ldg_abc123",
  "amount": "0.10",
  "fee_amount": "0.002",
  "fee_rate": "2.0",
  "token": "USDC",
  "chain": "eip155:84532",
  "status": "completed",
  "payment_signature": "base64_encoded_signature..."
}

Endpoints relacionados

EndpointDescripción
POST /x402/checkVerificar si una URL soporta negociación de pago x402
POST /x402/facilitator/verifyVerificar una firma de pago (para proveedores de servicios)
POST /x402/facilitator/settleLiquidar un pago verificado (para proveedores de servicios)
GET /x402/facilitator/supportedListar cadenas compatibles para x402
GET /x402/fees/tiersObtener el programa actual de niveles de tarifas

Autorizaciones

X-API-Key
string
header
requerido

API key authentication. Keys are prefixed with awx_.

Cuerpo

application/json
agent_id
string
requerido

The agent whose wallet will fund the payment.

target_url
string<uri>
requerido

The x402-enabled URL to pay for (e.g., https://paid-api.example.com/v1/data).

session_id
string

Optional session ID to deduct from an existing session budget.

chain
string

CAIP-2 chain identifier for payment settlement (e.g., eip155:84532). If omitted, the agent's default chain is used.

Respuesta

Payment completed successfully.

Result of an x402 payment negotiation.

ledger_id
string

Internal ledger entry ID for this payment.

amount
string

Payment amount.

fee_amount
string

Platform fee deducted.

fee_rate
string

Fee percentage applied (based on tiered pricing).

token
string

Token used for payment (e.g., USDC).

chain
string

Chain used for settlement.

status
enum<string>

Payment status.

Opciones disponibles:
completed,
pending,
failed
payment_signature
string

The PAYMENT-SIGNATURE value to include in the retry request to the target URL.