Test the x402 endpoint to see current status and available premium features.
// Request premium feature with x402
const response = await fetch('/api/x402/analytics', {
headers: {
'X-Payment-Token': 'your-payment-token',
'X-Payment-Amount': '0.001'
}
});
if (response.status === 402) {
// Payment required - show payment UI
console.log('Premium feature requires payment');
} else if (response.ok) {
// Payment accepted, feature unlocked
const data = await response.json();
}Test the x402 endpoint to see current status and available premium features.
// Request premium feature with x402
const response = await fetch('/api/x402/analytics', {
headers: {
'X-Payment-Token': 'your-payment-token',
'X-Payment-Amount': '0.001'
}
});
if (response.status === 402) {
// Payment required - show payment UI
console.log('Premium feature requires payment');
} else if (response.ok) {
// Payment accepted, feature unlocked
const data = await response.json();
}