# Point Balances
Point balance endpoints return EasyPoints data about the specified customer(s).
# Base Route
/api/shopify/point_balances
# Fields
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 |
# 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.
/api/shopify/point_balances/:id
# Example
Example request and result:
GET "https://loyalty.slrs.io/api/shopify/point_balances/123"
{
"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 create a point allotment for the difference from the current balance and update the balance.
/api/shopify/point_balances/:id/set_balance
- Point balance
id
in the route can also be an email (may need to be url encoded)
# Fields
The following point allotment 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 |
# Fields to Submit
The following fields may be submitted when creating a point allotment:
Key | Type | Required | Definition |
---|---|---|---|
balance | Integer | ✔️ | The new balance for the customer |
# Example
Example request and result:
POST "https://loyalty.slrs.io/api/shopify/point_balances/123/set_balance"
Body {
"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
}
}