# Point Balances
# Point Balance Type
The point balance JSON object is of form:
Key | Type | Definition |
---|---|---|
id | String | The Shopify ID of the customer |
expiration_delay | Integer | The duration the shop waits until a customer's points expire (in months) |
expires_at | String | The current datetime when this customer's points will expire (ISO8601 format) |
point_balance | Integer | The number of points this customer has available |
# Fetching a single Point Balance
# Route
Use the following GET route to fetch the point balance of a single customer. Replace :id
with the Shopify ID of the customer whose point balance you want to fetch.
https://loyalty.slrs.io/api/shopify/point_balances/:shopify_customer_id
The :shopify_customer_id
references the customer's id on Shopify.
# Arguments
# Required Parameters
None
# Optional Parameters
None
# Returns
The following fields may be returned:
Key | Type | Definition |
---|---|---|
id | String | The Shopify ID of the customer |
expiration_delay | Integer | The duration the shop waits until a customer's points expire (in months) |
expires_at | String | The current datetime when this customer's points will expire (ISO8601 format) |
point_balance | Integer | The number of points this customer has available |
# Example
Example request and result:
curl -X GET \
'https://loyalty.slrs.io/api/shopify/point_balance/1234567890' \
-H 'content-type: application/json' \
-H 'authorization: Basic ${API_CREDENTIALS}'
{
"data": {
"expiration_delay": 3,
"expires_at": "2020-11-14T07:00:35.000000Z",
"id": "123",
"point_balance": 800
}
}
# Setting a single Point Balance
Use the following POST route to set a point balance to a given amount. This will do this by also creating a point allotment for the difference between the current balance and the value set
https://loyalty.slrs.io/api/shopify/point_balances/:customer_shopify_id/set_balances
- :customer_shopify_id in the route can also be an email (may need to be url encoded)
# Arguments
# Required Parameters
The following fields must be submitted when creating a point allotment:
Key | Type | Required | Definition |
---|---|---|---|
balance | Integer | ✔️ | The new balance for the customer |
# Optional Parameters
None
# Returns
The following fields may be returned:
Key | Type | Definition |
---|---|---|
id | String | The easyPoints ID of the point allotment |
point_value | Integer | The increase or decrease in point value of the point balance |
inserted_at | String | The current datetime when the customer's point balance was updated |
point_balance | Point Balance | The point balance record |
# Example
Example request and result:
curl -X POST \
'https://loyalty.slrs.io/api/shopify/point_balances/1234567890/set_balance' \
-H 'content-type: application/json' \
-H 'authorization: Basic ${API_CREDENTIALS}'
-d '{
"balance": 200,
}'
{
"data": {
"id": "36ce8920-4a65-11eb-98c6-000c291828e7",
"inserted_at": "2020-12-30T06:06:53.000000",
"point_balance": {
"expiration_delay": 3,
"expires_at": "2021-03-20T23:51:09.000000Z",
"id": "123",
"point_balance": 200
},
"point_value": 100
}
}
# Requesting CSV export to webhook
# Route
Use the following GET route to request a CSV export to a webhook you setup.
https://loyalty.slrs.io/api/shopify/point_balances/export
# Arguments
# Required Parameters
None
# Optional Parameters
None
# Returns
An acknowledgement that the request has begun processing
# Example
Example request:
curl -X GET \
'https://loyalty.slrs.io/api/shopify/point_balances/export' \
-H 'content-type: application/json' \
-H 'authorization: Basic ${API_CREDENTIALS}'