Overview
The /test endpoint is designed for development and testing. It costs only $0.0001 USDC, making it perfect for integration testing without significant cost.
Endpoint
POST https://open.x402.host/test
Cost
$0.0001 USDC per transaction - Nearly free for testing!
When to Use
- Development - While building your integration
- Testing - Running automated tests
- Staging environments - Before production deployment
- Demos - Showing your application
Always use /test during development. Switch to /open only when going to production.
Request
Identical to /open endpoint, but with minimal cost.
Example Request
const response = await fetch('https://open.x402.host/test', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
network: 'base',
txHash: '0x...',
amount: 0.0001,
recipient: '0x...'
})
});
Response
Same format as /open endpoint.
Complete Testing Example
// Test suite example
async function runPaymentTests() {
const tests = [
{ name: 'Valid payment', amount: 0.0001, shouldPass: true },
{ name: 'Insufficient amount', amount: 0.00001, shouldPass: false },
{ name: 'Invalid network', network: 'invalid', shouldPass: false }
];
for (const test of tests) {
console.log(`Running test: ${test.name}`);
try {
const response = await fetch('https://open.x402.host/test', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
network: test.network || 'base',
txHash: generateTestTx(),
amount: test.amount,
recipient: TEST_ADDRESS
})
});
const success = response.ok;
const passed = success === test.shouldPass;
console.log(`✓ ${test.name}: ${passed ? 'PASS' : 'FAIL'}`);
} catch (error) {
console.error(`✗ ${test.name}: ERROR -`, error.message);
}
}
}
Differences from /open
| Feature | /test | /open |
| Cost | $0.0001 | $1.00 |
| Purpose | Development | Production |
| Rate Limit | Higher (for testing) | Standard |
| Settlement | Simulated | Real |
Rate Limiting
- 1000 requests per minute (higher than production)
- Designed for rapid testing
Migration to Production
When ready to go live:
// Configuration
const ENDPOINT = process.env.NODE_ENV === 'production'
? '/open'
: '/test';
const BASE_URL = 'https://open.x402.host';
// Use in your code
await fetch(`${BASE_URL}${ENDPOINT}`, {
// ... your request
});