curl --request POST \
--url https://{host}/bonus/v1/members/{memberId}/payments \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"operationId": "8d2f6b1e-4c7a-4f3b-b6d9-2a5e7c9f1d34",
"amount": 25.5,
"reserveAvailable": true,
"metadata": {
"storeId": "475",
"receiptId": "475-0002-000381"
},
"accountType": "Default"
}
'import requests
url = "https://{host}/bonus/v1/members/{memberId}/payments"
payload = {
"operationId": "8d2f6b1e-4c7a-4f3b-b6d9-2a5e7c9f1d34",
"amount": 25.5,
"reserveAvailable": True,
"metadata": {
"storeId": "475",
"receiptId": "475-0002-000381"
},
"accountType": "Default"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
operationId: '8d2f6b1e-4c7a-4f3b-b6d9-2a5e7c9f1d34',
amount: 25.5,
reserveAvailable: true,
metadata: {storeId: '475', receiptId: '475-0002-000381'},
accountType: 'Default'
})
};
fetch('https://{host}/bonus/v1/members/{memberId}/payments', 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/members/{memberId}/payments",
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([
'operationId' => '8d2f6b1e-4c7a-4f3b-b6d9-2a5e7c9f1d34',
'amount' => 25.5,
'reserveAvailable' => true,
'metadata' => [
'storeId' => '475',
'receiptId' => '475-0002-000381'
],
'accountType' => 'Default'
]),
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/members/{memberId}/payments"
payload := strings.NewReader("{\n \"operationId\": \"8d2f6b1e-4c7a-4f3b-b6d9-2a5e7c9f1d34\",\n \"amount\": 25.5,\n \"reserveAvailable\": true,\n \"metadata\": {\n \"storeId\": \"475\",\n \"receiptId\": \"475-0002-000381\"\n },\n \"accountType\": \"Default\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://{host}/bonus/v1/members/{memberId}/payments")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"operationId\": \"8d2f6b1e-4c7a-4f3b-b6d9-2a5e7c9f1d34\",\n \"amount\": 25.5,\n \"reserveAvailable\": true,\n \"metadata\": {\n \"storeId\": \"475\",\n \"receiptId\": \"475-0002-000381\"\n },\n \"accountType\": \"Default\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/bonus/v1/members/{memberId}/payments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"operationId\": \"8d2f6b1e-4c7a-4f3b-b6d9-2a5e7c9f1d34\",\n \"amount\": 25.5,\n \"reserveAvailable\": true,\n \"metadata\": {\n \"storeId\": \"475\",\n \"receiptId\": \"475-0002-000381\"\n },\n \"accountType\": \"Default\"\n}"
response = http.request(request)
puts response.read_body{
"transactionId": 9154377,
"reservedAmount": 25.5,
"conversionRate": 1
}{
"name": "<string>",
"message": "<string>",
"details": null
}{
"name": "<string>",
"message": "<string>",
"details": null
}Reserve a payment for a customer
Deprecated. Use POST /v1/payments, which takes the memberId in the body and can also make the payment final
at once.
Reserves bonus on the customer’s active account for a payment. The amount leaves the available balance at once,
and the transaction waits: capture it with POST /v2/transactions/{id}/capture when the purchase is final, or
release it with POST /v2/transactions/{id}/cancel.
The account must be allowed to spend. With reserveAvailable=true a customer who has less than amount
available pays with all there is, and reservedAmount says how much that was. The call is idempotent on
operationId: the same id with another amount or reserveAvailable is refused with InconsistentRetry.
curl --request POST \
--url https://{host}/bonus/v1/members/{memberId}/payments \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"operationId": "8d2f6b1e-4c7a-4f3b-b6d9-2a5e7c9f1d34",
"amount": 25.5,
"reserveAvailable": true,
"metadata": {
"storeId": "475",
"receiptId": "475-0002-000381"
},
"accountType": "Default"
}
'import requests
url = "https://{host}/bonus/v1/members/{memberId}/payments"
payload = {
"operationId": "8d2f6b1e-4c7a-4f3b-b6d9-2a5e7c9f1d34",
"amount": 25.5,
"reserveAvailable": True,
"metadata": {
"storeId": "475",
"receiptId": "475-0002-000381"
},
"accountType": "Default"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
operationId: '8d2f6b1e-4c7a-4f3b-b6d9-2a5e7c9f1d34',
amount: 25.5,
reserveAvailable: true,
metadata: {storeId: '475', receiptId: '475-0002-000381'},
accountType: 'Default'
})
};
fetch('https://{host}/bonus/v1/members/{memberId}/payments', 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/members/{memberId}/payments",
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([
'operationId' => '8d2f6b1e-4c7a-4f3b-b6d9-2a5e7c9f1d34',
'amount' => 25.5,
'reserveAvailable' => true,
'metadata' => [
'storeId' => '475',
'receiptId' => '475-0002-000381'
],
'accountType' => 'Default'
]),
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/members/{memberId}/payments"
payload := strings.NewReader("{\n \"operationId\": \"8d2f6b1e-4c7a-4f3b-b6d9-2a5e7c9f1d34\",\n \"amount\": 25.5,\n \"reserveAvailable\": true,\n \"metadata\": {\n \"storeId\": \"475\",\n \"receiptId\": \"475-0002-000381\"\n },\n \"accountType\": \"Default\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://{host}/bonus/v1/members/{memberId}/payments")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"operationId\": \"8d2f6b1e-4c7a-4f3b-b6d9-2a5e7c9f1d34\",\n \"amount\": 25.5,\n \"reserveAvailable\": true,\n \"metadata\": {\n \"storeId\": \"475\",\n \"receiptId\": \"475-0002-000381\"\n },\n \"accountType\": \"Default\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/bonus/v1/members/{memberId}/payments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"operationId\": \"8d2f6b1e-4c7a-4f3b-b6d9-2a5e7c9f1d34\",\n \"amount\": 25.5,\n \"reserveAvailable\": true,\n \"metadata\": {\n \"storeId\": \"475\",\n \"receiptId\": \"475-0002-000381\"\n },\n \"accountType\": \"Default\"\n}"
response = http.request(request)
puts response.read_body{
"transactionId": 9154377,
"reservedAmount": 25.5,
"conversionRate": 1
}{
"name": "<string>",
"message": "<string>",
"details": null
}{
"name": "<string>",
"message": "<string>",
"details": null
}Authorizations
Path Parameters
Body
The payment to reserve.
A payment to reserve on a customer's account.
Your unique id for this operation, at most 128 characters. Send the same id only when you repeat the same request: it makes the call idempotent. One id stands for one transaction and cannot be used for another.
1 - 128"8d2f6b1e-4c7a-4f3b-b6d9-2a5e7c9f1d34"
Response
The amount is reserved, or an earlier call with the same operationId had reserved it already.
The payment that was reserved.