# Point Allotments

Point allotment endpoints allow for updating point balances.

# Base Path

/api/shopify/point_allotments

# Fields

The following fields may be returned:

Key Type Definition
id String The EasyPoints ID of the point allotment
point_value Integer The duration the shop waits until a customer's points expire (in months)
inserted_at String The current datetime when this customer's points will expire (ISO8601 format)
point_balance Point Balance The point balance record.

# Fetching all Point Allotments

# Route

Use the following GET route to get all point allotments of a store.

/api/shopify/point_allotments

# Example

Example request and result:

"GET https://loyalty.slrs.io/api/shopify/point_allotments"
{
  "data": [
    {
      "action": "fulfillment-1",
      "allotment_cascade": null,
      "allotted_at": "2000-01-01T00:00:00.000000",
      "app_reference": "shopify_integration",
      "event_id": 1,
      "inserted_at": "2023-01-01T00:00:00.000000",
      "object": "line_item-1",
      "parent": "order-1",
      "point_balance_uid": "f715bfd4-de77-11ed-8597-787b8aae8c7a",
      "point_value": 100,
      "points_deducted": 0,
      "type": "fulfillment",
      "uid": "e94d0d42-df50-11ed-bb36-787b8aae8c7a"
    },
    {
      "action": null,
      "allotment_cascade": true,
      "allotted_at": "2023-01-01T00:00:00.000000",
      "app_reference": "shopify_integration",
      "event_id": null,
      "inserted_at": "2023-01-01T00:00:00.000000",
      "object": null,
      "parent": "point_story-2",
      "point_balance_uid": "f70bf33c-de77-11ed-9367-787b8aae8c7a",
      "point_value": 500,
      "points_deducted": 0,
      "type": "manual",
      "uid": "8a6e8036-e305-11ed-a715-787b8aae8c7a"
    }
  ]
}

# Creating a Point Allotment

# Route

Use the following POST route to create a point allotment of a single customer.

/api/shopify/point_allotments

# Fields to Submit

The following fields may be submitted when creating a point allotment:

Key Type Required Definition
customer_id String ✔️ The Shopify ID of the customer to receive the point allotment
point_value Integer ✔️ The amount of points to award (can be positive or negative)

# Example

Example request and result:

POST "https://loyalty.slrs.io/api/shopify/point_allotments"
Body {
  "point_value": 200,
  "customer_id": "123"
}
{
  "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": 594
    },
    "point_value": 200
  }
}

When point allotment is successfully created but the point balance couldn't be fetched, we return a status 201 response with a result like below:

{
  "data": {
    "id": "36ce8920-4a65-11eb-98c6-000c291828e7",
    "inserted_at": "2020-12-30T06:06:53.000000",
    "point_value": 200
  }
}