Overview
Add one or more stamps to a customer’s stamp card game. This is the primary action for staff/POS to record customer purchases and progress.
Authentication
This endpoint requires Partner API authentication with X-API-Key and X-API-Secret headers.
Parameters
The customer’s loyalty card ID
The shop ID where the stamp is being added
Number of stamps to add (1-10)
Response
Indicates if the request was successful
New total number of stamps
Whether the game is now completed
data.was_already_completed
Whether the game was already completed before this action
Details of the reward if game was completed (coupon, points, etc.)
{
"success": true,
"message": "Stamps added successfully",
"data": {
"current_step": 6,
"stamps_required": 8,
"is_completed": false,
"was_already_completed": false,
"remaining": 2
}
}
Example Request
curl -X POST "https://staging-api.loyalty.lt/en/shop/games/1/add-stamps" \
-H "X-API-Key: your_api_key" \
-H "X-API-Secret: your_api_secret" \
-H "Content-Type: application/json" \
-d '{
"card_id": 123,
"shop_id": 1,
"stamps_count": 2
}'
SDK Example
import { LoyaltySDK } from '@loyaltylt/sdk';
const sdk = new LoyaltySDK({
apiKey: 'your_api_key',
apiSecret: 'your_api_secret',
});
// Add stamps to a customer's card
const result = await sdk.addStamps(
1, // gameId
123, // cardId
1, // shopId
2 // stampsCount
);
if (result.is_completed) {
console.log('Game completed! Reward:', result.reward_generated);
} else {
console.log(`Progress: ${result.current_step}/${result.stamps_required}`);
}
React Component Example
import { StampCard } from '@loyaltylt/sdk/react';
function POSScreen({ game, cardId, shopId }) {
const handleAddStamps = async (gameId, cardId, shopId, count) => {
const result = await sdk.addStamps(gameId, cardId, shopId, count);
return result;
};
return (
<StampCard
game={game}
cardId={cardId}
shopId={shopId}
onAddStamps={handleAddStamps}
onGameCompleted={() => {
console.log('Game completed!');
// Refresh customer data
}}
/>
);
}
Error Responses
{
"success": false,
"message": "Game not found",
"code": "RESOURCE_NOT_FOUND"
}