Skip to main content
Version: v2

Getting Started

This guide walks you through accepting your first payment with NabooPay.

Prerequisites

  • A NabooPay account (sign up here)
  • Your API key from the dashboard

Step 1: Test Your API Key

Verify your setup by fetching your account balance:

curl https://api.naboopay.com/api/v2/accounts \
-H "Authorization: Bearer YOUR_API_KEY"

You should see your account details:

{
"accounts": [
{
"id": "acc_123",
"balance": 50000,
"type": "current"
}
]
}

Step 2: Create a Transaction

Create a payment request for your customer:

curl -X POST https://api.naboopay.com/api/v2/transactions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"method_of_payment": ["wave", "orange_money"],
"products": [
{
"name": "Premium Plan",
"category": "subscription",
"price": 10000,
"quantity": 1,
"description": "Monthly subscription"
}
],
"success_url": "https://yoursite.com/payment/success",
"error_url": "https://yoursite.com/payment/failed"
}'

Response:

{
"order_id": "txn_abc123",
"checkout_url": "https://checkout.naboopay.com/txn_abc123",
"status": "pending",
"amount": 10000
}

Step 3: Redirect to Checkout

Send your customer to the checkout_url. They'll see a payment page with the methods you specified (Wave, Orange Money, etc.).

// Example: Redirect in JavaScript
window.location.href = response.checkout_url;

Step 4: Handle the Result

After payment, the customer returns to your success_url or error_url.

On success_url, verify the payment status:

curl https://api.naboopay.com/api/v2/transactions/txn_abc123 \
-H "Authorization: Bearer YOUR_API_KEY"

Check the status field:

StatusMeaning
pendingWaiting for payment
paidPayment successful
paid_and_blockedPaid but held in escrow
cancelledTransaction cancelled
refundedPayment refunded

Complete Integration Example

Here's a full example in different languages:

JavaScript (Node.js)

const NABOOPAY_API_KEY = process.env.NABOOPAY_API_KEY;
const BASE_URL = 'https://api.naboopay.com/api/v2';

// Create a payment
async function createPayment(amount, productName) {
const response = await fetch(`${BASE_URL}/transactions`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${NABOOPAY_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
method_of_payment: ['wave', 'orange_money', 'bank'],
products: [{
name: productName,
category: 'general',
price: amount,
quantity: 1
}],
success_url: 'https://yoursite.com/success',
error_url: 'https://yoursite.com/error'
})
});

return response.json();
}

// Check payment status
async function getPaymentStatus(orderId) {
const response = await fetch(`${BASE_URL}/transactions/${orderId}`, {
headers: {
'Authorization': `Bearer ${NABOOPAY_API_KEY}`
}
});

return response.json();
}

// Usage
const payment = await createPayment(5000, 'Product Name');
console.log('Redirect customer to:', payment.checkout_url);

Python

import requests
import os

NABOOPAY_API_KEY = os.environ['NABOOPAY_API_KEY']
BASE_URL = 'https://api.naboopay.com/api/v2'

headers = {
'Authorization': f'Bearer {NABOOPAY_API_KEY}',
'Content-Type': 'application/json'
}

# Create a payment
def create_payment(amount, product_name):
response = requests.post(
f'{BASE_URL}/transactions',
headers=headers,
json={
'method_of_payment': ['wave', 'orange_money'],
'products': [{
'name': product_name,
'category': 'general',
'price': amount,
'quantity': 1
}],
'success_url': 'https://yoursite.com/success',
'error_url': 'https://yoursite.com/error'
}
)
return response.json()

# Check payment status
def get_payment_status(order_id):
response = requests.get(
f'{BASE_URL}/transactions/{order_id}',
headers=headers
)
return response.json()

# Usage
payment = create_payment(5000, 'Product Name')
print(f"Redirect customer to: {payment['checkout_url']}")

PHP

<?php
$apiKey = getenv('NABOOPAY_API_KEY');
$baseUrl = 'https://api.naboopay.com/api/v2';

function createPayment($amount, $productName) {
global $apiKey, $baseUrl;

$ch = curl_init("$baseUrl/transactions");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer $apiKey",
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'method_of_payment' => ['wave', 'orange_money'],
'products' => [[
'name' => $productName,
'category' => 'general',
'price' => $amount,
'quantity' => 1
]],
'success_url' => 'https://yoursite.com/success',
'error_url' => 'https://yoursite.com/error'
]));

$response = curl_exec($ch);
curl_close($ch);

return json_decode($response, true);
}

// Usage
$payment = createPayment(5000, 'Product Name');
header("Location: " . $payment['checkout_url']);
?>

Next Steps