Create loyalty reward
POST
/v2/loyalty/rewards
Creates a loyalty reward.
In the process, the endpoint does following:
- Uses the
reward_tier_id
in the request to determine the number of points to lock for this reward. - If the request includes
order_id
, it adds the reward and related discount to the order.
After a reward is created, the points are locked and not available for the buyer to redeem another reward.
Name | Description |
---|---|
reward
Required
|
The reward to create. |
idempotency_
Required
|
A unique string that identifies this |
Response Fields
Name | Description |
---|---|
errors
|
Any errors that occurred during the request. |
reward
|
The loyalty reward created. |
Examples
POST
/v2/loyalty/rewards
cURL
- cURL
- Ruby
- Python
- C#
- Java
- PHP
- Node.js
curl https://connect.squareup.com/v2/loyalty/rewards \
-X POST \
-H 'Square-Version: 2023-01-19' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"reward": {
"loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd",
"reward_tier_id": "e1b39225-9da5-43d1-a5db-782cdd8ad94f",
"order_id": "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY"
},
"idempotency_key": "18c2e5ea-a620-4b1f-ad60-7b167285e451"
}'
Response JSON
{
"reward": {
"id": "a8f43ebe-2ad6-3001-bdd5-7d7c2da08943",
"status": "ISSUED",
"loyalty_account_id": "5adcb100-07f1-4ee7-b8c6-6bb9ebc474bd",
"reward_tier_id": "e1b39225-9da5-43d1-a5db-782cdd8ad94f",
"points": 10,
"order_id": "RFZfrdtm3mhO1oGzf5Cx7fEMsmGZY",
"created_at": "2020-05-01T21:49:54Z",
"updated_at": "2020-05-01T21:49:54Z"
}
}