Redeem a voucher (full or partial)
curl --request POST \
--url https://api.nxos.io/v1/service/voucher/{voucherId}/redeem \
--header 'Content-Type: application/json' \
--data '
{
"target_account_id": "<string>",
"metadata": {}
}
'import requests
url = "https://api.nxos.io/v1/service/voucher/{voucherId}/redeem"
payload = {
"target_account_id": "<string>",
"metadata": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({target_account_id: '<string>', metadata: {}})
};
fetch('https://api.nxos.io/v1/service/voucher/{voucherId}/redeem', 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.nxos.io/v1/service/voucher/{voucherId}/redeem",
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([
'target_account_id' => '<string>',
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"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.nxos.io/v1/service/voucher/{voucherId}/redeem"
payload := strings.NewReader("{\n \"target_account_id\": \"<string>\",\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.nxos.io/v1/service/voucher/{voucherId}/redeem")
.header("Content-Type", "application/json")
.body("{\n \"target_account_id\": \"<string>\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nxos.io/v1/service/voucher/{voucherId}/redeem")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"target_account_id\": \"<string>\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"voucher_id": "<string>",
"value": {
"amount": "<string>",
"asset_code": "<string>"
},
"expires_at": "<string>",
"provider_name": "<string>",
"funding_source_account": "<string>",
"status": "ACTIVE",
"redeemed_at": "<string>",
"redeemed_to_account_id": "<string>",
"redemption_transaction_id": "<string>",
"redeemed_value": {
"amount": "<string>",
"asset_code": "<string>"
},
"remaining_value": {
"amount": "<string>",
"asset_code": "<string>"
}
}Wallets and Vouchers
Redeem Voucher
Redeems a voucher, transferring all or part of its value to a specified target account.
This operation allows for full or partial redemption of a voucher. If the redeemed value is less than the total voucher value, the voucher remains active with the remaining balance. Once fully redeemed, a voucher cannot be used again.
POST
/
v1
/
service
/
voucher
/
{voucherId}
/
redeem
Redeem a voucher (full or partial)
curl --request POST \
--url https://api.nxos.io/v1/service/voucher/{voucherId}/redeem \
--header 'Content-Type: application/json' \
--data '
{
"target_account_id": "<string>",
"metadata": {}
}
'import requests
url = "https://api.nxos.io/v1/service/voucher/{voucherId}/redeem"
payload = {
"target_account_id": "<string>",
"metadata": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({target_account_id: '<string>', metadata: {}})
};
fetch('https://api.nxos.io/v1/service/voucher/{voucherId}/redeem', 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.nxos.io/v1/service/voucher/{voucherId}/redeem",
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([
'target_account_id' => '<string>',
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"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.nxos.io/v1/service/voucher/{voucherId}/redeem"
payload := strings.NewReader("{\n \"target_account_id\": \"<string>\",\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
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://api.nxos.io/v1/service/voucher/{voucherId}/redeem")
.header("Content-Type", "application/json")
.body("{\n \"target_account_id\": \"<string>\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nxos.io/v1/service/voucher/{voucherId}/redeem")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"target_account_id\": \"<string>\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"voucher_id": "<string>",
"value": {
"amount": "<string>",
"asset_code": "<string>"
},
"expires_at": "<string>",
"provider_name": "<string>",
"funding_source_account": "<string>",
"status": "ACTIVE",
"redeemed_at": "<string>",
"redeemed_to_account_id": "<string>",
"redemption_transaction_id": "<string>",
"redeemed_value": {
"amount": "<string>",
"asset_code": "<string>"
},
"remaining_value": {
"amount": "<string>",
"asset_code": "<string>"
}
}Body
application/json
The details required for redeeming the voucher, including the target account and redemption value.
Response
200 - application/json
The updated Voucher object after redemption, including the new status and redemption details.