@creem_io/nextjs
The simplest way to integrate Creem payments into your Next.js application.
Build beautiful checkout experiences with React components, handle webhooks with ease, and manage subscriptions without the headache.
Introduction
@creem_io/nextjs is the official adapter for running Creem inside the Next.js App Router. It gives you:
- 🎨 React Components — Drop-in checkout and portal components that wrap routing logic.
- 🔐 Type-safe APIs — Full TypeScript coverage and sensible defaults.
- ⚡ Zero-config setup — Works with App Router filesystem routing.
- 🪝 Webhook helpers — Automatic verification and strongly typed handlers.
- 🔄 Subscription lifecycle — Built-in helpers for grant/revoke access flows.
Installation
Install the package with your favorite manager:Requirements
- Next.js 13+ using the App Router
- React 18+
- A Creem account with API keys
Quick Start
The adapter follows a four-step setup. The snippets below mirror what we use in production templates.1. Configure environment variables
2. Create a checkout route
3. Drop the checkout component into your UI
4. Handle webhooks
Components
<CreemCheckout />
Creates a checkout link and delegates session creation to your /checkout route handler.
<CreemPortal />
Generate a customer portal link for managing billing:
Server Functions
Checkout
Creates a GET route handler that issues checkout sessions.
Portal
Generate customer portal sessions from a server route:
Webhook
Verify webhooks and run lifecycle hooks:
Access Management
LeverageonGrantAccess and onRevokeAccess to keep your database in sync.
Best Practices
- Use environment variables for API keys and webhook secrets.
- Pass
referenceIdwhenever possible to map users to Creem customers. - Test in
testModebefore switching the adapter to production. - Keep callbacks idempotent so multiple webhook event deliveries stay safe.
Resources
GitHub Repository
Star or contribute to the adapter on GitHub.
Creem Next.js Template
Full-stack example with Prisma, Better Auth, and Shadcn UI.
Better Auth Integration
Learn how to wire auth + billing in one flow.
Need help? Reach us at support@creem.io or join the Discord community.