Payment Infrastructure for Web3

xRail enables seamless, secure blockchain payments with minimal friction. Build the future of decentralized commerce with our facilitator infrastructure powered by x402 protocol.

XRail Facilitator - X-402 Paid Service

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.

🎫 How It Works

1. Acquire Credits

Send USDC to the facilitator contract. You'll be credited the full USDC amount, minus the facilitator fee.

2. Make Payments

When you submit a payment through the facilitator, your credit balance is checked to ensure you have sufficient credits.

3. Automatic Deduction

The facilitator executes your USDC transfer on-chain and automatically deducts the fee per transaction from your credits.

🔐 Smart Contract

The XRailFacilitator contract (proxy) is deployed on Base Sepolia at:

0xe51E3Fd47aa2B70F1211D6614dBaF418Bf51D7D2 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.

✨ Benefits

  • Gasless Transfers: Uses EIP-3009 to enable USDC transfers without gas fees
  • Predictable Pricing: Simple and transparent fee structure per transaction
  • Verifiable On-Chain: All credit balances and transactions are transparent on Base Sepolia
  • Secure & Upgradeable: Built with security best practices and future-proof design

Getting Started

TypeScript
// Install the PayRail SDK
npm install @payrail/sdk-nodejs

// Initialize and attach to your HTTP client
import axios from 'axios';
import { PayRail } from '@payrail/sdk-nodejs';

const payrail = new PayRail({
  facilitatorUrl: 'https://facilitator.xrail.io',
  privateKey: process.env.PRIVATE_KEY!,
  debug: true
});

const client = axios.create({
  baseURL: 'https://api.example.com'
});

// Attach interceptor - automatically handles 402 responses
payrail.attachInterceptor(client);

// Make requests normally - payment is handled automatically
const response = await client.get('/paid-endpoint');

Quick Start Guide

  1. Install SDK

    Add @payrail/sdk-nodejs to your project with npm

  2. Configure PayRail

    Initialize with facilitator URL and your private key

  3. Attach Interceptor

    Connect SDK to your axios HTTP client instance

  4. Make Requests

    SDK automatically handles 402 responses and processes payments

Technical Documentation