Skip to content

About

Minimal x402 pay-per-use example for Strale data capabilities on Base mainnet

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

strale-x402-starter

Pay for verified data with USDC on Base. No API key. No signup.

This is a minimal example showing how to call Strale data capabilities via the x402 protocol — HTTP-native payments for AI agents.

What is x402?

x402 adds a payment layer to HTTP. Your agent makes a request, gets a 402 response with payment details, pays with USDC on Base, and receives the data. Two HTTP calls, no accounts.

How it works

1. GET /x402/iban-validate?iban=DE89370400440532013000
   → 402 Payment Required (price, wallet, payment instructions)

2. Pay USDC on Base using the payment details

3. GET /x402/iban-validate?iban=DE89370400440532013000
   + X-PAYMENT header with payment proof
   → 200 OK (structured JSON result)

Prerequisites

  • Node.js 18+
  • A Base wallet with USDC (for paid capabilities)

Quick start

git clone https://github.com/strale-io/strale-x402-starter.git
cd strale-x402-starter
npm install
npx tsx index.ts

What this example does

  1. Discovers available x402 endpoints via /.well-known/x402.json
  2. Requests a capability and receives the 402 payment details
  3. Shows the payment flow structure

The free-tier capabilities (iban-validate, email-validate, dns-lookup, json-repair, url-to-markdown) return data directly without payment — useful for testing the flow.

x402 catalog

Browse all available x402 endpoints:

curl https://api.strale.io/.well-known/x402.json

Links

License

MIT

About

Minimal x402 pay-per-use example for Strale data capabilities on Base mainnet

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages