Loyalty API
API for managing points accumulation and customer rewards
Endpoints
Get Points
Get accumulated points
http
GET /api/rpc/user/loyalty/pointsResponse
json
{
"totalPoints": 1250,
"tier": "gold",
"nextTier": "platinum",
"pointsToNextTier": 750
}Get Rewards
Get reward list
http
GET /api/rpc/user/loyalty/rewardsResponse
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/redeemBody
json
{
"rewardId": "reward_1",
"bookingId": "booking_123"
}Points History
Get points history
http
GET /api/rpc/user/loyalty/historyTiers
| Tier | Minimum Points | Benefits |
|---|---|---|
| Bronze | 0 | 5% discount |
| Silver | 500 | 10% discount + 60-day advance booking |
| Gold | 1,000 | 15% discount + 90-day advance booking |
| Platinum | 2,000 | 20% 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',
}),
});