Developers Forum for XinFin XDC Network

Satheesh Kumar
Satheesh Kumar

Posted on

Extending Agentic XDC Payments with x402 Micropayments

Introduction

Artificial Intelligence is moving from answering questions to taking action — calling tools, moving money, and completing tasks autonomously.

Rushabh's Agentic XDC Payments showed a powerful pattern: users type plain English, and an AI agent sends USDC on XDC Network without opening a wallet UI.

That demo answers one question:

"How do I pay a person on-chain?"

This project extends that idea to a second question:

"How does an AI agent pay for services on the internet — APIs, data, tools — without API keys, subscriptions, or signups?"

The answer is x402 — the HTTP 402 Payment Required standard for pay-per-use micropayments in USDC.

Instead of only sending USDC to a wallet address, the same agent can:

  • Call a paid FX rate API
  • Receive HTTP 402 with the price
  • Pay USDC on XDC
  • Retry the request with payment proof
  • Return the result in plain English

No account. No API key. No monthly subscription. Just pay-per-call.


What the Project Does

This is an end-to-end MVP with three parts:

Component Role
React Chat UI User asks in natural language
AI Agent (Node.js) Parses intent, pays USDC, calls APIs
FX API Server (Node.js) Serves exchange rates behind an x402 paywall

Two agent skills — one wallet

You say What happens
"What's the GBP/USD rate?" x402 flow: 402 → pay 0.1 USDC → retry → FX data
"Send 1 USDC to 0xB0EF…" Direct USDC transfer (same as the original article)

One XDC wallet. Two use cases. People and APIs.


Why x402? Why Not a Normal HTTP API?

Most APIs today work like this:

  1. Sign up on the provider's website
  2. Add a credit card or buy credits
  3. Get an API key
  4. Store and rotate that key
  5. Pay monthly or prepay

That model was built for humans. It is awkward for autonomous AI agents.

x402 embeds payment into HTTP itself:

GET /fx/GBP-USD → HTTP 402 Payment Required → Agent pays USDC on XDC → GET /fx/GBP-USD + X-PAYMENT header → HTTP 200 + JSON data

Traditional API x402 API
Account required Yes No
API key Yes No
Subscription Often No
Pay per call Hard Native

The agent learns the price from the HTTP response — not from a pricing page alone.


How It Benefits the XDC Ecosystem

1. Low gas fees enable real micropayments

On high-fee chains, a $0.10 API call can cost more in gas than the payment. XDC's low fees make sub-dollar USDC payments practical.

2. USDC on XDC is the settlement layer

Network USDC Contract
XDC Mainnet 0xfA2958CB79b0491CC627c1557F441eF849Ca8eb1
XDC Apothem 0xb5AB69F7bBada22B28e79C8FFAECe55eF1c771D4

3. Extends the agentic payments story on XDC

The original article proved:

natural language → USDC on XDC

This project proves:

natural language → pay for any HTTP service on XDC

Use cases for the XDC payments ecosystem:

  • Trade finance oracles — pay per price feed
  • RWA data APIs — micropay for FX, compliance checks
  • DeFi agents — buy data before executing strategies
  • Enterprise B2B — machine-to-machine payments on XDC rails

Image description

How It Works

Step 1 — User Input

Get me the GBP/USD FX rate

Step 2 — Agent Calls API

GET /fx/GBP-USD

Server returns HTTP 402:

{
  "x402Version": 1,
  "accepts": [{
    "scheme": "exact",
    "network": "eip155:51",
    "maxAmountRequired": "100000",
    "payTo": "0x719B...",
    "asset": "0xb5AB69..."
  }]
}
Enter fullscreen mode Exit fullscreen mode

Step 3 — Agent Pays USDC on XDC

Agent sends 0.1 USDC to the API receiver wallet.

Step 4 — Agent Retries with Proof

Same request, with X-PAYMENT header containing the transaction hash.

Step 5 — User Gets the Answer

The GBP/USD exchange rate is 1.27
0.1 USDC paid → View on testnet.xdcscan.com

### Simple Flow
You    →  "What's the USD/EUR rate?"
Agent  →  calls FX API
API    →  HTTP 402 (pay 0.1 USDC)
Agent  →  pays USDC on XDC
Agent  →  retries with proof
API    →  returns FX data
You    →  gets rate + explorer link
Enter fullscreen mode Exit fullscreen mode

Conclusion

This project shows they can also pay websites and APIs — via x402, USDC, and the same agent loop.

  • 1. User expresses intent in natural language
  • 2. Agent understands and routes the request
  • 3. x402 handles pay-per-use API access
  • 4. USDC settles on XDC Network
  • 5. User gets data and an explorer link — no signup required

Discussion (0)