curl --request PATCH \
--url https://{host}/bonus/v1/transactions/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"metadata": {
"storeId": "475",
"receiptId": "475-0002-000381",
"memberId": "12396909"
}
}
'import requests
url = "https://{host}/bonus/v1/transactions/{id}"
payload = { "metadata": {
"storeId": "475",
"receiptId": "475-0002-000381",
"memberId": "12396909"
} }
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({metadata: {storeId: '475', receiptId: '475-0002-000381', memberId: '12396909'}})
};
fetch('https://{host}/bonus/v1/transactions/{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://{host}/bonus/v1/transactions/{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([
'metadata' => [
'storeId' => '475',
'receiptId' => '475-0002-000381',
'memberId' => '12396909'
]
]),
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/transactions/{id}"
payload := strings.NewReader("{\n \"metadata\": {\n \"storeId\": \"475\",\n \"receiptId\": \"475-0002-000381\",\n \"memberId\": \"12396909\"\n }\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/transactions/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {\n \"storeId\": \"475\",\n \"receiptId\": \"475-0002-000381\",\n \"memberId\": \"12396909\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/bonus/v1/transactions/{id}")
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 \"metadata\": {\n \"storeId\": \"475\",\n \"receiptId\": \"475-0002-000381\",\n \"memberId\": \"12396909\"\n }\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"message": "<string>",
"details": null
}{
"name": "<string>",
"message": "<string>",
"details": null
}Update a transaction's metadata
Your backend calls this to change the key-value pairs kept with a transaction, for example to add a receiptId
that was not known when the transaction was created. Nothing else about a transaction can be changed.
The metadata you send replaces everything that was stored, so a key you leave out is removed. To keep the
existing pairs, read them with GET /v1/transactions/{id}, change what you need and send them all back.
Statements show the new values.
Lobyco keeps pairs of its own there: memberId on a transaction that was created through a customer, and
conversionRate on a payment. Send them back unchanged. Without conversionRate a payment’s amount on
statements is no longer multiplied by its rate.
curl --request PATCH \
--url https://{host}/bonus/v1/transactions/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"metadata": {
"storeId": "475",
"receiptId": "475-0002-000381",
"memberId": "12396909"
}
}
'import requests
url = "https://{host}/bonus/v1/transactions/{id}"
payload = { "metadata": {
"storeId": "475",
"receiptId": "475-0002-000381",
"memberId": "12396909"
} }
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({metadata: {storeId: '475', receiptId: '475-0002-000381', memberId: '12396909'}})
};
fetch('https://{host}/bonus/v1/transactions/{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://{host}/bonus/v1/transactions/{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([
'metadata' => [
'storeId' => '475',
'receiptId' => '475-0002-000381',
'memberId' => '12396909'
]
]),
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/transactions/{id}"
payload := strings.NewReader("{\n \"metadata\": {\n \"storeId\": \"475\",\n \"receiptId\": \"475-0002-000381\",\n \"memberId\": \"12396909\"\n }\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/transactions/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {\n \"storeId\": \"475\",\n \"receiptId\": \"475-0002-000381\",\n \"memberId\": \"12396909\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/bonus/v1/transactions/{id}")
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 \"metadata\": {\n \"storeId\": \"475\",\n \"receiptId\": \"475-0002-000381\",\n \"memberId\": \"12396909\"\n }\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"message": "<string>",
"details": null
}{
"name": "<string>",
"message": "<string>",
"details": null
}Authorizations
Body
The metadata that replaces the stored one.
Response
The metadata was replaced. The response has no body.