DocsGuidesCreating Your First Loyalty Program

    Creating Your First Loyalty Program

    Launch a complete loyalty program in under 30 minutes

    5 min readBeginner

    Overview

    This guide walks you through creating a complete loyalty program using LoyalPro. By the end, you'll have a fully functional points-based program where customers can earn and redeem rewards.

    What you'll build:

    • A points-based loyalty program (1 point per ₦100 spent)
    • Earn rules that automatically award points on purchases
    • Redemption rewards customers can claim
    • Customer enrollment workflow
    1

    Configure Your Program

    First, create and configure your loyalty program with basic settings.

    Create Program
    const program = await loyalpro.programs.create({
      name: "My Rewards Program",
      type: "points",
      currency: "NGN",
      settings: {
        points_name: "Stars",
        points_name_plural: "Stars",
        default_earn_rate: 1, // 1 point per ₦100
        earn_rate_denominator: 100
      }
    });
    
    console.log(program.id); // "prg_abc123"

    Program Types

    Choose from points, cashback, subscription or voucher-based programs.

    Custom Branding

    Name your points currency (Stars, Coins, Miles, etc.)

    2

    Set Earn Rules

    Define how customers earn points. You can create multiple rules for different scenarios.

    Create Earn Rule
    // Basic earn rule: 1 point per ₦100 spent
    const earnRule = await loyalpro.earnRules.create({
      program_id: program.id,
      name: "Standard Earn",
      type: "purchase",
      points_per_unit: 1,
      unit_amount: 100, // ₦100
      active: true
    });
    
    // Bonus earn rule: Double points on weekends
    const bonusRule = await loyalpro.earnRules.create({
      program_id: program.id,
      name: "Weekend Bonus",
      type: "purchase",
      points_per_unit: 2,
      unit_amount: 100,
      schedule: {
        days: ["saturday", "sunday"]
      },
      active: true
    });

    Pro Tip

    Use multiplier rules for promotions. Create time-limited "2x points" campaigns to drive engagement.

    3

    Create Rewards

    Define the rewards customers can redeem their points for.

    Create Rewards
    // Create a discount reward
    const reward = await loyalpro.rewards.create({
      program_id: program.id,
      name: "₦1,000 Discount",
      description: "Get ₦1,000 off your next purchase",
      type: "discount",
      points_required: 200,
      discount_amount: 1000,
      currency: "NGN",
      active: true
    });
    
    // Create a free item reward
    const freeItemReward = await loyalpro.rewards.create({
      program_id: program.id,
      name: "Free Dessert",
      description: "Redeem for any dessert on the menu",
      type: "free_item",
      points_required: 150,
      active: true
    });
    4

    Launch Your Program

    Activate your program and start enrolling customers.

    Launch & Enroll
    // Activate the program
    await loyalpro.programs.update(program.id, {
      status: "active"
    });
    
    // Enroll a customer
    const customer = await loyalpro.customers.create({
      email: "ada@example.com",
      name: "Ada Johnson",
      phone: "+234 801 234 5678",
      program_id: program.id
    });
    
    // Award points for a purchase
    await loyalpro.points.award({
      customer_id: customer.id,
      points: 50, // ₦5,000 purchase = 50 points
      reason: "Purchase at Main Branch",
      reference: "order_12345"
    });
    
    console.log("Program launched successfully!");

    Congratulations!

    You've successfully created your first loyalty program. Your customers can now earn and redeem rewards.

    Next Steps

    Was this page helpful?

    Help us improve our documentation