Prerequisites
- A Monigo account — sign up free
- Your test API key from Dashboard → API Keys
mk_test_... key throughout this guide. Test mode events and invoices are fully isolated — no real charges are triggered.
Step 1 — Create a customer
A customer represents one of your end-users or accounts. Every event, subscription, and invoice is attached to a customer.id from the response — you’ll need it in later steps.
Step 2 — Define a metric
A metric tells Monigo what to count and how to count it. It maps anevent_name to an aggregation function.
count, sum, max, minimum, average, unique. For sum, max, minimum, and average, also set aggregation_property to the event property that holds the numeric value.
Step 3 — Create a pricing plan
A plan defines how your metric maps to a price. Attach one or more prices when creating the plan. This example uses flat-rate pricing — ₦2 per API call, billed monthly.Step 4 — Subscribe the customer
Linking a customer to a plan starts their billing relationship. The subscription tracks the current period start and end dates.Step 5 — Ingest usage events
Send an event every time your customer uses a billable feature. Events are aggregated into usage rollups that drive the invoice calculation.idempotency_key ensures each event is counted exactly once even if the request is retried. You can send up to 1 000 events per batch call.
Step 6 — Generate an invoice
Invoices are generated automatically at the end of each billing period, but you can also generate a draft manually at any time to preview the charge.status: "draft". You can inspect the line items, finalize it to lock the amounts, and void it if needed.
What happens next
You now have the complete billing loop running in test mode:- Pricing Models — all six models with full code examples
- Subscription Lifecycle — pausing, canceling, reactivating
- Invoice Lifecycle — draft → finalized → paid → void
- Connect a payment processor — go live with real charges
- Idempotency & Replayability — correct mistakes without data loss

