Skip to main content
← Back to Blog
guidepaystackbilling

How to Implement Usage-Based Billing on Top of Paystack

The Monigo Team ·

Most Nigerian SaaS products start with a flat monthly fee. It’s simple to implement and easy to explain. But as you grow, flat-rate pricing starts costing you money — heavy users get a bargain while light users churn because they feel they’re not getting value.

Usage-based billing fixes this. Here’s how to implement it using Monigo alongside your existing Paystack integration.

The architecture

Your API  →  Monigo (ingest usage events)
                  ↓
             Calculate bill
                  ↓
          Paystack (charge customer)

Your product keeps using Paystack for payments. Monigo adds the metering and billing calculation layer on top.

Step 1: Connect Paystack

In the Monigo dashboard, go to Settings → Payment Processors and add your Paystack secret key. Monigo will validate the connection and create a test/live toggle you can control per API key.

Step 2: Create a pricing plan

Define what you’re charging for. In Monigo, a Plan maps metrics to prices:

{
  "name": "API Pro",
  "prices": [
    {
      "metric": "api_calls",
      "model": "graduated",
      "tiers": [
        { "up_to": 10000, "unit_amount": 0 },
        { "up_to": 100000, "unit_amount": 0.50 },
        { "up_to": null, "unit_amount": 0.30 }
      ]
    }
  ]
}

This gives customers 10,000 free API calls, then ₦0.50 per call up to 100k, then ₦0.30 beyond that.

Step 3: Ingest usage events

Every time your customer makes an API call, send a metering event to Monigo:

curl -X POST https://api.monigo.co/v1/events 
  -H "Authorization: Bearer mk_live_..." 
  -H "Content-Type: application/json" 
  -d '{
    "customer_id": "cus_abc123",
    "event_name": "api_calls",
    "quantity": 1,
    "idempotency_key": "req_xyz789"
  }'

The idempotency_key is critical — it means you can safely retry failed requests without double-counting.

Step 4: Let Monigo handle billing

At the end of each billing period, Monigo:

  1. Sums all metered usage for each customer
  2. Applies your pricing tiers
  3. Generates an invoice
  4. Triggers a charge via Paystack

You get a webhook when each invoice is paid or fails.

Testing before going live

Switch your Monigo API key to test mode and use your Paystack test keys. You can send test events, preview invoices, and trigger test charges without touching production.

# Test mode key
Authorization: Bearer mk_test_...

What’s next

Once metering is working, you can layer in:

  • Hard caps — pause service when a customer hits a limit
  • Alerts — notify customers when they’re at 80% of their quota
  • Overages — let customers exceed their plan and bill the difference automatically

All of this is configurable in the Monigo dashboard without code changes.


Questions? Check the documentation or reach out to our team.

Stop building billing. Start shipping features.

Most platforms spend weeks building billing logic that should take hours. Monigo gives you that time back — and keeps giving it back every billing cycle.