Seamless Payment Integration
for Modern Business

Reliable, secure, and developer-friendly payment solutions. Integrate PrimeStack Pay today and start accepting payments in minutes.

Get Started View Docs
🔒

Secure Transactions

Enterprise-grade security with advanced encryption and fraud detection to keep your data safe.

Instant Settlement

Experience real-time payment processing and settlements. No more waiting for your funds.

🛠️

Developer First

Clean SDKs, comprehensive documentation, and a robust API designed for developers.

Integration Guide

Connect your application with PrimeStack Pay Middleware using our secure API. Follow the guide below to authenticate and process transactions.

1. Authentication

All requests must be authenticated using a custom HMAC-SHA256 signature.

Required Headers

Header Description
Content-Type application/json
X-App-ID Your unique App Identifier (e.g., WEB_PORTAL)
X-Timestamp Current Unix timestamp (integer) to prevent replay attacks.
X-Signature Base64 encoded HMAC-SHA256 signature.

2. Generating Signature

The signature is calculated as: Base64( HMAC_SHA256( SignString, Secret ) )

Where SignString = RawJsonBody + Timestamp

PHP Example

$secret    = 'Your_Shared_Hmac_Secret';
$timestamp = time();
$payload   = json_encode(['amount' => 1000, 'msisdn' => '255...']);

// 1. Concatenate Payload and Timestamp
$stringToSign = $payload . $timestamp;

// 2. Compute HMAC-SHA256 and Encode to Base64
$signature = base64_encode(hash_hmac('sha256', $stringToSign, $secret, true));

// 3. Send Request with Headers
// X-Signature: $signature
// X-Timestamp: $timestamp

3. API Endpoints

Transaction Endpoint

URL: /api/v1/transact | Method: POST

{
    "action": "collection",
    "amount": 1000,
    "msisdn": "255700000000",
    "reference": "UNIQUE_ORDER_ID",
    "currency": "TZS",
    "callback_url": "https://your-client-app.com/payment-callback"
}

4. IP Whitelisting

For security, you must whitelist your server's IP in the middleware configuration.