If you have ever tried to build billing from scratch, you know the surface area is deceptively large. Invoices, proration, retries, dunning, reconciliation, and webhooks all interact, and each edge case spawns three more. An API-first billing platform lets you treat all of that as a service you call rather than a system you maintain. This primer shows how the pieces fit together.
One REST API, one mental model
The cleanest billing integrations share a trait: a single, consistent REST API. You create resources, you read them back, and you subscribe to events. Just Efficient Billing exposes invoicing, retries, dunning, and reconciliation through one API, so you do not stitch together half a dozen services. The full reference lives in the documentation.
Creating an invoice
Most workflows begin by creating a customer and then issuing an invoice against them. A request looks like the snippet below. Note the idempotency key, which lets you safely retry the call without double-charging.
POST /v1/invoices
Content-Type: application/json
Idempotency-Key: inv-9f2a-001
{
"customer": "cus_8472",
"currency": "usd",
"lines": [
{ "description": "Pro plan, June", "amount": 4900 }
],
"due_in_days": 14
}
The response returns an invoice object with a status and an id you store on your side. From there, you rarely poll. Instead, you let webhooks tell you what changed.
Listen for webhooks instead of polling
Polling for payment status wastes requests and adds latency. A webhook-driven design is both simpler and more reliable. Subscribe to the events you care about and react when they fire.
invoice.paidwhen a payment settles, so you can provision access.invoice.payment_failedso you can flag the account.invoice.retry_scheduledso you know recovery is in flight.
Always verify the webhook signature and respond quickly with a 200, then do heavier work asynchronously. Treat every webhook as potentially duplicated and make your handlers idempotent.
Let the platform own retries and dunning
The reason teams adopt an API-first billing platform is to stop building the hard parts themselves. Failed payments should be retried on a smart schedule, and customers should receive dunning emails automatically, ideally from your own domain through white-label delivery. You write zero cron jobs for this; you simply listen for the resulting events. Small teams especially benefit, which is why a focused billing API for small business can replace a surprising amount of homegrown code.
Design tip: keep your application stateless about money. Let the billing API be the source of truth and mirror only what you need locally.
Reconciliation without spreadsheets
Reconciliation is where do-it-yourself billing usually collapses. When payments settle, they need to be matched back to the invoices that generated them, including partial payments and refunds. With an API-first platform, reconciliation runs server-side and is exposed as data you can query, so finance gets clean numbers and engineering gets its weekends back.
Choosing how money moves
You can keep your own payment processor and let the API orchestrate around it, or let the platform collect and pay you out, typically within 48 hours. Both flow through the same endpoints, so the integration code barely changes if you switch models later.
A minimal integration path
- Create a customer, then create an invoice with an idempotency key.
- Subscribe to
invoice.paidandinvoice.payment_failedwebhooks. - Provision or restrict access based on those events.
- Read reconciliation data at close instead of building it yourself.
That is genuinely most of it. The platform handles retries, dunning, and matching in the background while your code stays small and focused on your product. You can explore the broader capabilities on the product overview.
Want a sandbox key to try the flow above? Reach out and we will get you building in minutes.