Loyalty
Update loyalty program detail
PUT
/
customers
/
loyalty-program
/
{id}
Update loyalty program detail
curl --request PUT \
--url https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/loyalty-program/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"starts_at": "2023-11-07T05:31:56Z",
"date_of_reset": "2023-12-25",
"point_value": 1,
"redemption_inactivity_days": 123,
"tiers": [
{
"name": "<string>",
"total_spent_threshold": 1,
"total_orders_threshold": 1,
"points_earning_rate": 123,
"fixed_points": 123
}
],
"seller_id": [
"<string>"
],
"customer_group_id": [
"<string>"
],
"pause_starts_at": "2023-11-07T05:31:56Z",
"pause_ends_at": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/loyalty-program/{id}"
payload = {
"name": "<string>",
"starts_at": "2023-11-07T05:31:56Z",
"date_of_reset": "2023-12-25",
"point_value": 1,
"redemption_inactivity_days": 123,
"tiers": [
{
"name": "<string>",
"total_spent_threshold": 1,
"total_orders_threshold": 1,
"points_earning_rate": 123,
"fixed_points": 123
}
],
"seller_id": ["<string>"],
"customer_group_id": ["<string>"],
"pause_starts_at": "2023-11-07T05:31:56Z",
"pause_ends_at": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
starts_at: '2023-11-07T05:31:56Z',
date_of_reset: '2023-12-25',
point_value: 1,
redemption_inactivity_days: 123,
tiers: [
{
name: '<string>',
total_spent_threshold: 1,
total_orders_threshold: 1,
points_earning_rate: 123,
fixed_points: 123
}
],
seller_id: ['<string>'],
customer_group_id: ['<string>'],
pause_starts_at: '2023-11-07T05:31:56Z',
pause_ends_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/loyalty-program/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/loyalty-program/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'starts_at' => '2023-11-07T05:31:56Z',
'date_of_reset' => '2023-12-25',
'point_value' => 1,
'redemption_inactivity_days' => 123,
'tiers' => [
[
'name' => '<string>',
'total_spent_threshold' => 1,
'total_orders_threshold' => 1,
'points_earning_rate' => 123,
'fixed_points' => 123
]
],
'seller_id' => [
'<string>'
],
'customer_group_id' => [
'<string>'
],
'pause_starts_at' => '2023-11-07T05:31:56Z',
'pause_ends_at' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/loyalty-program/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"date_of_reset\": \"2023-12-25\",\n \"point_value\": 1,\n \"redemption_inactivity_days\": 123,\n \"tiers\": [\n {\n \"name\": \"<string>\",\n \"total_spent_threshold\": 1,\n \"total_orders_threshold\": 1,\n \"points_earning_rate\": 123,\n \"fixed_points\": 123\n }\n ],\n \"seller_id\": [\n \"<string>\"\n ],\n \"customer_group_id\": [\n \"<string>\"\n ],\n \"pause_starts_at\": \"2023-11-07T05:31:56Z\",\n \"pause_ends_at\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}HttpResponse<String> response = Unirest.put("https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/loyalty-program/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"date_of_reset\": \"2023-12-25\",\n \"point_value\": 1,\n \"redemption_inactivity_days\": 123,\n \"tiers\": [\n {\n \"name\": \"<string>\",\n \"total_spent_threshold\": 1,\n \"total_orders_threshold\": 1,\n \"points_earning_rate\": 123,\n \"fixed_points\": 123\n }\n ],\n \"seller_id\": [\n \"<string>\"\n ],\n \"customer_group_id\": [\n \"<string>\"\n ],\n \"pause_starts_at\": \"2023-11-07T05:31:56Z\",\n \"pause_ends_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/loyalty-program/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"date_of_reset\": \"2023-12-25\",\n \"point_value\": 1,\n \"redemption_inactivity_days\": 123,\n \"tiers\": [\n {\n \"name\": \"<string>\",\n \"total_spent_threshold\": 1,\n \"total_orders_threshold\": 1,\n \"points_earning_rate\": 123,\n \"fixed_points\": 123\n }\n ],\n \"seller_id\": [\n \"<string>\"\n ],\n \"customer_group_id\": [\n \"<string>\"\n ],\n \"pause_starts_at\": \"2023-11-07T05:31:56Z\",\n \"pause_ends_at\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"success": true,
"content": {
"loyalty_program": {
"name": "<string>",
"renewal_type": "yearly",
"starts_at": "2023-11-07T05:31:56Z",
"date_of_reset": "2023-12-25",
"tier_upgrade_criteria": "total-spent",
"points_earning_type": "dynamic",
"point_value": 1,
"redemption_expiry_type": "never",
"redemption_inactivity_days": 123,
"tiers": [
{
"name": "<string>",
"total_spent_threshold": 1,
"total_orders_threshold": 1,
"points_earning_rate": 123,
"fixed_points": 123,
"id": "<string>",
"is_initial": true,
"next_tier_id": "<string>"
}
],
"id": "<string>",
"seller_id": [
"<string>"
],
"customer_group_id": [
"<string>"
],
"status": "draft",
"pause_starts_at": "2023-11-07T05:31:56Z",
"pause_ends_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z"
}
}
}Authorizations
Body
application/json
Defines when loyalty points are expired. "never" means the points never expire, "inactivity" means the points expire after a certain number of days of inactivity, "reset_date" means the points expire when the loyalty program is reset.
Available options:
never, inactivity, reset_date Was this page helpful?
⌘I
Update loyalty program detail
curl --request PUT \
--url https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/loyalty-program/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"starts_at": "2023-11-07T05:31:56Z",
"date_of_reset": "2023-12-25",
"point_value": 1,
"redemption_inactivity_days": 123,
"tiers": [
{
"name": "<string>",
"total_spent_threshold": 1,
"total_orders_threshold": 1,
"points_earning_rate": 123,
"fixed_points": 123
}
],
"seller_id": [
"<string>"
],
"customer_group_id": [
"<string>"
],
"pause_starts_at": "2023-11-07T05:31:56Z",
"pause_ends_at": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/loyalty-program/{id}"
payload = {
"name": "<string>",
"starts_at": "2023-11-07T05:31:56Z",
"date_of_reset": "2023-12-25",
"point_value": 1,
"redemption_inactivity_days": 123,
"tiers": [
{
"name": "<string>",
"total_spent_threshold": 1,
"total_orders_threshold": 1,
"points_earning_rate": 123,
"fixed_points": 123
}
],
"seller_id": ["<string>"],
"customer_group_id": ["<string>"],
"pause_starts_at": "2023-11-07T05:31:56Z",
"pause_ends_at": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
starts_at: '2023-11-07T05:31:56Z',
date_of_reset: '2023-12-25',
point_value: 1,
redemption_inactivity_days: 123,
tiers: [
{
name: '<string>',
total_spent_threshold: 1,
total_orders_threshold: 1,
points_earning_rate: 123,
fixed_points: 123
}
],
seller_id: ['<string>'],
customer_group_id: ['<string>'],
pause_starts_at: '2023-11-07T05:31:56Z',
pause_ends_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/loyalty-program/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/loyalty-program/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'starts_at' => '2023-11-07T05:31:56Z',
'date_of_reset' => '2023-12-25',
'point_value' => 1,
'redemption_inactivity_days' => 123,
'tiers' => [
[
'name' => '<string>',
'total_spent_threshold' => 1,
'total_orders_threshold' => 1,
'points_earning_rate' => 123,
'fixed_points' => 123
]
],
'seller_id' => [
'<string>'
],
'customer_group_id' => [
'<string>'
],
'pause_starts_at' => '2023-11-07T05:31:56Z',
'pause_ends_at' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/loyalty-program/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"date_of_reset\": \"2023-12-25\",\n \"point_value\": 1,\n \"redemption_inactivity_days\": 123,\n \"tiers\": [\n {\n \"name\": \"<string>\",\n \"total_spent_threshold\": 1,\n \"total_orders_threshold\": 1,\n \"points_earning_rate\": 123,\n \"fixed_points\": 123\n }\n ],\n \"seller_id\": [\n \"<string>\"\n ],\n \"customer_group_id\": [\n \"<string>\"\n ],\n \"pause_starts_at\": \"2023-11-07T05:31:56Z\",\n \"pause_ends_at\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}HttpResponse<String> response = Unirest.put("https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/loyalty-program/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"date_of_reset\": \"2023-12-25\",\n \"point_value\": 1,\n \"redemption_inactivity_days\": 123,\n \"tiers\": [\n {\n \"name\": \"<string>\",\n \"total_spent_threshold\": 1,\n \"total_orders_threshold\": 1,\n \"points_earning_rate\": 123,\n \"fixed_points\": 123\n }\n ],\n \"seller_id\": [\n \"<string>\"\n ],\n \"customer_group_id\": [\n \"<string>\"\n ],\n \"pause_starts_at\": \"2023-11-07T05:31:56Z\",\n \"pause_ends_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/loyalty-program/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"starts_at\": \"2023-11-07T05:31:56Z\",\n \"date_of_reset\": \"2023-12-25\",\n \"point_value\": 1,\n \"redemption_inactivity_days\": 123,\n \"tiers\": [\n {\n \"name\": \"<string>\",\n \"total_spent_threshold\": 1,\n \"total_orders_threshold\": 1,\n \"points_earning_rate\": 123,\n \"fixed_points\": 123\n }\n ],\n \"seller_id\": [\n \"<string>\"\n ],\n \"customer_group_id\": [\n \"<string>\"\n ],\n \"pause_starts_at\": \"2023-11-07T05:31:56Z\",\n \"pause_ends_at\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"success": true,
"content": {
"loyalty_program": {
"name": "<string>",
"renewal_type": "yearly",
"starts_at": "2023-11-07T05:31:56Z",
"date_of_reset": "2023-12-25",
"tier_upgrade_criteria": "total-spent",
"points_earning_type": "dynamic",
"point_value": 1,
"redemption_expiry_type": "never",
"redemption_inactivity_days": 123,
"tiers": [
{
"name": "<string>",
"total_spent_threshold": 1,
"total_orders_threshold": 1,
"points_earning_rate": 123,
"fixed_points": 123,
"id": "<string>",
"is_initial": true,
"next_tier_id": "<string>"
}
],
"id": "<string>",
"seller_id": [
"<string>"
],
"customer_group_id": [
"<string>"
],
"status": "draft",
"pause_starts_at": "2023-11-07T05:31:56Z",
"pause_ends_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z"
}
}
}