curl --request POST \
--url https://app.wazobiamail.com/api/v1/units/purchases \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"currency": "USD",
"packId": "pack_credits_1000",
"units": 5000,
"planId": "starter",
"billingInterval": "monthly"
}
'import requests
url = "https://app.wazobiamail.com/api/v1/units/purchases"
payload = {
"currency": "USD",
"packId": "pack_credits_1000",
"units": 5000,
"planId": "starter",
"billingInterval": "monthly"
}
headers = {
"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-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
currency: 'USD',
packId: 'pack_credits_1000',
units: 5000,
planId: 'starter',
billingInterval: 'monthly'
})
};
fetch('https://app.wazobiamail.com/api/v1/units/purchases', 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://app.wazobiamail.com/api/v1/units/purchases",
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([
'currency' => 'USD',
'packId' => 'pack_credits_1000',
'units' => 5000,
'planId' => 'starter',
'billingInterval' => 'monthly'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <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://app.wazobiamail.com/api/v1/units/purchases"
payload := strings.NewReader("{\n \"currency\": \"USD\",\n \"packId\": \"pack_credits_1000\",\n \"units\": 5000,\n \"planId\": \"starter\",\n \"billingInterval\": \"monthly\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://app.wazobiamail.com/api/v1/units/purchases")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"currency\": \"USD\",\n \"packId\": \"pack_credits_1000\",\n \"units\": 5000,\n \"planId\": \"starter\",\n \"billingInterval\": \"monthly\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.wazobiamail.com/api/v1/units/purchases")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"currency\": \"USD\",\n \"packId\": \"pack_credits_1000\",\n \"units\": 5000,\n \"planId\": \"starter\",\n \"billingInterval\": \"monthly\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Done",
"data": "<unknown>"
}Create an email credit purchase invoice
Creates an invoice for email credits and returns its id; nothing is charged until that invoice is paid. Send packId for a fixed pack, or units for a custom quantity (minimum ₦2,000 or $3). Without an active paid subscription, planId is required and the plan for the selected billing interval is added to the same invoice. Requires units:write.
curl --request POST \
--url https://app.wazobiamail.com/api/v1/units/purchases \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"currency": "USD",
"packId": "pack_credits_1000",
"units": 5000,
"planId": "starter",
"billingInterval": "monthly"
}
'import requests
url = "https://app.wazobiamail.com/api/v1/units/purchases"
payload = {
"currency": "USD",
"packId": "pack_credits_1000",
"units": 5000,
"planId": "starter",
"billingInterval": "monthly"
}
headers = {
"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-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
currency: 'USD',
packId: 'pack_credits_1000',
units: 5000,
planId: 'starter',
billingInterval: 'monthly'
})
};
fetch('https://app.wazobiamail.com/api/v1/units/purchases', 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://app.wazobiamail.com/api/v1/units/purchases",
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([
'currency' => 'USD',
'packId' => 'pack_credits_1000',
'units' => 5000,
'planId' => 'starter',
'billingInterval' => 'monthly'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <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://app.wazobiamail.com/api/v1/units/purchases"
payload := strings.NewReader("{\n \"currency\": \"USD\",\n \"packId\": \"pack_credits_1000\",\n \"units\": 5000,\n \"planId\": \"starter\",\n \"billingInterval\": \"monthly\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://app.wazobiamail.com/api/v1/units/purchases")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"currency\": \"USD\",\n \"packId\": \"pack_credits_1000\",\n \"units\": 5000,\n \"planId\": \"starter\",\n \"billingInterval\": \"monthly\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.wazobiamail.com/api/v1/units/purchases")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"currency\": \"USD\",\n \"packId\": \"pack_credits_1000\",\n \"units\": 5000,\n \"planId\": \"starter\",\n \"billingInterval\": \"monthly\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Done",
"data": "<unknown>"
}Authorizations
Dashboard API key created at https://app.wazobiamail.com/dashboard/smtp-api. Send operations also accept a narrower sending key created through POST /sending/api-keys; every other operation needs the dashboard key.
Body
Currency the invoice is raised in.
NGN, USD "USD"
A pack id from GET /units/packs. Omit when sending units.
"pack_credits_1000"
Custom credit quantity. Omit when sending packId.
5000
Plan to include when the account has no active paid subscription.
"starter"
Billing term for an included plan. The server calculates its price and renewal date.
monthly, halfYearly, yearly, 2years, 4years 