Stripe just opened crypto payins for machine payments. AI agents can now pay for your API in USDC on Base, and the money lands in your Stripe Dashboard as USD - same place as your credit card revenue.
We built stripePayTo() into the RelAI SDK so you can set this up in 3 lines.
The Problem
If you're an API provider accepting x402 payments today, you receive USDC directly to your wallet. That works - but it means you need to:
- Manage a crypto wallet with private keys
- Off-ramp USDC to your bank account manually
- Track revenue across two systems (Stripe for cards, wallet for crypto)
- Handle taxes and reporting for crypto income separately
The Fix
stripePayTo() eliminates all of that. Payments flow through x402 as usual, but instead of landing in your wallet, they land in Stripe:
import Relai, { stripePayTo } from '@relai-fi/x402/server';
const relai = new Relai({ network: 'base' });
app.get('/api/data', relai.protect({
price: 0.01,
payTo: stripePayTo(process.env.STRIPE_SECRET_KEY),
}), (req, res) => {
res.json({ data: 'premium content' });
});
That's it. No wallet, no private keys, no off-ramping.
How It Works Under the Hood
Each time an agent hits your API without a payment header:
- 402 response - the SDK creates a Stripe PaymentIntent with
payment_method_types: ["crypto"] - Deposit address - Stripe returns a fresh USDC deposit address on Base via
next_action.crypto_collect_deposit_details - Client pays - the agent's x402 client signs and settles USDC to that address
- Auto-capture - Stripe detects the on-chain payment, captures the PI, and credits your balance in USD
payTo address and pays normally. The agent doesn't know (or care) that Stripe is on the other end.
What You Get
- Unified revenue - crypto and card payments in one Stripe Dashboard
- USD settlement - no crypto exposure, no volatility risk
- Built-in reporting - sales tax, refunds, and invoicing through Stripe
- No wallet management - Stripe handles the deposit address
- Base network - low fees, fast settlement (auto-configured)
Compared to Raw Stripe x402
Stripe's own x402 docs require ~45 lines and 6 imports to set up. You need to manually create PaymentIntents, extract deposit addresses, handle the payment lifecycle, and wire up a facilitator client.
With RelAI:
| Stripe docs | @relai-fi/x402 | |
|---|---|---|
| Lines of code | ~45 | 3 |
| Imports | 6 packages | 1 package |
| Facilitator setup | Manual | Auto-configured |
| Network config | Manual | Auto (Base) |
| Deposit address | You extract it | SDK handles it |
Requirements
- Stripe account with crypto payins enabled
STRIPE_SECRET_KEYin your environment variables@relai-fi/x402v0.5.0+ installed
npm install @relai-fi/x402@latest
Dynamic Pricing + Stripe
Works with dynamic pricing too - the SDK creates a correctly-sized PaymentIntent per request:
app.get('/api/generate', relai.protect({
price: (req) => {
const tokens = parseInt(req.query.tokens) || 100;
return tokens * 0.0001; // $0.0001 per token
},
payTo: stripePayTo(process.env.STRIPE_SECRET_KEY),
}), handler);
Each request gets a PaymentIntent matching the exact price. No over-charging, no rounding issues.
For Agent Developers
Nothing changes on your side. If you're already using the RelAI client SDK or any x402-compatible client, payments to Stripe-backed APIs work identically. You pay USDC to a Base address - whether that address belongs to a merchant wallet or Stripe is transparent to you.
Get Started
- Install the SDK:
npm install @relai-fi/x402@latest - Add
stripePayTo(process.env.STRIPE_SECRET_KEY)as yourpayTo - Deploy and start earning
Need protocol context first? Read the x402 overview and the RelAI documentation hub.
RelAI connects AI agents to paid APIs through the x402 protocol. With stripePayTo(), API providers can accept machine payments directly into Stripe - no crypto knowledge required.

