Provider Demo
See how a provider receives x402 payments, verifies them, and gets paid.
Your Provider Endpoint
Connect wallet to see your provider endpoint
Simulate Incoming Payment
Note: This simulates receiving a payment. In production, you'd extract the payment from the X-Payment header.
Payment Log
No payments received yet
Integration Code
// Express.js example
app.get('/api/data', async (req, res) => {
const payment = req.headers['x-payment'];
if (!payment) {
return res.status(402).json({
payTo: '0xYourWallet',
amount: '1000000000000000000',
token: '0xb3042734b608a1B16e9e86B374A3f3e389B4cDf0',
chainId: 314159,
facilitator: 'http://localhost:3402'
});
}
// Verify with facilitator
const { valid } = await fetch('http://localhost:3402/verify', {
method: 'POST',
body: JSON.stringify({
payment: JSON.parse(payment),
requirements: { payTo: MY_WALLET, ... }
})
}).then(r => r.json());
if (!valid) {
return res.status(402).json({ error: 'Invalid payment' });
}
// Deliver data immediately
res.json({ data: 'Your premium content here' });
// Settle in background
fetch('http://localhost:3402/settle', { ... });
});