# Tiers
Tier endpoints allow the API user to manage a customer's tier settings.
# Base Route
/api/shopify/point_balances/:id/tiers
# Fetching a single Point Balance's Tier
# Route
Use the following GET route to fetch tier information of a single customer. Replace :id with the Shopify ID of the customer whose tier information you want to fetch.
/api/shopify/point_balances/:id/tier
# Example
Example request and result:
"GET https://loyalty.slrs.io/api/shopify/point_balances/123/tier"
{
"data": {
"advancement_data": {
"amount": "2000",
"currency": "JPY",
"deadline": "2023-01-01T00:00:00Z",
"raw_amount": 2000,
"spent_requirement": {
"amount": "2000",
"currency": "JPY",
"raw_amount": 2000
},
"tier_name": "Silver ",
"tier_uid": "08eeb334-df4d-11ed-ba1e-787b8aae8c7a",
"tiers": [
{
"amount": "2000",
"currency": "JPY",
"name": "Silver ",
"ratio": 0.03,
"raw_amount": 2000,
"spent_requirement": {
"amount": "2000",
"currency": "JPY",
"raw_amount": 2000
},
"uid": "08eeb334-df4d-11ed-ba1e-787b8aae8c7a"
}
]
},
"id": "6757085806881",
"maintenance_data": {
"amount": "1000",
"currency": "JPY",
"deadline": "2023-01-01T00:00:00Z",
"raw_amount": 1000,
"spent_requirement": {
"amount": "1000",
"currency": "JPY",
"raw_amount": 1000
}
},
"minimum_tier": "Bronze",
"skip_next_check": false,
"tier": "Bronze",
"tier_uid": "dd5cc1f2-df4c-11ed-8376-787b8aae8c7a"
}
}
# Updating a single Point Balance's Tier
# Route
Use the following POST route to manage a specific customer's tier settings.
/api/shopify/point_balances/:id/tiers
Replace :id
with the Shopify ID of the customer whose tier settings you want to update.
# Fields to Submit
The following fields may be submitted when updating a customer's tier settings
Key | Type | Required | Definition |
---|---|---|---|
tier | String | ❌ * | The tier the customer will be placed in |
minimum_tier | String | ❌ * | The customer will never be demoted below this rank automatically |
skip_next_check | Boolean | ❌ * | Skip next automatic tier designation |
* At least one of tier
, minimum_tier
, or skip_next_check
must be specified
# Tier
The tier
field may be specified as either the case-insensitive tier name string, or as an integer corresponding to the rank of the tier in order of ascending exclusivity.
E.g. 1 is Bronze (the default tier), 2 is Silver, and 3 is Gold
Note: passing the tier as an integer must be an integer type; a numeric string is not accepted unless it is the name of the tier (i.e. 1
not "1"
).
# Minimum Tier
The minimum_tier
field may be set as either a string or integer just as with the tier
explained above.
# Skip Next Check
If skip_next_check
is set to true
, the next automatic tier designation will be skipped for the given customer. The can be useful if, for example, you manually set the tier near the end of a rank up period and want the setting to carry over into the following rank up period.
The value is false
by default which means this customer's tier will be designated alongside all other customers during the next automatic designation. This is likely to be useful if, for example, you set the tier near the start of a rank up period.
# Response Fields
The following fields may be returned:
Key | Type | Definition |
---|---|---|
id | String | The Shopify ID of the customer |
tier | String | The tier the customer will be placed in |
minimum_tier | String | The customer will never be demoted below this rank automatically |
skip_next_check | Boolean | Skip next automatic tier designation [default false] |
# Examples
# Example 1
Example request to set customer 123 as a Silver tier customer and the response:
# Request
POST "https://loyalty.slrs.io/api/shopify/point_balances/123/tiers"
Body {
"tier": "silver"
}
# Response
{
"data": {
"id": "123",
"tier": "silver",
"minimum_tier": null,
"skip_next_check": false
}
}
# Example 2
Example request to set customer 123 as a Gold tier customer with a minimum tier of silver, skipping the next check, and the response:
# Request
POST "https://loyalty.slrs.io/api/shopify/point_balances/123/tiers"
Body {
"tier": "gold",
"minimum_tier": "silver",
"skip_next_check": true
}
# Response
{
"data": {
"id": "123",
"tier": "gold",
"minimum_tier": "silver",
"skip_next_check": true
}
}