Skip to content

Loyalty API

API for managing points accumulation and customer rewards

Endpoints

Get Points

Get accumulated points

http
GET /api/rpc/user/loyalty/points

Response

json
{
  "totalPoints": 1250,
  "tier": "gold",
  "nextTier": "platinum",
  "pointsToNextTier": 750
}

Get Rewards

Get reward list

http
GET /api/rpc/user/loyalty/rewards

Response

json
[
  {
    "id": "reward_1",
    "name": "10% Discount",
    "pointsRequired": 500,
    "description": "Valid for your next booking"
  }
]

Redeem Reward

Redeem a reward

http
POST /api/rpc/user/loyalty/redeem

Body

json
{
  "rewardId": "reward_1",
  "bookingId": "booking_123"
}

Points History

Get points history

http
GET /api/rpc/user/loyalty/history

Tiers

TierMinimum PointsBenefits
Bronze05% discount
Silver50010% discount + 60-day advance booking
Gold1,00015% discount + 90-day advance booking
Platinum2,00020% discount + 120-day advance booking + Priority

Example Code

typescript
// Get accumulated points
const points = await fetch('/api/rpc/user/loyalty/points', {
  headers: { 'Authorization': 'Bearer YOUR_API_KEY' },
});

// Redeem reward
await fetch('/api/rpc/user/loyalty/redeem', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    rewardId: 'reward_1',
    bookingId: 'booking_123',
  }),
});

Released under the MIT License.