خطط التسعير

كيفية إعداد خطط التسعير وتخصيصها لتطبيق SaaS الخاص بك.

ملاحظة: هذا محتوى تجريبي/مؤقت لأغراض العرض التوضيحي.

اضبط هيكل التسعير بما يتوافق مع نموذج عملك.

هيكل الخطة

تتكوّن كل خطة تسعير مما يلي:

  • المعرّف (ID) - معرّف فريد
  • الاسم - الاسم المعروض
  • السعر - المبلغ بعملتك
  • الفترة - وتيرة الفوترة (شهر، سنة)
  • الميزات - قائمة بالميزات المضمّنة
  • الحدود - قيود الاستخدام

مثال على الإعداد

// config/billing.config.ts
export const billingConfig = {
  provider: 'stripe', // or 'paddle'
  currency: 'usd',
  plans: [
    {
      id: 'free',
      name: 'Free',
      description: 'Perfect for getting started',
      price: 0,
      features: [
        '5 projects',
        'Basic analytics',
        'Community support',
      ],
      limits: {
        projects: 5,
        members: 1,
      },
    },
    {
      id: 'starter',
      name: 'Starter',
      description: 'For small teams',
      price: 19,
      interval: 'month',
      features: [
        '25 projects',
        'Advanced analytics',
        'Email support',
        'API access',
      ],
      limits: {
        projects: 25,
        members: 5,
      },
    },
    {
      id: 'pro',
      name: 'Professional',
      description: 'For growing businesses',
      price: 49,
      interval: 'month',
      popular: true,
      features: [
        'Unlimited projects',
        'Advanced analytics',
        'Priority support',
        'API access',
        'Custom integrations',
      ],
      limits: {
        projects: -1, // unlimited
        members: 20,
      },
    },
  ],
};

تقييد الميزات

قيّد الوصول إلى الميزات بناءً على خطة الاشتراك:

import { hasFeature } from '~/lib/billing/features';

async function createProject() {
  const subscription = await getSubscription(accountId);

  if (!hasFeature(subscription, 'api_access')) {
    throw new Error('API access requires Pro plan');
  }

  // Create project
}

حدود الاستخدام

طبّق حدود الاستخدام الخاصة بكل خطة:

import { checkLimit } from '~/lib/billing/limits';

async function addTeamMember() {
  const canAdd = await checkLimit(accountId, 'members');

  if (!canAdd) {
    throw new Error('Member limit reached. Upgrade to add more members.');
  }

  // Add member
}

الفوترة السنوية

قدّم خططًا سنوية بأسعار مخفّضة:

{
  id: 'pro-annual',
  name: 'Professional Annual',
  price: 470, // ~20% discount
  interval: 'year',
  discount: '20% off',
  features: [ /* same as monthly */ ],
}

الفترات التجريبية

اضبط فترات التجربة المجانية:

export const trialConfig = {
  enabled: true,
  duration: 14, // days
  plans: ['starter', 'pro'], // plans eligible for trial
  requirePaymentMethod: true,
};

تخصيص صفحة التسعير

تُنشأ صفحة التسعير تلقائيًا من إعداداتك:

import { billingConfig } from '~/config/billing.config';

export default function PricingPage() {
  return (
    <PricingTable
      plans={billingConfig.plans}
      currency={billingConfig.currency}
    />
  );
}

إضافة ميزات مخصّصة

وسّع ميزات الخطط بسمات مخصّصة:

{
  id: 'enterprise',
  name: 'Enterprise',
  price: null, // Contact for pricing
  custom: true,
  features: [
    'Everything in Pro',
    'Dedicated support',
    'Custom SLA',
    'On-premise deployment',
  ],
  ctaText: 'Contact Sales',
  ctaUrl: '/contact',
}