Redeem customer points for rewards
Processes a point redemption request and generates a discount code or reward.
How it works:
- Validates customer has sufficient available points
- Deducts points from customer’s balance
- Creates a discount code in Shopify (if applicable)
- Creates a reward record with status “UNUSED”
- Logs the transaction for audit trail
- Returns updated customer loyalty information
Request body fields:
- customerId OR customerEmail: Identify the customer (provide one, not both)
- redeemRuleId: ID of the redemption rule to use (required)
- points: Number of points to spend (DYNAMIC_DISCOUNT rewards only) Required for a DYNAMIC_DISCOUNT reward: the customer’s points are spent and the rule’s discount is given for every redeemPoints points Ignored for every other reward type (STORE_CREDIT, DISCOUNT_CODE, PRODUCT_DISCOUNT, COLLECTION_DISCOUNT, FREE_PRODUCT, FREE_SHIPPING): they spend the rule’s own redeemPoints and give its fixed reward
- variantId: For a FREE_PRODUCT or PRODUCT_DISCOUNT reward, the id of the product or variant the customer picked, from the rule’s productData (optional). For a FREE_PRODUCT reward that lists a whole product, the id of one of that product’s variants is also accepted, and the code still covers the whole product. Any other id returns 400 “Product isn’t eligible for discount.”
Redemption rule types:
- Fixed discount: Creates discount code for fixed amount off
- Percentage discount: Creates discount code for percentage off
- Free shipping: Creates free shipping discount code
- Free product: Creates discount code for a free product (send variantId for the product the customer picked)
- Store credit: Adds credit to customer’s account
Important validation rules:
- Customer must have at least the points required for redemption
- Customer must be enrolled in loyalty program
- Redemption rule must be active
- Points are deducted immediately
- A customer the merchant excluded, or who opted out, gets 200 and no new reward
- One redeem at a time per customer: a second call while one is running gets 400
Common errors (400, the reason is in title):
- “Points not available”: The customer doesn’t have enough available points
- “Redeem rule not available”: No redeemRuleId was sent, it doesn’t exist, or the rule isn’t active
- “Customer not found using this customerID” or “Customer not found using this email”: No customer with that ID or email in the loyalty program
- “Customer info not found”: Neither customerId nor customerEmail was sent
- “Points to redeem must be greater than zero.”: A DYNAMIC_DISCOUNT reward was redeemed without a positive points value
- “Customer Not eligible for redeeming points”: The reward is limited to other customers
- “Redeem operation already in progress for this customer. Please try again.”: Another redeem for this customer is still running. Read the customer’s loyalty data before you retry
Best practices:
- Always check customer’s availablePoints before attempting redemption
- Use GET /api/external/point-redeem-rules to get available redemption options
- Store the returned discount code for customer to use at checkout
- Monitor for 400 errors and handle insufficient points gracefully
- A redeem isn’t idempotent: a repeated call spends the points again. After a network error, call GET /api/external/customer-loyalty before you retry
curl --request POST \
--url https://loyalty-admin.appstle.com/api/external/redeem-points \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <x-api-key>' \
--data '
{
"redeemRuleId": 5
}
'import requests
url = "https://loyalty-admin.appstle.com/api/external/redeem-points"
payload = { "redeemRuleId": 5 }
headers = {
"X-API-Key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({redeemRuleId: 5})
};
fetch('https://loyalty-admin.appstle.com/api/external/redeem-points', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://loyalty-admin.appstle.com/api/external/redeem-points';
const options = {
method: 'POST',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({redeemRuleId: 5})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://loyalty-admin.appstle.com/api/external/redeem-points",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'redeemRuleId' => 5
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://loyalty-admin.appstle.com/api/external/redeem-points"
payload := strings.NewReader("{\n \"redeemRuleId\": 5\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<x-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://loyalty-admin.appstle.com/api/external/redeem-points")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"redeemRuleId\": 5\n}"
response = http.request(request)
puts response.read_body{
"availablePoints": 4798.24,
"creditedPoints": 26272.41,
"currentVipTier": "Gold",
"customerStatus": "ACTIVE",
"dob": null,
"pendingPoints": 0,
"referralLink": "https://referral.appstle.com/YOUR_REFERRAL_CODE",
"referredCompleted": 3,
"rewards": [
{
"createAt": "2026-11-11T14:45:48.74289Z",
"description": "$5.00 off your order",
"discountCode": "AL_EXAMPLE12345678",
"expireDate": null,
"id": 137994,
"orderName": null,
"pointRedeemRuleId": 8853,
"rewardType": "DISCOUNT_CODE",
"status": "UNUSED",
"usedAt": null
}
],
"spentAmount": 46,
"storeCreditBalance": 10,
"storeCreditCurrency": "USD",
"vipTierExpiredAt": null
}{
"message": "error.",
"params": "",
"status": 400,
"title": "Customer not found using this customerID",
"type": "https://appstle.com/problem/problem-with-message"
}{
"detail": "Invalid authentication",
"status": 401
}Body
Redemption request with customer ID/email, redeem rule ID, points to redeem
Customer's email address. Alternative to customerId for identifying the customer. Provide either customerId OR customerEmail, not both. Must be a valid email address that exists in your Shopify store. Example: customer@example.com
"customer@example.com"
Number of points to spend. Only DYNAMIC_DISCOUNT rewards use it: the customer chooses how many points to spend and gets the rule's discount for every redeemPoints points. Required and must be positive for those rewards, and the customer must have at least this many available points. Every other reward type (STORE_CREDIT, DISCOUNT_CODE, PRODUCT_DISCOUNT, COLLECTION_DISCOUNT, FREE_PRODUCT, FREE_SHIPPING) ignores it and spends the rule's own redeemPoints for its fixed reward. Example: 100.0
100
For a FREE_PRODUCT or PRODUCT_DISCOUNT reward, the id of the product or variant the customer picked, from the rule's productData. Optional. For a FREE_PRODUCT reward that lists a whole product, the id of one of that product's variants is also accepted, and the code still covers the whole product. Any other id returns 400. Example: 12345678
12345678
Response
Points successfully redeemed and reward generated
The customer's short referral link, on https://referral.appstle.com/ or the merchant's custom referral domain. Its last part is the customer's referral token, which Accept referral offer takes as token. The link redirects to the store's primary domain with appstle_referral=true and appstle_referral_code={token} in the query string.
"https://referral.appstle.com/abc123def456ghij"
curl --request POST \
--url https://loyalty-admin.appstle.com/api/external/redeem-points \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <x-api-key>' \
--data '
{
"redeemRuleId": 5
}
'import requests
url = "https://loyalty-admin.appstle.com/api/external/redeem-points"
payload = { "redeemRuleId": 5 }
headers = {
"X-API-Key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({redeemRuleId: 5})
};
fetch('https://loyalty-admin.appstle.com/api/external/redeem-points', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://loyalty-admin.appstle.com/api/external/redeem-points';
const options = {
method: 'POST',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({redeemRuleId: 5})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://loyalty-admin.appstle.com/api/external/redeem-points",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'redeemRuleId' => 5
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://loyalty-admin.appstle.com/api/external/redeem-points"
payload := strings.NewReader("{\n \"redeemRuleId\": 5\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<x-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://loyalty-admin.appstle.com/api/external/redeem-points")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"redeemRuleId\": 5\n}"
response = http.request(request)
puts response.read_body{
"availablePoints": 4798.24,
"creditedPoints": 26272.41,
"currentVipTier": "Gold",
"customerStatus": "ACTIVE",
"dob": null,
"pendingPoints": 0,
"referralLink": "https://referral.appstle.com/YOUR_REFERRAL_CODE",
"referredCompleted": 3,
"rewards": [
{
"createAt": "2026-11-11T14:45:48.74289Z",
"description": "$5.00 off your order",
"discountCode": "AL_EXAMPLE12345678",
"expireDate": null,
"id": 137994,
"orderName": null,
"pointRedeemRuleId": 8853,
"rewardType": "DISCOUNT_CODE",
"status": "UNUSED",
"usedAt": null
}
],
"spentAmount": 46,
"storeCreditBalance": 10,
"storeCreditCurrency": "USD",
"vipTierExpiredAt": null
}{
"message": "error.",
"params": "",
"status": 400,
"title": "Customer not found using this customerID",
"type": "https://appstle.com/problem/problem-with-message"
}{
"detail": "Invalid authentication",
"status": 401
}