Integrate XGuard

Base URL: https://xguardgate.com. Use the live API key returned during registration as a Bearer token.

01

Register your application

Create a merchant identity and receive the API key once.

curl -X POST https://xguardgate.com/v1/register \
  -H 'content-type: application/json' \
  -d '{"name":"my-x402-app"}'

The response contains apiKey, merchant metadata and the XGuard treasury address. Store the key immediately.

02

Check service balance

curl https://xguardgate.com/v1/balance \
  -H 'authorization: Bearer xg_live_YOUR_KEY'
03

Fund the prepaid service balance

Create a top-up intent. The response tells you the exact native USDC amount on Base, treasury address, expiry and claim token. After sending that exact amount, claim it with the transaction hash.

curl -X POST https://xguardgate.com/v1/topups/intents \
  -H 'authorization: Bearer xg_live_YOUR_KEY' \
  -H 'content-type: application/json' \
  -d '{"amountUsd":"1.00"}'
curl -X POST https://xguardgate.com/v1/topups/claim \
  -H 'authorization: Bearer xg_live_YOUR_KEY' \
  -H 'content-type: application/json' \
  -d '{"claimToken":"TOKEN_FROM_INTENT","transactionHash":"0x..."}'
04

Verify an x402 v2 payment

Send the canonical x402 v2 facilitator envelope.

curl -X POST https://xguardgate.com/verify \
  -H 'authorization: Bearer xg_live_YOUR_KEY' \
  -H 'content-type: application/json' \
  -d @x402-request.json
05

Settle through XGuard

Use the same canonical x402 v2 envelope. XGuard adds replay protection, concurrency protection, routed execution, finality handling and settlement truth metadata.

curl -X POST https://xguardgate.com/settle \
  -H 'authorization: Bearer xg_live_YOUR_KEY' \
  -H 'content-type: application/json' \
  -d @x402-request.json
Settlement fee$0.04 once per authenticated, parseable economic attempt. Downstream failure does not refund the attempt fee. Malformed or unauthenticated requests and idempotent retries do not incur an additional attempt fee.
REF