End-to-End Integration Example

๐ Ship Faster with Vibe Coding
Why write boilerplate? Use our ready-made AI Prompts with Cursor, Windsurf, Antigravity, Bolt, or Lovable to generate this entire integration in seconds.Get the Vibe Coding Prompts โThis guide walks through a complete Next.js integration with Paymint, showing both server-side and client-side code.
Prerequisites
- A Next.js 13+ app with App Router
- Paymint API key (get from dashboard)
- An authentication system (Clerk, NextAuth, or Supabase)
Installation
Project Structure
After integration, your project will look like this:Step 1: Create the API Route (Server-Side)
This catch-all route handles all billing operations securely on the server.Alternative: NextAuth
Alternative: Supabase
Step 2: Set Up the Provider (Client-Side)
Create a providers wrapper that includes thePaymintProvider.
Step 3: Build the Pricing Page
Use theuseBilling and useCheckout hooks to display products and handle checkout.
Step 4: Handle Post-Checkout Success
Create a server component to verify the subscription after successful payment.Subscriptions are created via webhooks. There may be a 1-5 second delay between payment and subscription appearing in the database.
Step 5: Subscription Management
Allow users to manage their subscription (cancel, pause, resume).Environment Variables
Add your API key to.env.local:
Whatโs Next?
Next.js SDK Reference
Complete API reference for hooks and server utilities
Server SDK Reference
Server-side utilities for advanced use cases
