LoyaltyRewards
Create, delete, and query Square Loyalty rewards.
Table Specific Information
Select
The add-in uses the Square API to filter the results by the following columns and operators while the rest of the filter is executed client-side within the add-in.
- Id supports the following operator: =.
- CreatedAt supports the following operators: =, >=, <=, >, <.
- LoyaltyAccountId supports the following operator: =.
- Status supports the following operator: =.
Retrieve all loyalty rewards:
SELECT * FROM LoyaltyRewards
Retrieve a specific loyalty reward:
SELECT * FROM LoyaltyRewards WHERE Id = 'reward_id_here'
Retrieve rewards for a specific loyalty account:
SELECT * FROM LoyaltyRewards WHERE LoyaltyAccountId = 'loyalty_account_id_here'
Retrieve issued rewards:
SELECT * FROM LoyaltyRewards WHERE Status = 'ISSUED'
Insert
To create a loyalty reward, you must specify the LoyaltyAccountId, RewardTierId, and IdempotencyKey columns.
INSERT INTO LoyaltyRewards (LoyaltyAccountId, RewardTierId, IdempotencyKey) VALUES ('loyalty_account_id_here', 'reward_tier_id_here', 'unique-idempotency-key')
Delete
Delete a loyalty reward by providing the Id of the reward:
DELETE FROM LoyaltyRewards WHERE Id = 'reward_id_here'
Columns
| Name | Type | ReadOnly | Description |
| Id [KEY] | String | True |
The Square-assigned ID of the loyalty reward. |
| LoyaltyAccountId | String | False |
The Square-assigned ID of the loyalty account to which the reward belongs. |
| RewardTierId | String | False |
The Square-assigned ID of the reward tier used to create the reward. |
| OrderId | String | False |
The Square-assigned ID of the order to which the reward is attached. |
| Status | String | True |
The status of a loyalty reward. The allowed values are ISSUED, REDEEMED, DELETED. |
| Points | Integer | True |
The number of loyalty points used for the reward. |
| RedeemedAt | Datetime | True |
The timestamp when the reward was redeemed, in RFC 3339 format. |
| CreatedAt | Datetime | True |
The timestamp when the reward was created, in RFC 3339 format. |
| UpdatedAt | Datetime | True |
The timestamp when the reward was last updated, in RFC 3339 format. |
Pseudocolumns
Pseudo column fields are used in the WHERE clause of SELECT statements (unless stated otherwise) and offer a more granular control over the tuples that are returned from the data source.
| Name | Type | Description |
| IdempotencyKey | String |
A unique string that identifies the request. Required for INSERT operations. Maximum 128 characters. |