Next.js Adapter
The Chargebee Next.js adapter provides route handlers for integrating Chargebee Hosted Pages (checkout, payment methods, and customer portal) into Next.js App Router applications.
Prerequisites
- Next.js 15 or later
Installation
Features
The adapter provides four route handler factories:
createSubscriptionCheckout— Redirects to a Chargebee subscription checkout pagecreateOneTimeCheckout— Redirects to a one-time charge checkout pagemanagePaymentSources— Redirects to the payment method management pagecreatePortalSession— Redirects to the Chargebee self-service portal
Each factory takes your credentials and returns an async (req: NextRequest) => NextResponse handler.
Setup
1. Configure Environment
Add your Chargebee credentials to .env.local: