BLMPay API

Accept TZS payments, verify recipients, send money, and receive or withdraw USDT on TRC20. Follow the workflow below from API key to webhook reconciliation.

BASE URL

https://demopay.blmtec.co.tz/api/v1

REST

JSON API

HTTPS

Secure only

Webhooks

Real-time events

Quick Start

Use this order for a production integration. Each later section contains the full request and response fields.

1

Create an API key

Choose only the scopes your server needs and keep the secret server-side.

2

Collect TZS

Create Mobile Money, Card or Dynamic TANQR payments and store the BLMPay reference.

3

Verify and send money

Resolve the recipient name, check the fee, then send with an Idempotency-Key.

4

Use USDT when needed

Activate one permanent TRC20 wallet, receive deposits, quote withdrawals, then confirm the quote.

5

Reconcile final state

Use signed webhooks for real-time events and status endpoints as a fallback.

Authentication

Include your API key as a Bearer token on every request:

HTTP HEADER

Authorization: Bearer YOUR_SECRET_KEY

Keep your secret key safe

Never expose your secret key in frontend code or public repositories. Use it server-side only. If compromised, revoke it immediately from the dashboard.

→ Create a free account to get your API keys

Scope Permission
collection:readView collections and balance
collection:createCreate collection requests
disbursement:readView payouts and calculate payout fees
disbursement:createSend payouts
usdt:readView your USDT address and deposit/withdrawal history
usdt:createActivate your permanent USDT TRC20 wallet
usdt:withdrawQuote and confirm USDT TRC20 withdrawals

Payments

POST /api/v1/payments Create a payment request

Send a USSD push to a mobile number, generate a secure card checkout link, or create a Dynamic TANQR payment QR code.

Idempotency-Key — update your integration

Send one unique Idempotency-Key header for every new payment attempt. Reuse the same key only when retrying the exact same request. API v1 temporarily accepts older integrations without the header and returns a generated key, but integrations should be updated to send it.

  • Length: 8–30 characters.
  • Allowed: letters, numbers, dot, underscore, colon and hyphen.
  • Same key + same request returns the existing payment.
  • Do not reuse one key for a different payment request.

Required Request Headers

Authorization: Bearer YOUR_SECRET_KEY
Content-Type: application/json
Idempotency-Key: order-ORD-001-attempt-1

cURL — Mobile Money

curl -X POST https://demopay.blmtec.co.tz/api/v1/payments \
  -H "Authorization: Bearer YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-ORD-001-attempt-1" \
  -d '{
    "payment_type": "mobile",
    "details": {"amount": 5000, "currency": "TZS"},
    "phone_number": "255712345678",
    "customer": {
      "firstname": "Juma",
      "lastname": "Mwangi",
      "email": "juma@example.com"
    },
    "webhook_url": "https://yoursite.com/webhooks",
    "metadata": {"order_id": "ORD-001"}
  }'

Mobile Money Example

{
    "payment_type": "mobile",
    "details": {
        "amount": 5000,
        "currency": "TZS"
    },
    "phone_number": "255712345678",
    "customer": {
        "firstname": "Juma",
        "lastname": "Mwangi",
        "email": "juma@example.com"
    },
    "webhook_url": "https:\/\/yoursite.com\/webhooks",
    "metadata": {
        "order_id": "ORD-001"
    }
}

Card Payment Example

{
    "payment_type": "card",
    "details": {
        "amount": 50000,
        "currency": "TZS",
        "redirect_url": "https:\/\/yoursite.com\/success",
        "cancel_url": "https:\/\/yoursite.com\/cancel"
    },
    "phone_number": "255744123456",
    "customer": {
        "firstname": "Jane",
        "lastname": "Doe",
        "email": "jane@example.com",
        "country": "TZ"
    },
    "webhook_url": "https:\/\/yoursite.com\/webhooks",
    "metadata": {
        "order_id": "ORD-002"
    }
}

Dynamic TANQR Example

{
    "payment_type": "dynamic-qr",
    "details": {
        "amount": 10000,
        "currency": "TZS"
    },
    "phone_number": "255712345678",
    "customer": {
        "firstname": "Asha",
        "lastname": "Juma",
        "email": "asha@example.com",
        "country": "TZ"
    },
    "webhook_url": "https://yoursite.com/webhooks",
    "metadata": {
        "order_id": "ORD-003"
    }
}

Dynamic TANQR response

For payment_type=dynamic-qr, BLMPay returns the QR image in payment_qr_code. Display that value directly as the image source and rely on the payment webhook or payment-status endpoint for the final result.

Field Type Required Description
payment_type string ✓ mobile, card or dynamic-qr
details.amount integer ✓ Amount in TZS (integers only)
details.currency string ✓ Must be TZS
phone_number string ✓ Customer phone in 255XXXXXXXXX format; required for mobile, card and dynamic-qr
details.redirect_url string ✓ card URL after successful card payment
details.cancel_url string ✓ card URL after cancelled card payment
details.billing_address string optional card / QR Customer billing address; BLMPay applies a compatibility default if omitted
details.billing_city string optional card / QR Customer billing city
details.billing_state string optional card / QR Customer billing state/region
details.billing_postcode string optional card / QR Customer billing postcode
customer.firstname string ✓ Customer first name
customer.lastname string ✓ Customer last name
customer.email string ✓ Customer email address
webhook_url string optional Your endpoint for payment events
metadata object optional Custom key-value pairs (must be {}, not [])

Backward compatibility in API v1

When the header is missing, BLMPay generates a temporary compatibility key and returns it in both the response body and the Idempotency-Key response header. Save that value and reuse it if you retry the request. This fallback prevents older integrations from stopping, but it is not a replacement for sending your own stable order-based key.

GET /api/v1/payments Supports ?limit=20&offset=0&status=completed
GET /api/v1/payments/{reference} Get single payment by reference e.g. BP240101ABCD1234

Invoices

POST /api/v1/invoices
{
    "customer_name": "Jane Doe",
    "customer_email": "jane@example.com",
    "customer_phone": "255787654321",
    "items": [
        {
            "name": "Web Design",
            "quantity": 1,
            "unit_price": 200000
        }
    ],
    "tax_percent": 18,
    "due_date": "2026-08-01",
    "notes": "Payment due within 30 days"
}

Disbursements (Payouts)

Send TZS to Tanzanian mobile-money wallets, bank accounts, or Selcom Pesa wallets. Mobile-money and bank fees follow your verification-based BLMPay fee profile; Selcom Pesa uses a fixed BLMPay fee. BLMPay resolves the registered account-holder name from the destination account so your application does not need to trust a manually typed name.

1

Name Lookup

Verify the destination and display the registered name.

2

Fee Quote

Show amount, BLMPay fee and total debit.

3

Send

Submit with one Idempotency-Key.

4

Track

Use payout status and signed webhooks.

Idempotency-Key is required

Use one unique key per payout. Retrying the same key and same body returns the existing payout without charging twice. Reusing the key with different data returns HTTP 409.

POST /api/v1/payouts/send Scope: disbursement:create

Mobile Money Request

{
    "amount": 5000,
    "currency": "TZS",
    "channel": "mobile",
    "recipient_phone": "255712345678",
    "network": "MPESA",
    "narration": "Supplier payment INV-001",
    "webhook_url": "https://yoursite.com/webhooks/blmpay",
    "metadata": {
        "invoice_id": "INV-001"
    }
}

Bank Request

{
    "amount": 100000,
    "currency": "TZS",
    "channel": "bank",
    "recipient_bank": "CRDB",
    "recipient_account": "0150123456789",
    "narration": "Supplier payment INV-002",
    "metadata": {
        "invoice_id": "INV-002"
    }
}

Selcom Pesa Request

{
    "amount": 50000,
    "currency": "TZS",
    "channel": "selcompesa",
    "wallet_number": "255712345678",
    "narration": "Wallet transfer",
    "metadata": {
        "customer_id": "CUS-1001"
    }
}
Field Required Description
amount ✓ Positive integer amount in TZS
channel ✓ mobile, bank or selcompesa
recipient_name optional Legacy compatibility only. Accepted but never trusted as identity; BLMPay uses the verified registered account-holder name
recipient_phone mobile Tanzanian format: 255XXXXXXXXX
network mobile Recommended for deterministic delivery: MPESA, AIRTEL_MONEY, MIXX_BY_YAS, HALOPESA, EZYPESA or TTCLPESA
wallet_number selcompesa Selcom Pesa wallet number in Tanzanian format
recipient_bank bank Bank code such as CRDB, NMB, NBC or ABSA
recipient_account bank Bank account number (6-34 digits)
narration optional Reason for payout, maximum 300 characters
webhook_url optional Must exactly match an active webhook already registered in BLMPay
metadata optional Your JSON object for reconciliation

