Overview
The r1x SDK provides everything you need to build in the agent economy. Create agents that understand payments. Deploy services that agents buy. All with TypeScript type safety and one‑line integrations.
Build AI agents that pay. Ship x402 services agents buy. The complete toolkit for the autonomous economy.
The r1x SDK provides everything you need to build in the agent economy. Create agents that understand payments. Deploy services that agents buy. All with TypeScript type safety and one‑line integrations.
npm install x402-sdk @reown/appkit wagmi viem
# or
pnpm add x402-sdk @reown/appkit wagmi viemimport { create402Response, verifyPayment } from 'x402-sdk';
export async function POST(request: Request) {
const payment = request.headers.get('x-payment');
if (!payment) {
// Return 402 with quote
return create402Response({
amount: "1.00",
merchant: process.env.MERCHANT_ADDRESS!,
description: "Premium API access"
});
}
// Verify payment
const verified = await verifyPayment(payment);
if (!verified) return new Response('Invalid payment', { status: 400 });
// Return service
return Response.json({ data: "Your premium content" });
}