Loyalty API

Manage loyalty programs, points, and rewards

11 endpoints

Base URL:https://api.nexapay.com/v1
MethodPathDescription
GET/loyalty/programsList loyalty programs
POST/loyalty/programsCreate loyalty program
GET/loyalty/programs/{program_id}Get program details
PUT/loyalty/programs/{program_id}Update program
GET/loyalty/points/{customer_id}Get customer points
POST/loyalty/points/earnAward points to customer
POST/loyalty/points/redeemRedeem points
GET/loyalty/points/history/{customer_id}Get points history
GET/loyalty/rewardsList available rewards
POST/loyalty/rewardsCreate reward
POST/loyalty/rewards/{reward_id}/claimClaim reward

Detailed Examples

POST/loyalty/programs

Request Body

{
  "name": "Coffee Rewards",
  "description": "Earn points on every purchase",
  "points_rate": 1,
  "min_points_per_purchase": 1,
  "tiers": [
    {
      "name": "Bronze",
      "min_points": 0,
      "benefits": ["5% off on birthdays"]
    },
    {
      "name": "Silver", 
      "min_points": 500,
      "benefits": ["10% off on birthdays", "Free drink monthly"]
    },
    {
      "name": "Gold",
      "min_points": 1500,
      "benefits": ["15% off on birthdays", "Free drink weekly", "Priority service"]
    }
  ],
  "expiry_days": 365
}

Response

{
  "success": true,
  "data": {
    "id": "prog_coffee_rewards",
    "name": "Coffee Rewards",
    "status": "active",
    "enrolled_customers": 0,
    "created_at": "2024-01-15T10:00:00Z"
  }
}