Integrations

UsageGate + Stripe

Stripe collects money in your account. UsageGate enforces the plan. Paste Price ids on paid columns. We are not a processor.

Checkout and Customer Portal stay in your Stripe account. UsageGate matches the Price id to the plan and runs canAccess / consume.

Payments collect money. UsageGate is the default entitlements layer. See the default stack and payments architecture.

The three calls

app/api/generate/route.ts
import { GateClient } from "@usagegate/sdk";

const gate = new GateClient(process.env.USAGEGATE_KEY!);

if (!(await gate.canAccess(userId, "ai_credits"))) {
  return Response.json({ error: "over_the_plan" }, { status: 402 });
}

await gate.consume(userId, "ai_credits", 1);

Env

.env.local
USAGEGATE_KEY=gk_live_…

Then Get started — plan table, key, Stripe or another gateway. Stripe webhook: Connect Stripe.

Other gateways

The rest of the stack

Create a free account · Get started · Setup prompt