Claimed rewards
A Claimed Reward represents a unique instance of a particular customer having claimed a Reward.
Field | Type | Description |
---|---|---|
id | integer | Unique ID of the claimed reward in LoyaltyLion |
claimed_at | string | An ISO 8601 string representing the time the reward was claimed |
point_cost | integer | The points the customer spent to claim the reward |
redeemable | object | The specific redeemable that was allocated to the customer |
reward | object | The base reward that was claimed |
state | string | The claimed reward state (approved , void ) |
session | object or null | The session a claimed reward is linked to, only applicable to some rewards (for example, checkout redemption, buy with points) |
auto_refund_at | string or null | An ISO 8601 string representing when the claimed reward will be voided and refunded, or null if it does not apply |
expires_at | string or null | DEPRECATED An ISO 8601 string representing when the claimed reward will be voided and refunded, or null if it does not apply |
Redeemables
A Redeemable represents something a customer can redeem to get a benefit - including vouchers and custom reward fulfilments
Voucher
A Voucher represents a discount voucher which can be applied at checkout.
Field | Type | Description |
---|---|---|
code | string | The voucher code |
discount_amount | integer or null | The voucher’s discount amount, if different from the associated Reward’s base amount |
usage_count | integer | The number of times the voucher has been applied |
usage_limit | integer | The number of times the voucher may be applied |
expires_on | string or null | An ISO 8601 string representing when the redeemable will expire, null if never expires |
Free product
A Free Product represents a free product which can be claimed at checkout
Field | Type | Description |
---|---|---|
redeemable_type | string | Always ‘product’ |
product | object | The product id and variant id that’s being redeemed |
used_at | string or null | An ISO 8601 timestamp representing when this reward was used |
shopify_cart_line_item_context | string | The encrypted secret which discounts the line item to free during checkout |
expires_on | string or null | An ISO 8601 string representing when the redeemable will expire, null if never expires |
Fulfilment
A Fulfilment represents the benefit from a custom reward.
Field | Type | Description |
---|---|---|
fulfilled | boolean | true if the custom reward has been fulfilled |
fulfilled_at | string or null | The ISO 8601 string that the reward was fulfilled |
expires_on | null | Does not expire |
Claimed reward session
A Claimed Reward Session represents the session this claimed reward was claimed in.
Field | Type | Description |
---|---|---|
kind | string | The kind of session the claimed reward links to, one of custom , cart or checkout |
token | string | The token associated with the session |
POST /v2/customers/:merchant_id/claimed_rewards
Claims a reward, or errors if the customer has insufficient points to claim the reward.
Request
Param | Type | Required | Description |
---|---|---|---|
reward_id | integer | yes | The ID of the reward the customer is claiming |
multiplier | integer | no | The multiplier of the reward being claimed. Only supported for custom reward type |
variant_id | integer | sometimes | The Shopify variant being claimed. Required when the reward is a seamless product reward |
Response
On success, the endpoint returns a claimed reward.
If the customer has insufficient points, the endpoint returns a HTTP 422.
Example
curl -X POST \
--url 'https://api.loyaltylion.com/v2/customers/1001/claimed_rewards' \
--header 'Content-Type: application/json' \
--data '{
"reward_id": 123,
}'
POST /v2/customers/:merchant_id/claimed_rewards/:id/refund
Refunds a claimed reward.
Request
There are no parameters for this request.
Response
On success, the endpoint returns the refunded reward and whether the underlying reward resource has been deleted.
Field | Type | Description |
---|---|---|
claimed_reward | object | The claimed reward that was refunded |
remote_resource_deleted | boolean | true if the remote resource was deleted, false if it wasn’t |
- Returns a
200
response with the updated reward if the refund was successful. - Returns a
422
response if the reward has already been refunded. - If no customer matching the
:merchant_id
can be found, then a404 Not Found
response is returned. - If no reward matching the
:id
can be found, then a404 Not Found
response is returned.
Example
curl -X POST \
--url 'https://api.loyaltylion.com/v2/customers/1001/claimed_rewards/123/refund' \
--header 'Content-Type: application/json'