Create a new voucher payment
curl --request POST \
--url https://staging-vouchers.ventogram.com/api/v1/vouchers \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--header 'X-Api-User: <api-key>' \
--data '
{
"email": "<string>",
"fullname": "<string>",
"amount": 123,
"rateKey": "<string>"
}
'import requests
url = "https://staging-vouchers.ventogram.com/api/v1/vouchers"
payload = {
"email": "<string>",
"fullname": "<string>",
"amount": 123,
"rateKey": "<string>"
}
headers = {
"X-Api-User": "<api-key>",
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Api-User': '<api-key>',
'X-Api-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({email: '<string>', fullname: '<string>', amount: 123, rateKey: '<string>'})
};
fetch('https://staging-vouchers.ventogram.com/api/v1/vouchers', 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://staging-vouchers.ventogram.com/api/v1/vouchers",
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([
'email' => '<string>',
'fullname' => '<string>',
'amount' => 123,
'rateKey' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>",
"X-Api-User: <api-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 := "https://staging-vouchers.ventogram.com/api/v1/vouchers"
payload := strings.NewReader("{\n \"email\": \"<string>\",\n \"fullname\": \"<string>\",\n \"amount\": 123,\n \"rateKey\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-User", "<api-key>")
req.Header.Add("X-Api-Key", "<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://staging-vouchers.ventogram.com/api/v1/vouchers")
.header("X-Api-User", "<api-key>")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"<string>\",\n \"fullname\": \"<string>\",\n \"amount\": 123,\n \"rateKey\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging-vouchers.ventogram.com/api/v1/vouchers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Api-User"] = '<api-key>'
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"<string>\",\n \"fullname\": \"<string>\",\n \"amount\": 123,\n \"rateKey\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>",
"data": {
"id": "<string>"
}
}{
"success": false,
"message": "<string>",
"errors": [
"email is required",
"Invalid or expired rateKey"
]
}Collect & Onramp
Create a new voucher payment
Creates a new voucher payment for a user
POST
/
v1
/
vouchers
Create a new voucher payment
curl --request POST \
--url https://staging-vouchers.ventogram.com/api/v1/vouchers \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--header 'X-Api-User: <api-key>' \
--data '
{
"email": "<string>",
"fullname": "<string>",
"amount": 123,
"rateKey": "<string>"
}
'import requests
url = "https://staging-vouchers.ventogram.com/api/v1/vouchers"
payload = {
"email": "<string>",
"fullname": "<string>",
"amount": 123,
"rateKey": "<string>"
}
headers = {
"X-Api-User": "<api-key>",
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Api-User': '<api-key>',
'X-Api-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({email: '<string>', fullname: '<string>', amount: 123, rateKey: '<string>'})
};
fetch('https://staging-vouchers.ventogram.com/api/v1/vouchers', 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://staging-vouchers.ventogram.com/api/v1/vouchers",
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([
'email' => '<string>',
'fullname' => '<string>',
'amount' => 123,
'rateKey' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>",
"X-Api-User: <api-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 := "https://staging-vouchers.ventogram.com/api/v1/vouchers"
payload := strings.NewReader("{\n \"email\": \"<string>\",\n \"fullname\": \"<string>\",\n \"amount\": 123,\n \"rateKey\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-User", "<api-key>")
req.Header.Add("X-Api-Key", "<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://staging-vouchers.ventogram.com/api/v1/vouchers")
.header("X-Api-User", "<api-key>")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"<string>\",\n \"fullname\": \"<string>\",\n \"amount\": 123,\n \"rateKey\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://staging-vouchers.ventogram.com/api/v1/vouchers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Api-User"] = '<api-key>'
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"<string>\",\n \"fullname\": \"<string>\",\n \"amount\": 123,\n \"rateKey\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>",
"data": {
"id": "<string>"
}
}{
"success": false,
"message": "<string>",
"errors": [
"email is required",
"Invalid or expired rateKey"
]
}Body
application/json
User email
Fullname of the user creating voucher
Required voucher amount
Required voucher currency
Available options:
NGN, GHS This is a Ventogram-signed rate key. If provided when a voucher is created, the conversion will use the rate signed with this key if it is valid at the time of redeeming a voucher. Conversion will use the current rate if key has expired.
Was this page helpful?
⌘I