curl --request POST \
--url https://api.rexmfbank.com/baas/api/v1/services/bills-payment/data \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"phone": "08012345678",
"amount": 1500,
"network": "mtn",
"tariffTypeId": "MTN_DATA_2GB",
"email": "[email protected]",
"customer_reference": "customer-123"
}
'import requests
url = "https://api.rexmfbank.com/baas/api/v1/services/bills-payment/data"
payload = {
"phone": "08012345678",
"amount": 1500,
"network": "mtn",
"tariffTypeId": "MTN_DATA_2GB",
"email": "[email protected]",
"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: 1500,
network: 'mtn',
tariffTypeId: 'MTN_DATA_2GB',
email: '[email protected]',
customer_reference: 'customer-123'
})
};
fetch('https://api.rexmfbank.com/baas/api/v1/services/bills-payment/data', 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/data",
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' => 1500,
'network' => 'mtn',
'tariffTypeId' => 'MTN_DATA_2GB',
'email' => '[email protected]',
'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/data"
payload := strings.NewReader("{\n \"phone\": \"08012345678\",\n \"amount\": 1500,\n \"network\": \"mtn\",\n \"tariffTypeId\": \"MTN_DATA_2GB\",\n \"email\": \"[email protected]\",\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/data")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"08012345678\",\n \"amount\": 1500,\n \"network\": \"mtn\",\n \"tariffTypeId\": \"MTN_DATA_2GB\",\n \"email\": \"[email protected]\",\n \"customer_reference\": \"customer-123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.rexmfbank.com/baas/api/v1/services/bills-payment/data")
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\": 1500,\n \"network\": \"mtn\",\n \"tariffTypeId\": \"MTN_DATA_2GB\",\n \"email\": \"[email protected]\",\n \"customer_reference\": \"customer-123\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "<string>",
"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": "<string>",
"savings_transaction_id": "9001",
"meta": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"status": "success",
"message": "Your selected provider is temporarily unavailable. Please choose a plan from the alternative provider.",
"data": {
"failed_provider": "provider-a",
"next_provider": "provider-b",
"plans": []
}
}Buy a data plan
Debits the partner Master account and buys a data plan. amount must
match the selected plan (tariffTypeId). Requires an Idempotency-Key
header.
If the selected provider is down but an alternative is available, the
API returns HTTP 409 with status: success and a plans list —
not an error envelope. Show those plans and retry with a new
idempotency key, because the body will have changed.
curl --request POST \
--url https://api.rexmfbank.com/baas/api/v1/services/bills-payment/data \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"phone": "08012345678",
"amount": 1500,
"network": "mtn",
"tariffTypeId": "MTN_DATA_2GB",
"email": "[email protected]",
"customer_reference": "customer-123"
}
'import requests
url = "https://api.rexmfbank.com/baas/api/v1/services/bills-payment/data"
payload = {
"phone": "08012345678",
"amount": 1500,
"network": "mtn",
"tariffTypeId": "MTN_DATA_2GB",
"email": "[email protected]",
"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: 1500,
network: 'mtn',
tariffTypeId: 'MTN_DATA_2GB',
email: '[email protected]',
customer_reference: 'customer-123'
})
};
fetch('https://api.rexmfbank.com/baas/api/v1/services/bills-payment/data', 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/data",
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' => 1500,
'network' => 'mtn',
'tariffTypeId' => 'MTN_DATA_2GB',
'email' => '[email protected]',
'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/data"
payload := strings.NewReader("{\n \"phone\": \"08012345678\",\n \"amount\": 1500,\n \"network\": \"mtn\",\n \"tariffTypeId\": \"MTN_DATA_2GB\",\n \"email\": \"[email protected]\",\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/data")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"08012345678\",\n \"amount\": 1500,\n \"network\": \"mtn\",\n \"tariffTypeId\": \"MTN_DATA_2GB\",\n \"email\": \"[email protected]\",\n \"customer_reference\": \"customer-123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.rexmfbank.com/baas/api/v1/services/bills-payment/data")
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\": 1500,\n \"network\": \"mtn\",\n \"tariffTypeId\": \"MTN_DATA_2GB\",\n \"email\": \"[email protected]\",\n \"customer_reference\": \"customer-123\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "<string>",
"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": "<string>",
"savings_transaction_id": "9001",
"meta": {},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"status": "success",
"message": "Your selected provider is temporarily unavailable. Please choose a plan from the alternative provider.",
"data": {
"failed_provider": "provider-a",
"next_provider": "provider-b",
"plans": []
}
}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.
255Body
^0\d{10}$Must match the selected plan.
50 <= x <= 500000mtn, glo, airtel, or 9mobile.
15Plan identifier from Get data plans.
Force a specific provider key.
100