Buy airtime
curl --request POST \
--url https://api.rexmfbank.com/baas/api/v1/services/bills-payment/airtime \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"phone": "08012345678",
"amount": 1000,
"network": "mtn",
"customer_reference": "customer-123"
}
'import requests
url = "https://api.rexmfbank.com/baas/api/v1/services/bills-payment/airtime"
payload = {
"phone": "08012345678",
"amount": 1000,
"network": "mtn",
"customer_reference": "customer-123"
}
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({
phone: '08012345678',
amount: 1000,
network: 'mtn',
customer_reference: 'customer-123'
})
};
fetch('https://api.rexmfbank.com/baas/api/v1/services/bills-payment/airtime', 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.rexmfbank.com/baas/api/v1/services/bills-payment/airtime",
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([
'phone' => '08012345678',
'amount' => 1000,
'network' => 'mtn',
'customer_reference' => 'customer-123'
]),
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 := "https://api.rexmfbank.com/baas/api/v1/services/bills-payment/airtime"
payload := strings.NewReader("{\n \"phone\": \"08012345678\",\n \"amount\": 1000,\n \"network\": \"mtn\",\n \"customer_reference\": \"customer-123\"\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("https://api.rexmfbank.com/baas/api/v1/services/bills-payment/airtime")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"08012345678\",\n \"amount\": 1000,\n \"network\": \"mtn\",\n \"customer_reference\": \"customer-123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.rexmfbank.com/baas/api/v1/services/bills-payment/airtime")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone\": \"08012345678\",\n \"amount\": 1000,\n \"network\": \"mtn\",\n \"customer_reference\": \"customer-123\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Airtime purchased successfully.",
"data": {
"id": "101",
"company_id": "28",
"master_savings_id": "55",
"bill_type": "airtime",
"direction": "debit",
"amount": "1000.00",
"fee_amount": "0.00",
"balance_after": "49000.00",
"reference": "PROVIDER-REFERENCE",
"status": "successful",
"narration": "BaaS bills-payment: airtime for 08012345678 (MTN)",
"savings_transaction_id": "9001",
"meta": {}
}
}Bills Payment
Buy airtime
Debits the partner Master account and buys airtime for an end
customer. Requires an Idempotency-Key header and a Bills Payment
subscription.
POST
/
services
/
bills-payment
/
airtime
Buy airtime
curl --request POST \
--url https://api.rexmfbank.com/baas/api/v1/services/bills-payment/airtime \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"phone": "08012345678",
"amount": 1000,
"network": "mtn",
"customer_reference": "customer-123"
}
'import requests
url = "https://api.rexmfbank.com/baas/api/v1/services/bills-payment/airtime"
payload = {
"phone": "08012345678",
"amount": 1000,
"network": "mtn",
"customer_reference": "customer-123"
}
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({
phone: '08012345678',
amount: 1000,
network: 'mtn',
customer_reference: 'customer-123'
})
};
fetch('https://api.rexmfbank.com/baas/api/v1/services/bills-payment/airtime', 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.rexmfbank.com/baas/api/v1/services/bills-payment/airtime",
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([
'phone' => '08012345678',
'amount' => 1000,
'network' => 'mtn',
'customer_reference' => 'customer-123'
]),
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 := "https://api.rexmfbank.com/baas/api/v1/services/bills-payment/airtime"
payload := strings.NewReader("{\n \"phone\": \"08012345678\",\n \"amount\": 1000,\n \"network\": \"mtn\",\n \"customer_reference\": \"customer-123\"\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("https://api.rexmfbank.com/baas/api/v1/services/bills-payment/airtime")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"08012345678\",\n \"amount\": 1000,\n \"network\": \"mtn\",\n \"customer_reference\": \"customer-123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.rexmfbank.com/baas/api/v1/services/bills-payment/airtime")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone\": \"08012345678\",\n \"amount\": 1000,\n \"network\": \"mtn\",\n \"customer_reference\": \"customer-123\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Airtime purchased successfully.",
"data": {
"id": "101",
"company_id": "28",
"master_savings_id": "55",
"bill_type": "airtime",
"direction": "debit",
"amount": "1000.00",
"fee_amount": "0.00",
"balance_after": "49000.00",
"reference": "PROVIDER-REFERENCE",
"status": "successful",
"narration": "BaaS bills-payment: airtime for 08012345678 (MTN)",
"savings_transaction_id": "9001",
"meta": {}
}
}Authorizations
See Authentication for the full explanation of session tokens vs. API keys and when each is used.
Headers
Required on purchase endpoints. Use a new key for each intended
purchase, and reuse that same key when retrying the same request
after a timeout. A completed key replays the original response. The
same key with a different body is rejected. Keys expire after 24
hours. A missing key returns 400 with no error_code.
Maximum string length:
255Body
application/json
Response
Purchased