201 Response

{
    "status": "success",
    "code": 201,
    "data": {
        "object": "payout",
        "reference": "BPW260719A1B2C3D4",
        "status": "pending",
        "source": "api",
        "amount": {
            "currency": "TZS",
            "value": 5000
        },
        "fees": {
            "currency": "TZS",
            "value": 3500
        },
        "total": {
            "currency": "TZS",
            "value": 8500
        },
        "channel": {
            "type": "mobile_money",
            "provider": "mpesa"
        },
        "recipient": {
            "name": "Juma Mwangi",
            "phone": "255712345678"
        },
        "idempotent_replay": false
    }
}
GET/api/v1/payouts/fee?amount=5000&channel=mobile
Returns your current payout fee and total before you send. channel can be mobile, bank, or selcompesa. Scope: disbursement:read.
GET/api/v1/payouts/banks
Returns the current BLMPay-supported bank names and codes for bank payouts. Scope: disbursement:read.
POST/api/v1/payouts/name-lookup

Resolves the registered recipient name before money moves. Scope: disbursement:create. Always show the returned account_name to the sender for confirmation.

{"channel":"mobile","account_number":"255712345678"}

For bank use channel=bank, account_number and bank_code. For Selcom Pesa use channel=selcompesa. Name Lookup verifies identity only; for a Mobile Money send, also submit the network on the send request so BLMPay can route delivery deterministically. Upstream routing is handled internally by BLMPay and is not part of your integration contract.

GET/api/v1/payouts/{reference}
Gets one payout. Use GET /api/v1/payouts?limit=20&offset=0&status=completed&source=api to list payouts.

Payout status

pendingAccepted and processing with the provider
completedRecipient received the funds
failedPayout failed and amount + BLMPay fee were returned once
reversedProvider reversed the payout and amount + BLMPay fee were returned once

Code samples

cURL

curl -X POST https://demopay.blmtec.co.tz/api/v1/payouts/send \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: payroll-emp-001-2026-07" \
  -d '{"amount":5000,"currency":"TZS","channel":"mobile","recipient_phone":"255712345678","network":"MPESA","narration":"Salary July","metadata":{"employee_id":"EMP-001"}}'

PHP 8+

<?php
$payload = [
    'amount' => 5000,
    'currency' => 'TZS',
    'channel' => 'mobile',
    'recipient_phone' => '255712345678',
    'network' => 'MPESA',
    'narration' => 'Salary July',
    'metadata' => ['employee_id' => 'EMP-001'],
];
$ch = curl_init('https://pay.blmtec.co.tz/api/v1/payouts/send');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('BLMPAY_API_KEY'),
        'Content-Type: application/json',
        'Idempotency-Key: payroll-emp-001-2026-07',
    ],
    CURLOPT_POSTFIELDS => json_encode($payload),
]);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

Node.js 18+

const response = await fetch('https://pay.blmtec.co.tz/api/v1/payouts/send', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.BLMPAY_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': 'payroll-emp-001-2026-07'
  },
  body: JSON.stringify({
    amount: 5000,
    currency: 'TZS',
    channel: 'mobile',
    recipient_phone: '255712345678',
    network: 'MPESA',
    narration: 'Salary July',
    metadata: { employee_id: 'EMP-001' }
  })
});
const payout = await response.json();

USDT Deposits & Withdrawals (TRC20)

BLMPay gives each merchant one permanent TRC20 address. The same BLMPay account can receive USDT deposits and send USDT withdrawals without exposing settlement-provider details to your application.

TRC20 only

Send only USDT on TRC20 to the returned address. Confirm the destination network before every withdrawal.

STEP 1

Activate

STEP 2

Get address

STEP 3

Receive / list

STEP 4

Quote withdrawal

STEP 5

Confirm

