Loyalty
Update loyalty balance
PATCH
/
api
/
v1
/
loyalty
/
{id}
Update loyalty balance
curl --request PATCH \
--url https://api.passentry.com/api/v1/loyalty/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"balance": 10
}'import requests
url = "https://api.passentry.com/api/v1/loyalty/{id}"
payload = { "balance": 10 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({balance: 10})
};
fetch('https://api.passentry.com/api/v1/loyalty/{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://api.passentry.com/api/v1/loyalty/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'balance' => 10
]),
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://api.passentry.com/api/v1/loyalty/{id}"
payload := strings.NewReader("{\n \"balance\": 10\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.passentry.com/api/v1/loyalty/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"balance\": 10\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.passentry.com/api/v1/loyalty/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"balance\": 10\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "2258d9ed-05bc-47cd-be65-83b9bb5e0273",
"type": "pass",
"attributes": {
"downloadUrl": "https://www.example.com?pass=2258d9ed-05bc-47cd-be65-83b9bb5e0273",
"passType": "storeCard",
"deviceType": "android",
"createdAt": "2022-01-01T00:00:00Z",
"status": "active",
"extId": "4e9ab9e571bbc8ff64e7",
"passTemplateUuid": "b7f3372d08eddd76f28926ff",
"passTemplateName": "PassEntry Store",
"nfc": "941c35348d16187199a6b41047f0b7862b2dcb67",
"barcode": {},
"passContent": {
"description": "Template Description",
"centralTitle": "Template Central Title",
"fullName": "Robert Smith",
"labelTwo": "11",
"points": "17",
"terms": "Your use of the Google Wallet is subject to Google's terms and conditions of use, which PassEntry are not responsible for."
}
}
},
"meta": {
"loyalty": {
"balance": 17
}
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Pass UUID or External ID
Query Parameters
If true, includes the pass design in the response
If true, includes the locations in the response if any are present
If true, includes the beacons in the response if any are present
Body
application/json
If integer is positive, balance is added. If negative, balance is subtracted. Cannot be used with overrideBalance key
Example:
-10
Override the balance and set it to this value. Cannot be used with balance key
Example:
0
Push Notification message to display. Only used if pass is active. Use alongside balance or overrideBalance keys
Was this page helpful?
⌘I
Update loyalty balance
curl --request PATCH \
--url https://api.passentry.com/api/v1/loyalty/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"balance": 10
}'import requests
url = "https://api.passentry.com/api/v1/loyalty/{id}"
payload = { "balance": 10 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({balance: 10})
};
fetch('https://api.passentry.com/api/v1/loyalty/{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://api.passentry.com/api/v1/loyalty/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'balance' => 10
]),
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://api.passentry.com/api/v1/loyalty/{id}"
payload := strings.NewReader("{\n \"balance\": 10\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.passentry.com/api/v1/loyalty/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"balance\": 10\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.passentry.com/api/v1/loyalty/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"balance\": 10\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "2258d9ed-05bc-47cd-be65-83b9bb5e0273",
"type": "pass",
"attributes": {
"downloadUrl": "https://www.example.com?pass=2258d9ed-05bc-47cd-be65-83b9bb5e0273",
"passType": "storeCard",
"deviceType": "android",
"createdAt": "2022-01-01T00:00:00Z",
"status": "active",
"extId": "4e9ab9e571bbc8ff64e7",
"passTemplateUuid": "b7f3372d08eddd76f28926ff",
"passTemplateName": "PassEntry Store",
"nfc": "941c35348d16187199a6b41047f0b7862b2dcb67",
"barcode": {},
"passContent": {
"description": "Template Description",
"centralTitle": "Template Central Title",
"fullName": "Robert Smith",
"labelTwo": "11",
"points": "17",
"terms": "Your use of the Google Wallet is subject to Google's terms and conditions of use, which PassEntry are not responsible for."
}
}
},
"meta": {
"loyalty": {
"balance": 17
}
}
}