Next.js
Price Next.js route handlers.
Pre-release · planned API
In development
This adapter is being implemented against the core v2 contract. The example below shows the intended shape and may change.
import { paid } from "@tollstile/next";
import { toll } from "@/lib/toll";
export const POST = paid(toll.price("$0.04"), async (request, { payment }) => {
return Response.json(await generate(await request.json()));
});Route handlers only. Pages and server components are not guarded.