curl --request PATCH \
--url https://{host}/bonus/v1/accounts/{accountId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"isActive": false,
"isAllowedToSpend": false,
"expireBalance": true
}
'import requests
url = "https://{host}/bonus/v1/accounts/{accountId}"
payload = {
"isActive": False,
"isAllowedToSpend": False,
"expireBalance": True
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({isActive: false, isAllowedToSpend: false, expireBalance: true})
};
fetch('https://{host}/bonus/v1/accounts/{accountId}', 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://{host}/bonus/v1/accounts/{accountId}",
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([
'isActive' => false,
'isAllowedToSpend' => false,
'expireBalance' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://{host}/bonus/v1/accounts/{accountId}"
payload := strings.NewReader("{\n \"isActive\": false,\n \"isAllowedToSpend\": false,\n \"expireBalance\": true\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<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))
}HttpResponse<String> response = Unirest.patch("https://{host}/bonus/v1/accounts/{accountId}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"isActive\": false,\n \"isAllowedToSpend\": false,\n \"expireBalance\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/bonus/v1/accounts/{accountId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"isActive\": false,\n \"isAllowedToSpend\": false,\n \"expireBalance\": true\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"message": "<string>",
"details": null
}{
"name": "<string>",
"message": "<string>",
"details": null
}Update an account
Your backend calls this to activate or deactivate an account, to allow or stop spending from it, or to empty it.
Only what you send is changed: isActive and isAllowedToSpend keep their value when they are left out.
With expireBalance=true the account is emptied first: every transaction that is still waiting is cancelled,
and the bonus that is then available is taken off the account as an Expiry transaction. This cannot be undone.
Where Lobyco has set your environment to require an empty account, every update of an account that still holds
available or reserved bonus is refused with AccountBalanceMustBeZero unless expireBalance is true.
A deactivated account keeps its transactions and can be activated again. While it is inactive it accepts no new transactions.
curl --request PATCH \
--url https://{host}/bonus/v1/accounts/{accountId} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"isActive": false,
"isAllowedToSpend": false,
"expireBalance": true
}
'import requests
url = "https://{host}/bonus/v1/accounts/{accountId}"
payload = {
"isActive": False,
"isAllowedToSpend": False,
"expireBalance": True
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({isActive: false, isAllowedToSpend: false, expireBalance: true})
};
fetch('https://{host}/bonus/v1/accounts/{accountId}', 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://{host}/bonus/v1/accounts/{accountId}",
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([
'isActive' => false,
'isAllowedToSpend' => false,
'expireBalance' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://{host}/bonus/v1/accounts/{accountId}"
payload := strings.NewReader("{\n \"isActive\": false,\n \"isAllowedToSpend\": false,\n \"expireBalance\": true\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<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))
}HttpResponse<String> response = Unirest.patch("https://{host}/bonus/v1/accounts/{accountId}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"isActive\": false,\n \"isAllowedToSpend\": false,\n \"expireBalance\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/bonus/v1/accounts/{accountId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"isActive\": false,\n \"isAllowedToSpend\": false,\n \"expireBalance\": true\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"message": "<string>",
"details": null
}{
"name": "<string>",
"message": "<string>",
"details": null
}Authorizations
Path Parameters
Body
The changes to make. What is left out keeps its value.
The changes to make to an account.
Response
The account was updated. The response has no body.