Pause loyalty program
curl --request PUT \
--url https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/loyalty-program/{id}/pause \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"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}/pause"
payload = {
"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({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}/pause', 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}/pause",
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([
'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}/pause"
payload := strings.NewReader("{\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}/pause")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\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}/pause")
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 \"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-12-25",
"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": 123
}
],
"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"
}
}
}Customers
Pause loyalty program
Pauses the loyalty program, setting its status to paused. Can only be used when the current status is active or paused. Returns the updated LoyaltyProgram object.
PUT
/
customers
/
loyalty-program
/
{id}
/
pause
Pause loyalty program
curl --request PUT \
--url https://staging.api.commercengine.io/api/v1/{store_id}/admin/customers/loyalty-program/{id}/pause \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"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}/pause"
payload = {
"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({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}/pause', 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}/pause",
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([
'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}/pause"
payload := strings.NewReader("{\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}/pause")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\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}/pause")
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 \"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-12-25",
"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": 123
}
],
"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
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
loyalty program id
Body
application/json
Was this page helpful?
⌘I