Make your first API request
Connect your server to Strongmb and understand the response before making a purchase.
- Get your key
Create an account and open Developers.
- Send a request
Start with an authenticated account request.
- Build your flow
Choose a service and follow its purchase guide.
Step 1: Create your Strongmb account
Start by creating an account. Use contact details you can access, complete the signup prompts, then sign in to your dashboard. Already have an account? Continue to step 2.
The video loads when you press play. Watch on YouTube
Step 2: Get your API key
Open the Developer section of your dashboard and copy the key for your chosen environment. Keep sandbox and production configuration separate. Set the key in your backend environment before running the examples below.
export STRONGMB_API_KEY="YOUR_API_KEY"
Step 3: Send your first request
curl --request GET \ --url "https://api.strongmb.ng/v1/user" \ --header "Authorization: Bearer $STRONGMB_API_KEY" \ --header "Accept: application/json"
// Server-side Node.js 22+; never expose your key in a browser.
async function main() {
const response = await fetch("https://api.strongmb.ng/v1/user", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.STRONGMB_API_KEY}`,
Accept: "application/json"
},
signal: AbortSignal.timeout(30000)
});
const result = await response.json();
console.log(response.status, result);
// For purchases, inspect data.status before showing a receipt.
}
main().catch(console.error);
<?php
// Requires the PHP cURL extension.
$client = curl_init('https://api.strongmb.ng/v1/user');
curl_setopt_array($client, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('STRONGMB_API_KEY'),
'Accept: application/json',
],
]);
$raw = curl_exec($client);
if ($raw === false) {
throw new RuntimeException(curl_error($client));
}
$status = curl_getinfo($client, CURLINFO_HTTP_CODE);
curl_close($client);
$result = json_decode($raw, true, 512, JSON_THROW_ON_ERROR);
print_r(['http_status' => $status, 'response' => $result]);
// For purchases, inspect data.status before showing a receipt.
require 'net/http'
require 'json'
uri = URI('https://api.strongmb.ng/v1/user')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == 'https'
http.open_timeout = 10
http.read_timeout = 30
request = Net::HTTP::Get.new(uri)
request['Authorization'] = 'Bearer ' + ENV.fetch('STRONGMB_API_KEY')
request['Accept'] = 'application/json'
begin
response = http.request(request)
result = JSON.parse(response.body)
puts({ http_status: response.code, response: result }.to_json)
rescue StandardError => error
warn error.message
end
# Reconcile an uncertain purchase before retrying.
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError, URLError
headers = {
"Authorization": "Bearer " + os.environ["STRONGMB_API_KEY"],
"Accept": "application/json",
}
body = None
request = Request(
"https://api.strongmb.ng/v1/user",
data=body, headers=headers, method="GET"
)
try:
with urlopen(request, timeout=30) as response:
result = json.load(response)
print(response.status, result)
except HTTPError as error:
print(error.code, error.read().decode("utf-8"))
except URLError as error:
print("Network error:", error.reason)
# Reconcile an uncertain purchase before retrying.
| Part | What it does |
|---|---|
/v1/user
|
Identifies the authenticated account endpoint. |
Authorization: Bearer
|
Supplies the secret key. Include a space before the key. |
Accept: application/json
|
Requests a JSON response. |
Step 4: Understand the response
Inspect status, message, data and metadata. Save the
trace ID when diagnosing a failure. An authenticated account request does not guarantee a later purchase will
succeed.
Step 5: Build your first purchase flow
Fetch products first. Do not assume example product codes or prices are currently available. Confirm the recipient and price before purchasing.
Step 6: Test before going live
Test invalid inputs, insufficient funds, pending results and timeouts. Save the reference before submitting a purchase and retain the trace ID from each response. Show a completed receipt only when the transaction is successful.
Once the complete flow works, review the production checklist before serving customers.
Test your integration Use the sandbox test values and examples.
Questions? Let’s work through them.
Having an issue or need help with your integration? Join the Strongmb Slack community to ask questions and get assistance from our team and other developers.
Keep API keys and customer details private when sharing examples.
Experiencing a service issue? Check Strongmb’s service status for incident updates.
Did this page help you?
Up to 100 characters. Please leave out personal details, account information and API keys.