Untitled

mail@pastecode.io avatar
unknown
json
a month ago
2.7 kB
11
Indexable
Never
{
  "plan_id": "unique_plan_identifier", // Required: A unique identifier for each plan.
  "plan_name": "Name of the Plan", // Required: Descriptive name of the plan.
  "amount": 100000, // Required: The charge amount for the plan in subcurrency units (e.g., cents, kobo).
  "currency": "USD", // Required: Base currency code for billing.
  "interval": "monthly", // Required: Billing interval, e.g., "monthly", "yearly".
  "charge_on": "customer_enrollment", // Required: Defines when the charge is applied. Common values: "customer_enrollment", "end_of_trial".
  
  "trial_period": { // Optional: Defines the trial period before billing starts. If not provided, defaults to no trial period.
    "type": "days", // "days" for a specific number of days, "interval" for billing cycles.
    "value": 14 // Represents the length based on the "type", e.g., 14 days or 1 billing cycle.
  },
  
  "tiers": [ // Optional: Required for tiered billing plans. Specify this array for plans with multiple pricing tiers.
    {
      "tier_name": "Basic", // Required for tiered plans: Name of the tier.
      "amount": 2000, // Required for tiered plans: Base amount charged for this tier in subcurrency units.
      "metrics": [ // Required for tiered plans: Defines allowances and overage charges for various metrics.
        {"metric_name": "SMS", "allowance": 1000, "overage_charge_per_unit": 1},
        {"metric_name": "Emails", "allowance": 5000, "overage_charge_per_unit": 2}
      ]
    },
    // Additional tiers can be defined here.
  ],
  
  "usage_charge_per_unit": 1, // Optional: Charge per unit of usage in subcurrency units. Required for usage-based billing.
  
  "pssp": "stripe", // Required: Payment Service Provider. Specifies the primary payment processor.
  
  "plan_variants": [ // Optional: Simplifies the definition of currency variants by mapping tier names to their pricing in the variant's currency without redefining the entire tier structure.
    {
      "variant_id": "ngn_variant",
      "currency": "NGN",
      "pssp": "paystack",
      "tier_pricing": {
        "Basic": 760000 // Pricing for tiers in NGN subcurrency units.
      }
    }
    // Additional currency variants as needed.
  ],
  
  "description": "Description of the Plan", // Optional: Provides a brief overview of what the plan offers.
  "invoice_name": "Invoice Name", // Required: The name displayed on invoices for this plan, ensuring clarity for subscribers.
  
  "metadata": { // Optional: Allows for the inclusion of arbitrary key-value pairs for additional plan data.
    "category": "SaaS",
    "features": "Unlimited Data, 24/7 Support"
  }
}
Leave a Comment