DEV Community

Shieldz
Shieldz

Posted on • Originally published at shieldz.cash

Accept crypto payments in Next.js (non-custodial, $0 fees)

Originally published on shieldz.cash.

Most crypto payment gateways hold your customers' money and take a cut. Shieldz is non-custodial: the buyer pays an address that belongs to you, funds settle straight to your own wallet, and there is no platform fee. Here is how to wire it into a Next.js app.

1. Create an invoice

// app/api/checkout/route.ts
import Shieldz from "@shieldz/sdk";
const shieldz = new Shieldz(process.env.SHIELDZ_API_KEY!);

export async function POST() {
  const invoice = await shieldz.invoices.create({ amount_usd_cents: 5000, memo: "Order" });
  return Response.redirect(invoice.pay_url, 303);
}
Enter fullscreen mode Exit fullscreen mode

The customer lands on a hosted checkout and pays with Bitcoin, USDC/USDT on five chains, or shielded Zcash.

2. Verify the webhook

When the payment confirms, Shieldz sends an HMAC-signed invoice.paid webhook. Verify the signature before fulfilling:

// app/api/webhooks/shieldz/route.ts
import { constructEvent } from "@shieldz/sdk";

export async function POST(req: Request) {
  const raw = await req.text();
  try {
    const event = await constructEvent(
      raw,
      req.headers.get("x-shieldz-signature") ?? "",
      process.env.SHIELDZ_WEBHOOK_SECRET!,
    );
    if (event.type === "invoice.paid") {
      // fulfill the order
    }
    return new Response("ok");
  } catch {
    return new Response("bad signature", { status: 400 });
  }
}
Enter fullscreen mode Exit fullscreen mode

Why non-custodial

  • $0 platform fee — you pay only network gas, never a percentage of sales.
  • No custody — Shieldz only ever holds a public key, so there is nothing to freeze and nothing to skim. You can verify that yourself.
  • No KYC to start.

Full guide and API docs: Accept crypto in Next.js and the API reference.

Top comments (0)