Developer Documentation

Documentation

Everything you need to monetize and consume paid APIs with x402wrap

Quick Start

x402wrap lets you monetize any API endpoint in seconds using the x402 protocol on Solana.

1

Create Your Paid Link

Go to the home page, enter your API URL, set a price, and provide your Solana wallet address

2

Share Your Link

Copy the generated x402wrap.com link and share it with your users

3

Get Paid Instantly

Every request to your wrapped API triggers an instant USDC payment to your wallet

How It Works

x402wrap acts as a payment gateway for your APIs. Here's what happens when someone calls your wrapped endpoint:

1. Client sends request with payment headers
2. x402wrap verifies the Solana payment
3. If valid, forwards request to your API
4. Returns your API's response to the client

All payments are instant, cryptographically verified, and sent directly to your wallet with zero intermediaries.

For API Providers

Creating a Paid Endpoint

Simply wrap your existing API endpoint with x402wrap:

Original API:
https://api.yoursite.com/data
Wrapped API:
https://x402wrap.com/abc123xyz

Pricing Strategy

Recommended pricing for different use cases:

$0.001
Simple data queries
$0.01
Real-time data feeds
$0.05+
AI/ML computations

Analytics Dashboard

Track your earnings in real-time at:

https://x402wrap.com/stats/YOUR_LINK_ID

For API Consumers

Making Paid Requests

To call a paid API, include payment proof in your request headers:

// Using fetch()const response = await fetch('https://x402wrap.com/abc123xyz', {method: 'GET',headers: {'x-payment-signature': paymentSignature,'x-payment-from': yourWalletAddress,}});

Payment Flow

Step 1: Create Solana Transaction

Send USDC to the API provider's wallet address

Step 2: Get Transaction Signature

Wait for transaction confirmation on Solana

Step 3: Make API Request

Include signature in headers when calling the wrapped API

Error Responses

// 402 Payment Required{"error": "Payment Required","payment": {"recipient": "7xKXtaoaYJ...xyz","amount": 0.01,"currency": "USDC"}}

HTTP Headers Reference

HeaderRequiredDescription
x-payment-signatureYesSolana transaction signature proving payment
x-payment-fromYesPayer's Solana wallet address
x-forwarded-byNoSet to "x402wrap" (informational)

Use Cases

AI Agent Payments

Autonomous AI agents can pay for APIs without credit cards

Data Monetization

Sell access to your datasets on a per-query basis

AI Services

Monetize image generation, text processing, or embeddings

Web3 Oracles

Provide paid blockchain data feeds and price oracles

FAQ

What is the x402 protocol?

x402 is an open-source payment protocol by Coinbase that enables instant micropayments in USDC via HTTP. It uses the 402 Payment Required status code.

Do I need to integrate anything?

No! Just paste your API URL, set a price, and share the generated link. x402wrap handles all payment verification.

What fees does x402wrap charge?

Zero platform fees. You receive 100% of payments directly in your wallet. Only Solana network fees apply (~$0.00001).

Can I update my API's price?

Currently, you need to create a new link to change pricing. Dynamic pricing is coming in a future update.

Is this suitable for high-volume APIs?

Yes! Solana handles 65,000+ TPS with sub-second finality, making it perfect for high-frequency API calls.

Need Help?

Join our community or reach out to our team