Subscriptions

MatchNest includes a full 4-tier subscription system with per-feature usage limits.

Default Plans

PlanPriceInterestsMessagesPhotosContact Views
Free$0/forever5/month10/month32/month
Silver$29.99/month30/month100/month1015/month
Gold$59.99/monthUnlimitedUnlimited2550/month
Platinum$99.99/monthUnlimitedUnlimited50Unlimited

How Limits Work

Limits are enforced at the API level using the getSubscriptionLimits helper:

import { getSubscriptionLimits, incrementUsage } from "@/lib/subscription";

// In an API route:
const limits = await getSubscriptionLimits(userId);

if (limits.interestsSentThisMonth >= limits.maxInterests) {
  return Response.json({ success: false, error: "Monthly limit reached" }, { status: 403 });
}

// After successful action:
await incrementUsage(userId, "interestsSent");

Managing Plans

Plans are managed in the Admin Panel → Packages. You can:

  • Create new plans with custom pricing and features
  • Edit existing plan features and prices
  • Delete plans (members already subscribed keep their plan)
  • Toggle plans as featured/recommended

Payment Flow

The billing page (/billing) shows the current plan and available upgrades. To integrate a real payment gateway:

  1. Add payment gateway SDK (e.g. npm install stripe)
  2. Create a payment intent in POST /api/payments
  3. Handle the webhook to confirm payment and activate subscription
  4. Update Subscription.status to active

Subscription Database Schema

model Subscription {
  id         String   @id @default(cuid())
  userId     String   @unique
  packageId  String
  status     String   // active | expired | cancelled
  startDate  DateTime
  endDate    DateTime?
  // Usage counters
  interestsSent     Int @default(0)
  messagesCount     Int @default(0)
  contactViewsCount Int @default(0)
  // Reset monthly
  usageResetAt      DateTime
}