Skip to main content
This is a complete working example showing how to handle payment success and gate features in a Next.js app.

API route

Create app/api/subscription/route.ts:

Payment handler component

Create app/components/payment-handler.tsx:

Feature card component

Create app/components/feature-card.tsx:
This example uses localStorage for simplicity. In production, store subscription data in your database and verify server-side.