메인 콘텐츠로 건너뛰기
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..."
}
대상 URL에 대한 하나의 x402 결제를 협상하고 완료합니다. AgentWallex는 에이전트의 정책을 평가하고, MPC를 통해 결제에 서명하며, 유료 리소스에 접근하는 데 필요한 결제 정보를 반환합니다.

요청 본문

agent_id
string
필수
결제에 자금을 제공할 에이전트.
target_url
string
필수
결제할 x402 지원 URL (예: https://paid-api.example.com/v1/data).
session_id
string
기존 세션 예산에서 차감하기 위한 선택적 세션 ID. x402 세션을 참조하세요.
chain
string
결제 정산을 위한 CAIP-2 체인 식별자 (예: eip155:84532). 생략하면 에이전트의 기본 체인이 사용됩니다.

응답

예시

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..."
}

관련 엔드포인트

엔드포인트설명
POST /x402/checkURL이 x402 결제 협상을 지원하는지 확인
POST /x402/facilitator/verify결제 서명 검증 (서비스 프로바이더용)
POST /x402/facilitator/settle검증된 결제 정산 (서비스 프로바이더용)
GET /x402/facilitator/supportedx402 지원 체인 목록 조회
GET /x402/fees/tiers현재 수수료 등급 일정 조회

인증

X-API-Key
string
header
필수

API key authentication. Keys are prefixed with awx_.

본문

application/json
agent_id
string
필수

The agent whose wallet will fund the payment.

target_url
string<uri>
필수

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.

응답

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.

사용 가능한 옵션:
completed,
pending,
failed
payment_signature
string

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