POST/api/v1/usdt/activateScope: usdt:create

Activates your permanent USDT wallet. Repeating activation returns the existing address.

curl -X POST https://demopay.blmtec.co.tz/api/v1/usdt/activate \
  -H "Authorization: Bearer YOUR_SECRET_KEY"
GET/api/v1/usdt/addressScope: usdt:read

Returns your permanent TRC20 deposit address.

{
    "status": "success",
    "code": 200,
    "data": {
        "network": "TRC20",
        "address": "TXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "status": "active"
    }
}
GET/api/v1/usdt/transfers?page=1&limit=20Scope: usdt:read

Lists both deposit and withdrawal activity. Use direction to distinguish incoming and outgoing transfers.

POST/api/v1/usdt/withdrawals/quoteScope: usdt:withdraw

Get the exact withdrawal fee before committing funds. Send a unique Idempotency-Key.

{
    "address": "TR7Nxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "amount": "50.00000000"
}

Response

{
    "status": "success",
    "code": 201,
    "data": {
        "quote_reference": "USQ-4F21B8D93A31C0AA",
        "status": "quoted",
        "address": "TR7Nxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "amount": "50.00000000",
        "fee_amount": "0.75000000",
        "total_debited": "50.75000000",
        "currency": "USDT",
        "network": "TRC20",
        "expires_at": "2026-08-10 20:15:00"
    }
}
POST/api/v1/usdt/withdrawalsScope: usdt:withdraw

Confirm a valid unexpired quote. The public API uses the BLMPay quote_reference; provider quote identifiers are never exposed.

{
    "quote_reference": "USQ-4F21B8D93A31C0AA"
}

If the upstream response is temporarily ambiguous, BLMPay keeps the same withdrawal in processing and reuses the same internal idempotency key. Do not create a second withdrawal for the same quote.

Deposit notifications

Subscribe to usdt.received for confirmed incoming deposits. For withdrawal state, use GET /api/v1/usdt/transfers for reconciliation.

Balance

GET /api/v1/balance
{
    "status": "success",
    "code": 200,
    "data": {
        "available": {
            "currency": "TZS",
            "value": 329194
        },
        "total": {
            "currency": "TZS",
            "value": 329194
        },
        "pending": {
            "currency": "TZS",
            "value": 5000
        }
    }
}

Webhook Events

We send HTTP POST requests to your webhook URL for these events. Verify the signature before processing.

Event Description
payment.completed Payment successfully received
payment.failed Payment failed or declined
payment.voided Payment voided/cancelled
payment.expired Payment link expired (4 hours)
payment.cancelled Payment cancelled by customer
payout.completed Payout sent to recipient
payout.failed Payout failed — funds returned
payout.reversed Payout reversed — funds returned
usdt.received USDT deposit received on your TRC20 address

Verify webhook signatures

Every request includes X-Webhook-Signature (HMAC-SHA256). Always verify before processing.

$sig = hash_hmac("sha256", $timestamp . "." . $rawBody, $webhookSecret);
if (!hash_equals($sig, $_SERVER["HTTP_X_WEBHOOK_SIGNATURE"])) {
    http_response_code(401); exit("Invalid signature");
}

Error Codes

HTTP Error Code Meaning
401 unauthorized Missing or invalid API key
403 insufficient_scope API key lacks required scope
400 validation_error Invalid request parameters
400 invalid_idempotency_key Idempotency-Key format is invalid
409 idempotency_conflict Idempotency key reused with different request data
404 not_found Resource not found
429 rate_limit_exceeded Too many requests (60/min)
502 payout_failed Upstream payout could not be completed; reserved funds returned
500 payment_failed Payment gateway error

SDKs & Quick Start

Get started with a simple cURL example:

CURL — Mobile Payment

curl -X POST https://demopay.blmtec.co.tz/api/v1/payments \
  -H "Authorization: Bearer YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-ORD-001-attempt-1" \
  -d '{
    "payment_type": "mobile",
    "details": {"amount": 5000, "currency": "TZS"},
    "phone_number": "255712345678",
    "customer": {"firstname": "Juma", "lastname": "Mwangi", "email": "juma@example.com"},
    "webhook_url": "https://yoursite.com/webhooks",
    "metadata": {}
  }'