Points & Earn Rules
Add store credits to customer account
POST
/
api
/
external
/
add-credits
Add store credits to customer account
curl --request POST \
--url https://loyalty-admin.appstle.com/api/external/add-credits \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <x-api-key>' \
--data '
{
"credits": 123,
"customerEmail": "<string>",
"customerId": 123,
"earnRuleId": 123,
"note": "<string>"
}
'import requests
url = "https://loyalty-admin.appstle.com/api/external/add-credits"
payload = {
"credits": 123,
"customerEmail": "<string>",
"customerId": 123,
"earnRuleId": 123,
"note": "<string>"
}
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({
credits: 123,
customerEmail: '<string>',
customerId: 123,
earnRuleId: 123,
note: '<string>'
})
};
fetch('https://loyalty-admin.appstle.com/api/external/add-credits', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://loyalty-admin.appstle.com/api/external/add-credits';
const options = {
method: 'POST',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
credits: 123,
customerEmail: '<string>',
customerId: 123,
earnRuleId: 123,
note: '<string>'
})
};
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/add-credits",
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([
'credits' => 123,
'customerEmail' => '<string>',
'customerId' => 123,
'earnRuleId' => 123,
'note' => '<string>'
]),
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/add-credits"
payload := strings.NewReader("{\n \"credits\": 123,\n \"customerEmail\": \"<string>\",\n \"customerId\": 123,\n \"earnRuleId\": 123,\n \"note\": \"<string>\"\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/add-credits")
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 \"credits\": 123,\n \"customerEmail\": \"<string>\",\n \"customerId\": 123,\n \"earnRuleId\": 123,\n \"note\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"achievableTierId": 123,
"availablePoints": 123,
"createAt": "2023-11-07T05:31:56Z",
"creditedPoints": 123,
"currentVipTier": "<string>",
"dob": "2023-12-25",
"expiringPointsAmount": 123,
"pendingPoints": 123,
"pointsExpireAt": "2023-11-07T05:31:56Z",
"referralLink": "<string>",
"referredCompleted": 123,
"rewardedForCreatingAccount": true,
"rewardedForFacebook": true,
"rewardedForInstagram": true,
"rewardedForNewsLetter": true,
"rewardedForPinterest": true,
"rewardedForSharingOnFacebook": true,
"rewardedForSharingOnX": true,
"rewardedForSms": true,
"rewardedForTiktok": true,
"rewardedForTwitter": true,
"rewardedForYoutube": true,
"rewards": [
{
"createAt": "2023-11-07T05:31:56Z",
"customerId": 123,
"discountCode": "<string>",
"shop": "<string>",
"amount": 123,
"description": "<string>",
"discountCodeId": "<string>",
"expireDate": "2023-11-07T05:31:56Z",
"id": 123,
"lastExpiryReminderSentDate": "2023-11-07T05:31:56Z",
"orderId": 123,
"orderName": "<string>",
"pointRedeemRuleId": 123,
"pointTransactionId": 123,
"productData": "<string>",
"usageCount": 123,
"usedAt": "2023-11-07T05:31:56Z",
"variantId": 123
}
],
"spentAmount": 123,
"storeCreditBalance": 123,
"storeCreditCurrency": "<string>",
"vipTierExpiredAt": "2023-11-07T05:31:56Z"
}Headers
API key for authentication
Body
application/json
Response
Store credits successfully added to customer account
Available options:
ACTIVE, INACTIVE, EXCLUDED, EXCLUDED_BY_CUSTOMER Show child attributes
Show child attributes
⌘I
Add store credits to customer account
curl --request POST \
--url https://loyalty-admin.appstle.com/api/external/add-credits \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <x-api-key>' \
--data '
{
"credits": 123,
"customerEmail": "<string>",
"customerId": 123,
"earnRuleId": 123,
"note": "<string>"
}
'import requests
url = "https://loyalty-admin.appstle.com/api/external/add-credits"
payload = {
"credits": 123,
"customerEmail": "<string>",
"customerId": 123,
"earnRuleId": 123,
"note": "<string>"
}
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({
credits: 123,
customerEmail: '<string>',
customerId: 123,
earnRuleId: 123,
note: '<string>'
})
};
fetch('https://loyalty-admin.appstle.com/api/external/add-credits', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://loyalty-admin.appstle.com/api/external/add-credits';
const options = {
method: 'POST',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
credits: 123,
customerEmail: '<string>',
customerId: 123,
earnRuleId: 123,
note: '<string>'
})
};
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/add-credits",
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([
'credits' => 123,
'customerEmail' => '<string>',
'customerId' => 123,
'earnRuleId' => 123,
'note' => '<string>'
]),
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/add-credits"
payload := strings.NewReader("{\n \"credits\": 123,\n \"customerEmail\": \"<string>\",\n \"customerId\": 123,\n \"earnRuleId\": 123,\n \"note\": \"<string>\"\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/add-credits")
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 \"credits\": 123,\n \"customerEmail\": \"<string>\",\n \"customerId\": 123,\n \"earnRuleId\": 123,\n \"note\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"achievableTierId": 123,
"availablePoints": 123,
"createAt": "2023-11-07T05:31:56Z",
"creditedPoints": 123,
"currentVipTier": "<string>",
"dob": "2023-12-25",
"expiringPointsAmount": 123,
"pendingPoints": 123,
"pointsExpireAt": "2023-11-07T05:31:56Z",
"referralLink": "<string>",
"referredCompleted": 123,
"rewardedForCreatingAccount": true,
"rewardedForFacebook": true,
"rewardedForInstagram": true,
"rewardedForNewsLetter": true,
"rewardedForPinterest": true,
"rewardedForSharingOnFacebook": true,
"rewardedForSharingOnX": true,
"rewardedForSms": true,
"rewardedForTiktok": true,
"rewardedForTwitter": true,
"rewardedForYoutube": true,
"rewards": [
{
"createAt": "2023-11-07T05:31:56Z",
"customerId": 123,
"discountCode": "<string>",
"shop": "<string>",
"amount": 123,
"description": "<string>",
"discountCodeId": "<string>",
"expireDate": "2023-11-07T05:31:56Z",
"id": 123,
"lastExpiryReminderSentDate": "2023-11-07T05:31:56Z",
"orderId": 123,
"orderName": "<string>",
"pointRedeemRuleId": 123,
"pointTransactionId": 123,
"productData": "<string>",
"usageCount": 123,
"usedAt": "2023-11-07T05:31:56Z",
"variantId": 123
}
],
"spentAmount": 123,
"storeCreditBalance": 123,
"storeCreditCurrency": "<string>",
"vipTierExpiredAt": "2023-11-07T05:31:56Z"
}