Stratum

Integration Guide

v3.0 — SDK + Automatic Settlement

Overview

Stratum handles settlement so you don't have to. Submit verified payments via the SDK or API. Stratum batches, nets, and settles USDC on-chain every 60 seconds. You get a txHash proving every payment settled.

Authentication

Get an API key at stratumx402.com/facilitators. Include it in all requests:

X-API-KEY: sk_live_your_key

Quick Start

1Get your API key

Generate an API key instantly at stratumx402.com/facilitators. No approval required.

2Install the SDK

npm install @v402valeo/facilitator

3Submit a payment

const { Stratum } = require('@v402valeo/facilitator');
const stratum = new Stratum({ apiKey: 'sk_live_...' });

// Solana payment:
await stratum.submit({
  from: 'agent_wallet_address',
  to: 'service_wallet_address',
  amount: '5000',
  chain: 'solana',
  reference: 'payment-001'
});

// Base payment (EVM addresses):
await stratum.submit({
  from: '0x4df375e577825ae021c1b44ba94F8CD84E59750c',
  to: '0xECa8FFA1134fda5e4042E25740DC02701d8Ed738',
  amount: '10000',
  chain: 'base',
  reference: 'payment-002'
});

Batch Submit (mixed chains)

// Submit multiple payments across both chains in one call:
await stratum.submitBatch([
  { from: '4QWY4...', to: 'FjeQfz...', amount: '5000', chain: 'solana', reference: 'sol-001' },
  { from: '0x4df3...', to: '0xECa8...', amount: '10000', chain: 'base', reference: 'base-001' },
]);
// Up to 500 payments per call. Chains can be mixed freely.

4Check status

const result = await stratum.status('payment-001');
console.log(result.status);  // 'settled'
console.log(result.txHash);  // '4PxAjvFrj...'

API Reference

Base URL: https://gateway.stratumx402.com

MethodEndpointDescription
POST/v1/settle/submitSubmit 1-500 payments per call
GET/v1/settle/status/:referencePayment status + txHash
POST/v1/settle/batch-statusCheck up to 500 references
GET/v1/settle/recentLast 50 payments
POST/admin/servicesRegister a service
GET/v1/analyticsPublic stats
GET/v1/settle/reconciliationOn-chain verification stats (admin)

Submit Payload

POST /v1/settle/submit
Content-Type: application/json
X-API-KEY: sk_live_your_key

{
  "payments": [
    {
      "from": "agent_wallet",
      "to": "service_wallet",
      "amount": "5000",
      "chain": "solana",
      "reference": "your-id"
    }
  ]
}

Single payment shorthand is also accepted — send from, to, amount directly without the payments array.

Status Response

{
  "reference": "your-id",
  "status": "settled",
  "txHash": "4PxAjvFrjExWoKo...",
  "settledAt": "2026-03-10T03:30:58Z",
  "from": "agent_wallet",
  "to": "service_wallet",
  "amount": "5000",
  "chain": "solana"
}

Statuses: queued batched settled (or failed with error message).

Configuration

Supported Chains

ChainAssetSettlementNetwork
SolanaUSDCSPL Token transferCheckedMainnet
BaseUSDCERC-20 transferMainnet

Settlement Parameters

Settlement frequencyEvery 60 seconds
Fee0.1% (10 bps) of netted volume
Rate limit100 submissions/minute per API key
Max batch size500 payments per submit call
Duplicate protectionSame reference ID returns existing record
Public analytics/v1/analytics

What Stratum Does Automatically

  1. Creates destination token accounts if they don't exist
  2. Compresses payments through multilateral netting
  3. Executes USDC transfers on Solana and Base
  4. Anchors Merkle proofs on-chain
  5. Tracks per-payment status with txHash
  6. Monitors settlement wallet balance
  7. Recovers queued payments after restart

Limits & Safety

LimitDefaultWhat happens
Max single payment$1,000Rejected instantly
Max per window (60s)$10,000Deferred to next window
Max daily per API key$50,000Rejected until next day
Rate limit100/min per key429 with retry-after
Duplicate referenceIdempotentReturns existing payment

Verifying On-Chain

Every settled payment includes a txHash. Verify it independently:

Solanahttps://solscan.io/tx/{txHash}
Basehttps://basescan.org/tx/{txHash}

Stratum also runs automatic post-settlement reconciliation every 5 minutes, verifying every settled transaction on-chain. Check reconciliation stats at GET /v1/settle/reconciliation.

For Sellers / API Providers

If you're a seller, you don't need the SDK. Register your service and USDC arrives automatically.

1Get an API key

Generate at stratumx402.com/facilitators.

2Register your service

POST https://gateway.stratumx402.com/admin/services
Content-Type: application/json
X-API-KEY: sk_live_your_key

{
  "slug": "my-api",
  "name": "My API",
  "walletAddress": "your_solana_wallet_address",
  "pricePerRequest": 5000
}

3Done

USDC arrives in your wallet every 60 seconds. No code changes needed. Your facilitator handles the rest.

Complete Integration Example

Here's the full middleware pattern — add this to your existing x402 payment handler:

const { Stratum } = require('@v402valeo/facilitator');
const stratum = new Stratum({ apiKey: 'sk_live_YOUR_KEY' });

app.use(async (req, res, next) => {
  const payment = req.headers['x-payment'];
  if (!payment) return res.status(402).json({ error: 'Payment required' });

  const verified = await verifyX402Payment(payment);
  if (!verified.valid) return res.status(402).json({ error: 'Invalid payment' });

  await stratum.submit({
    from: verified.agentWallet,
    to: verified.serviceWallet,
    amount: verified.amount,
    chain: verified.chain,
    reference: verified.paymentId
  });

  next();
});

That's 7 lines added to your existing middleware. Everything after stratum.submit() is automatic — netting, settlement, Merkle anchoring, status tracking.

Testing

Generate a test API key at stratumx402.com/facilitators. Check settlement status at stratumx402.com/console or the Explorer.

Questions? Contact valeobank@gmail.com