curl --request POST \
--url http://localhost:3000/v1/wristbands/{code}/topups \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'idempotency-key: <idempotency-key>' \
--data '
{
"amount": 50000,
"bonus_amount": 50000,
"bonus_rule": "<string>",
"granted_at": "2023-11-07T05:31:56Z"
}
'import requests
url = "http://localhost:3000/v1/wristbands/{code}/topups"
payload = {
"amount": 50000,
"bonus_amount": 50000,
"bonus_rule": "<string>",
"granted_at": "2023-11-07T05:31:56Z"
}
headers = {
"idempotency-key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'idempotency-key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: 50000,
bonus_amount: 50000,
bonus_rule: '<string>',
granted_at: '2023-11-07T05:31:56Z'
})
};
fetch('http://localhost:3000/v1/wristbands/{code}/topups', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/v1/wristbands/{code}/topups",
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([
'amount' => 50000,
'bonus_amount' => 50000,
'bonus_rule' => '<string>',
'granted_at' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"idempotency-key: <idempotency-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 := "http://localhost:3000/v1/wristbands/{code}/topups"
payload := strings.NewReader("{\n \"amount\": 50000,\n \"bonus_amount\": 50000,\n \"bonus_rule\": \"<string>\",\n \"granted_at\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("idempotency-key", "<idempotency-key>")
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.post("http://localhost:3000/v1/wristbands/{code}/topups")
.header("idempotency-key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 50000,\n \"bonus_amount\": 50000,\n \"bonus_rule\": \"<string>\",\n \"granted_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/v1/wristbands/{code}/topups")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["idempotency-key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 50000,\n \"bonus_amount\": 50000,\n \"bonus_rule\": \"<string>\",\n \"granted_at\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"object": "topup_result",
"id": "<string>",
"amount": 123,
"previous_balance": 123,
"new_balance": 123,
"bonus_amount": 123,
"bonus_id": "<string>",
"previous_promo_balance": 123,
"new_promo_balance": 123,
"replayed": true
}{
"error": {
"type": "authentication_error",
"code": "ticket_not_found",
"message": "<string>",
"request_id": "req_9f2c1a4e7b304d51",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "ticket_not_found",
"message": "<string>",
"request_id": "req_9f2c1a4e7b304d51",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "ticket_not_found",
"message": "<string>",
"request_id": "req_9f2c1a4e7b304d51",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "ticket_not_found",
"message": "<string>",
"request_id": "req_9f2c1a4e7b304d51",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "ticket_not_found",
"message": "<string>",
"request_id": "req_9f2c1a4e7b304d51",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "ticket_not_found",
"message": "<string>",
"request_id": "req_9f2c1a4e7b304d51",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "ticket_not_found",
"message": "<string>",
"request_id": "req_9f2c1a4e7b304d51",
"param": "<string>"
}
}Top up a wristband's balance
Adds balance to a wristband. Meant for integrators who charge the top-up on their own platform (an online top-up app, for instance) and need to reflect it in VENTRY.
The movement is recorded with payment method online and against your API key’s virtual device. It will show up in the event’s closeout as an online top-up: you collected the money, outside the venue’s tills, and the organiser has to be able to see it to reconcile.
If you showed a bonus when charging (see GET /topup-bonuses/quote), send it in bonus_amount and bonus_rule. At most what the rule allowed at granted_at is granted, and bonus_amount in the response tells you how much was actually given. The gift goes to the gifted balance: it is spent the same way but never refunded.
Requires Idempotency-Key. Retrying with the same key does not top up again.
curl --request POST \
--url http://localhost:3000/v1/wristbands/{code}/topups \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'idempotency-key: <idempotency-key>' \
--data '
{
"amount": 50000,
"bonus_amount": 50000,
"bonus_rule": "<string>",
"granted_at": "2023-11-07T05:31:56Z"
}
'import requests
url = "http://localhost:3000/v1/wristbands/{code}/topups"
payload = {
"amount": 50000,
"bonus_amount": 50000,
"bonus_rule": "<string>",
"granted_at": "2023-11-07T05:31:56Z"
}
headers = {
"idempotency-key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'idempotency-key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: 50000,
bonus_amount: 50000,
bonus_rule: '<string>',
granted_at: '2023-11-07T05:31:56Z'
})
};
fetch('http://localhost:3000/v1/wristbands/{code}/topups', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/v1/wristbands/{code}/topups",
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([
'amount' => 50000,
'bonus_amount' => 50000,
'bonus_rule' => '<string>',
'granted_at' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"idempotency-key: <idempotency-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 := "http://localhost:3000/v1/wristbands/{code}/topups"
payload := strings.NewReader("{\n \"amount\": 50000,\n \"bonus_amount\": 50000,\n \"bonus_rule\": \"<string>\",\n \"granted_at\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("idempotency-key", "<idempotency-key>")
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.post("http://localhost:3000/v1/wristbands/{code}/topups")
.header("idempotency-key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 50000,\n \"bonus_amount\": 50000,\n \"bonus_rule\": \"<string>\",\n \"granted_at\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/v1/wristbands/{code}/topups")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["idempotency-key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 50000,\n \"bonus_amount\": 50000,\n \"bonus_rule\": \"<string>\",\n \"granted_at\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"object": "topup_result",
"id": "<string>",
"amount": 123,
"previous_balance": 123,
"new_balance": 123,
"bonus_amount": 123,
"bonus_id": "<string>",
"previous_promo_balance": 123,
"new_promo_balance": 123,
"replayed": true
}{
"error": {
"type": "authentication_error",
"code": "ticket_not_found",
"message": "<string>",
"request_id": "req_9f2c1a4e7b304d51",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "ticket_not_found",
"message": "<string>",
"request_id": "req_9f2c1a4e7b304d51",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "ticket_not_found",
"message": "<string>",
"request_id": "req_9f2c1a4e7b304d51",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "ticket_not_found",
"message": "<string>",
"request_id": "req_9f2c1a4e7b304d51",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "ticket_not_found",
"message": "<string>",
"request_id": "req_9f2c1a4e7b304d51",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "ticket_not_found",
"message": "<string>",
"request_id": "req_9f2c1a4e7b304d51",
"param": "<string>"
}
}{
"error": {
"type": "authentication_error",
"code": "ticket_not_found",
"message": "<string>",
"request_id": "req_9f2c1a4e7b304d51",
"param": "<string>"
}
}Authorizations
Body
Response
Result of the top-up.
Result of the top-up.