// pages/pricing.tsx
import { ConduitCheckout } from "@conduitexchange/connect";
export default function Pricing() {
return (
<ConduitCheckout
amount="9.99"
currency="USDC"
merchantAddress={process.env.NEXT_PUBLIC_MERCHANT!}
orderId={`sub_${userId}_${cycleStart}`}
description="Pro plan · Monthly"
onSuccess={async (paymentId) => {
// Source of truth lives server-side. Don't trust the client.
await fetch("/api/subscriptions/extend", {
method: "POST",
body: JSON.stringify({ paymentId, plan: "pro" }),
});
}}
/>
);
}
// app/api/webhooks/conduit/route.ts
export async function POST(req: Request) {
const sig = req.headers.get("x-conduit-signature");
const raw = await req.text();
if (!verify(raw, sig)) return new Response("bad sig", { status: 401 });
const { event, orderId } = JSON.parse(raw);
if (event === "payment.completed") {
await db.subscriptions.extend({ orderId });
}
return new Response("ok");
}POST /api/webhooks/conduitidle
{
"event": "payment.completed",
"paymentId": "pay_xxxxxxxxxxxxxxxx",
"orderId": "sub_pro_abc123",
"plan": "pro",
"amount": "9.99",
"currency": "USDC",
"buyer": {
"chain": "ethereum",
"token": "USDC",
"address": "0x…"
},
"settled": {
"chain": "solana",
"token": "USDC",
"amount": "9.99",
"txHash": "…"
},
"fee": {
"conduitBps": 35,
"totalUsd": 0.0475
},
"occurredAt": "2026-04-26T03:07:27.419Z"
}