cURL
curl --request GET \ --url https://api.example.com/{locale}/shop/cards/{cardId}/games/history
{ "success": true, "message": "Customer game history retrieved successfully", "data": [ { "id": 1, "name": { "lt": "Kavos kortelė", "en": "Coffee Card" }, "game_type": "stamps", "status": "completed", "stamps_required": 8, "user_progress": { "current_step": 8, "completed": true, "completed_at": "2024-01-20T15:30:00Z", "history": [ { "timestamp": "2024-01-20T15:30:00Z", "action": "game_completed", "value": 8, "shop_id": 1 }, { "timestamp": "2024-01-20T15:30:00Z", "action": "stamp_added", "value": 1, "shop_id": 1, "performed_by_staff": 42 }, { "timestamp": "2024-01-18T11:20:00Z", "action": "stamp_added", "value": 2, "shop_id": 1, "performed_by_staff": 42 } ] }, "reward_claimed": { "type": "coupon", "code": "K12345678", "claimed_at": "2024-01-20T15:30:00Z" } }, { "id": 2, "name": { "lt": "Picos kortelė", "en": "Pizza Card" }, "game_type": "stamps", "status": "active", "stamps_required": 10, "user_progress": { "current_step": 3, "completed": false, "history": [ { "timestamp": "2024-01-15T19:45:00Z", "action": "stamp_added", "value": 3, "shop_id": 2, "performed_by_staff": 15 } ] } } ], "meta": { "current_page": 1, "last_page": 1, "per_page": 15, "total": 2 } }
Get game history for a specific customer
X-API-Key
X-API-Secret
available
active
completed
curl -X GET "https://staging-api.loyalty.lt/en/shop/cards/123/games/history?status=completed" \ -H "X-API-Key: your_api_key" \ -H "X-API-Secret: your_api_secret" \ -H "Accept: application/json"
import { LoyaltySDK } from '@loyaltylt/sdk'; const sdk = new LoyaltySDK({ apiKey: 'your_api_key', apiSecret: 'your_api_secret', }); // Get customer's complete game history const history = await sdk.getCustomerGameHistory(123, 1); // cardId, shopId // Find completed games const completedGames = history.filter(g => g.status === 'completed'); console.log(`Customer has completed ${completedGames.length} games`);