Purchase a reward
Rewards
Purchase a reward
Redeem a reward for a customer, deducting points and generating a discount code.
POST
Purchase a reward
Purchase a reward on behalf of a customer, deducting the required points from their balance and generating a Shopify discount code.Documentation Index
Fetch the complete documentation index at: https://developers.mageloyalty.com/llms.txt
Use this file to discover all available pages before exploring further.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
customer_identifier | string | Yes | Shopify customer ID or email address |
Validations
- Customer must exist and not be excluded from the loyalty program
- Reward must be active and not deleted
- If the reward is restricted to a VIP tier, the customer must be on that tier
- Customer must have enough points to cover the reward’s
points_cost
Side effects
All non-blocking:- Generates a Shopify discount code
- Deducts points from the customer using FIFO logic
- Creates an activity log entry
- Fires Klaviyo, Omnisend, and Postscript reward-redeemed events
- Syncs Shopify metafields for the customer
Response
Returns201 Created:
Errors
| Status | Scenario |
|---|---|
400 | customer_identifier missing or invalid JSON |
403 | Customer is excluded, or not on the required VIP tier |
404 | Customer or reward not found |
422 | Insufficient points |
503 | Unable to connect to Shopify to generate the discount code |