API Documentation

Everything you need to integrate Payhub into your application

Getting Started

Welcome to the Payhub API documentation. This guide will help you integrate payment processing into your application.

Base URL
https://api.payhub.com/v1

Authentication

All API requests require authentication using your API key. Include your API key in the request header:

Authorization: Bearer YOUR_API_KEY
Note: You can find your API key in your merchant dashboard under Settings → API Keys.

Payment API

Initialize Payment

Create a new payment request:

POST /payments/initialize

{
  "amount": 100.00,
  "currency": "GHS",
  "customer_phone": "0241234567",
  "payment_method": "mobile_money",
  "provider": "MTN",
  "callback_url": "https://your-app.com/callback"
}
Response
{
  "status": "success",
  "reference": "PAY_abc123xyz",
  "payment_url": "https://payhub.com/pay/abc123xyz"
}

Webhooks

Payhub sends webhook notifications to keep you informed about payment status changes.

Webhook Payload
{
  "event": "payment.success",
  "reference": "PAY_abc123xyz",
  "amount": 100.00,
  "status": "success",
  "timestamp": "2025-01-15T10:30:00Z"
}

Testing

Use these test credentials to test your integration:

Provider Test Phone Number Expected Result
MTN 0241234567 Success
Telecel 0201234567 Success
AirtelTigo 0271234567 Success