xRail enables seamless, secure blockchain payments with minimal friction. Build the future of decentralized commerce with our facilitator infrastructure powered by x402 protocol. SDK integration allows automatic credit refills when interacting with the facilitator.
The XRail facilitator on Base Sepolia is a paid service supporting the X-402 protocol. It uses a credit-based system where credits are purchased with USDC and automatically deducted when the facilitator settles your payments.
Note: This is a testnet deployment on Base Sepolia for testing and demonstration purposes. The fees shown here are for testing only. Mainnet deployment will have significantly lower fees.
Send USDC to the facilitator contract. You'll be credited the full USDC amount, minus the facilitator fee.
When you submit a payment through the facilitator, your credit balance is checked to ensure you have sufficient credits.
The facilitator executes your USDC transfer on-chain and automatically deducts the fee per transaction from your credits.
The XRailFacilitator contract (proxy) is deployed on Base Sepolia at:
0xb5fcF9c691E0043c71692b5aEc8352b541BbC65F
View on BaseScan ↗
Technical Details: The contract uses EIP-3009 for gasless USDC payments and implements an upgradeable proxy pattern (ERC-1967) for future improvements. Credits use 6 decimals (same as USDC). All balances are verifiable on-chain and tied to your wallet address.
// Install the PayRail SDK
npm install @payrail/sdk-nodejs
// Integrate with facilitator - automatic credit refill on 402
import axios from 'axios';
import { PayRailClient } from '@payrail/sdk-nodejs';
// Initialize client with your private key
const payrailClient = new PayRailClient({
privateKey: process.env.PRIVATE_KEY!,
debug: true
});
// Create axios instance for facilitator API
const facilitatorApi = axios.create({
baseURL: 'https://facilitator.xrail.io'
});
// Attach interceptor - automatically handles 402 & refills credits
payrailClient.attachInterceptor(facilitatorApi);
// Make requests - 402 handled automatically with credit refill!
// Example: Buy credits from facilitator
const response = await facilitatorApi.post('/credits/purchase', {
amount: '1000000',
network: 'base-sepolia'
});
Add @payrail/sdk-nodejs to your project with npm
Initialize with your private key for making payments to facilitator
Connect SDK to your facilitator axios instance
SDK automatically handles 402 responses and refills credits as needed
Complete API documentation with all endpoints, parameters, and response formats.
View API Docs →Step-by-step tutorials for integrating xRail into various platforms and frameworks.
Read Guide →Technical specification of the x402 protocol, including security model and architecture.
View Spec →Sample code, use cases, and example implementations for common scenarios.
Browse Examples →