How to get Loyalty data from Splio?
Overview
Common use cases might include:
- Retrieving Loyalty information, such as membership status
- Accessing a list of available rewards of a member
- Retrive the information on the master reward before attribution of a code by your PoS
To access Loyalty data from Splio, you can use:
- Loyalty and Rewards APIs with incremental data synchronization. This method is suitable for synchronizing with Point of Sale (PoS) systems or e-commerce platforms.
Note that our API is designed to retrieve incrementally individual data and not to get large volume of data in real time.
Using Loyalty APIs
First you need to authenticate on Splio Loyalty APIs
1. Authentication
curl --request POST \
--url https://api.splio.com/authenticate \
--header 'accept: application/json' \
--header 'content-type: application/json'
For more details, refer to Authenticate documentation
2. Get Contact
You can fetch contact data using the externalId. In the following exemple, the externalId is the email:
curl --request GET \
--url https://api.splio.com/data/contacts/jdoe%40splio.com \
--header 'accept: application/json' \
--header 'authorization: Bearer XXX.YYY.ZZZ'
{
"id": 2205883,
"lastname": "Doe",
"firstname": "John",
"email": "[email protected]",
"loyalty": [
{
"card_code": "5843579208720",
"id_program": "4"
}
],
...
}
The payload return the loyalty.card_code
required to fetch any information on the membership.
3. Get Membership
Use the loyalty.card_code
from the previous GET Contact
curl --request GET \
--url https://api.splio.com/loyalty/members/5843579208720 \
--header 'accept: application/json' \
--header 'authorization: Bearer XXX.YYY.ZZZ'
{
"id": 18,
"card_code": "5843579208720",
"tier_joined_at": "2022-09-29 10:32:38",
"program_joined_at": "2022-09-29 10:32:38",
"card_expire_at": "9998-12-31 00:00:00",
"computed_at": "2023-05-18 16:14:37",
"q_point": 30,
"nq_point": 0,
"individual": {
"lastname": "Doe",
"firstname": "John",
"email": "[email protected]",
"creation_date": "2022-09-29 08:32:38",
"language": "fr",
...
},
"program": {
"id": 1,
"name": "Pop Hat",
"type": "tiered",
"status": "running",
"start_at": "2022-05-18 16:15:00",
...
},
"tier": {
"id": 1,
"name": "Bronze",
"created_at": "2022-05-18 16:11:08",
"updated_at": "2023-01-02 18:31:58",
"entry_threshold": 0,
"downgrade_threshold": 0,
"multiplier_q_points": 1,
"multiplier_nq_points": 1,
"is_point_based": true
},
"fields": []
}
You can see many informations, including the loyalty program, and the current status (tier) of this member within the loyalty program.
4. Reward attributions
To get the list of rewards attributed to a contact
curl --request GET \
--url https://api.splio.com/loyalty/v2/contacts/jdoe%40splio.com/rewards \
--header 'accept: application/json' \
--header 'authorization: Bearer XXX.YYY.ZZZ'
{
"paging": {
"cursors": {
"after": null,
"before": null
},
"previous": "https://api.splio.com/loyalty/v2/contacts/jdoe%40splio.com/rewards?limit=50",
"next": "https://api.splio.com/loyalty/v2/contacts/jdoe%40splio.com/rewards?limit=50"
},
"elements": [
{
"expiration_date": "2024-06-08 14:26:27",
"burned_date": null,
"program_name": "Pop Hat",
"external_id": "1000962192088",
"reason_msg": "",
"interaction_type": "reward_attribution",
"interaction_details": "Attribution of the reward",
"earned_date": "2023-06-08 14:26:27",
"card_code": "5843579208720",
"status": "valid",
"reward_definition": {
"name": "Donnez un coup de neuf à votre chapeau",
"external_id": "nettoyage",
"description": "Offrez un rafraîchissement à votre chapeau préféré.",
"monetary_type": "value",
"image_url": "https://res.cloudinary.com/hqgkh0ynz/image/upload/v1672673993/web-sdk/Nettoyage.jpg",
"monetary_value": 0,
"nqp_value": 100,
"monetary": true
},
...
}
],
"count_element": 1
}
You can see all the rewards attributed to a contact, across all his loyalty cards. Use card_code to filter out for rewards linked to one specific loyalty card.
Using the Loyalty Web Kit
Here are some methods available :
splioSDK.getRewards()
splioSDK.getTiers()
splioSDK.getUserRewards()
The Loyalty Web Kit needs to be init in order to use those functions. All functions available are described here.
Updated 12 months ago