Learn how to verify/check if a user has completed specific loyalty rules and received rewards
When implementing loyalty rules in your application, you often need to know whether a user has already completed a rule and received rewards. This information is useful for:
Snag provides a straightforward way to check rule completion and reward status using the transaction entries endpoint.
The transaction entries API endpoint allows you to check whether a user has completed specific rules by looking for reward transactions associated with those rules.
GET /api/loyalty/transaction_entries
Parameter | Type | Description |
---|---|---|
userCompletedLoyaltyRuleId | string[] | Array of loyalty rule IDs to check for completion |
userId | string | The ID of the user to check |
Important: When using the userCompletedLoyaltyRuleId
parameter, the endpoint will return only the latest transaction entry for each specified rule ID. This optimized behavior makes it ideal for quickly checking completion status without filtering through multiple entries per rule.
The response contains an array of transaction entries, each representing the most recent reward transaction for a completed rule:
Rule is completed: If a transaction entry exists for a specific rule ID, the user has completed that rule and received rewards.
Rule is not completed: If no transaction entry exists for a rule ID, the user has not completed that rule or has not received rewards for it.
Latest entries only: Since the userCompletedLoyaltyRuleId
parameter is used, the endpoint returns only the latest entry per rule, you’ll always see the most recent completion status, which is particularly useful for rules that can be completed multiple times (like daily check-ins).
Here’s a complete example showing how to check if a user has completed specific rules and display the appropriate UI:
For more information on handling rule completion, refer to:
userCompletedLoyaltyRuleId
parameter, the endpoint returns only the latest entry per rule, making it efficient for checking current completion statusLearn how to verify/check if a user has completed specific loyalty rules and received rewards
When implementing loyalty rules in your application, you often need to know whether a user has already completed a rule and received rewards. This information is useful for:
Snag provides a straightforward way to check rule completion and reward status using the transaction entries endpoint.
The transaction entries API endpoint allows you to check whether a user has completed specific rules by looking for reward transactions associated with those rules.
GET /api/loyalty/transaction_entries
Parameter | Type | Description |
---|---|---|
userCompletedLoyaltyRuleId | string[] | Array of loyalty rule IDs to check for completion |
userId | string | The ID of the user to check |
Important: When using the userCompletedLoyaltyRuleId
parameter, the endpoint will return only the latest transaction entry for each specified rule ID. This optimized behavior makes it ideal for quickly checking completion status without filtering through multiple entries per rule.
The response contains an array of transaction entries, each representing the most recent reward transaction for a completed rule:
Rule is completed: If a transaction entry exists for a specific rule ID, the user has completed that rule and received rewards.
Rule is not completed: If no transaction entry exists for a rule ID, the user has not completed that rule or has not received rewards for it.
Latest entries only: Since the userCompletedLoyaltyRuleId
parameter is used, the endpoint returns only the latest entry per rule, you’ll always see the most recent completion status, which is particularly useful for rules that can be completed multiple times (like daily check-ins).
Here’s a complete example showing how to check if a user has completed specific rules and display the appropriate UI:
For more information on handling rule completion, refer to:
userCompletedLoyaltyRuleId
parameter, the endpoint returns only the latest entry per rule, making it efficient for checking current completion status