---
title: "Introduction"
description: "Two Minute Billing owns subscription state, keeps money in an append-only, double-entry ledger, and emits an event for every change. Learn the model first."
canonical_url: "https://twominutebilling.com/help/developers/getting-started/introduction"
---
# Introduction

> Two Minute Billing owns subscription state, keeps money in an append-only, double-entry ledger, and emits an event for every change. Learn the model first.

**Two Minute Billing** — tmbilling for short, and the name you will see in the API — is a
multi-tenant subscription billing platform. It runs your recurring billing end to end: a catalog
of products and prices, subscriptions with trials and proration, invoices with tax and discounts,
collection through your own payment gateways, and dunning when a card fails.

It is not a payment gateway. Your payment gateway charges the card. tmbilling decides what to
charge, when, and what to do when the charge fails.

<u-page-grid>
<u-page-card description="Create a test key, then bill your first customer in TypeScript or curl." title="Quickstart" to="https://twominutebilling.com/help/developers/getting-started/quickstart">



</u-page-card>

<u-page-card description="Every endpoint, generated from the same OpenAPI document the typed SDK is built from." title="API reference" to="https://twominutebilling.com/help/developers/api-reference">



</u-page-card>

<u-page-card description="See how organizations, businesses, customers and subscriptions fit together." title="Concepts" to="https://twominutebilling.com/help/developers/concepts/account-hierarchy">



</u-page-card>

<u-page-card description="Receive signed, retried delivery of every state change, with the full event catalogue." title="Webhooks" to="https://twominutebilling.com/help/developers/webhooks">



</u-page-card>
</u-page-grid>

## What tmbilling owns

tmbilling is the source of truth for your subscription state. It asks a payment provider to do
two things: charge a card and vault it. It never asks the provider what a subscription is, when
it renews, or whether it is in trial.

That boundary is what lets you change provider, run two at once for different currencies, or bill
through one provider and refund through another — without touching your subscription data.

Three things to know before you build:

- **Amounts are integers in minor units, with a currency code.** `1999` plus `"USD"` is $19.99.
You will not find a float anywhere in the API.
- **Balances come from an append-only ledger**, not from a column tmbilling overwrites. A
correction is a new entry, so you can trace every number on an invoice back to what produced it.
- **Every write takes an Idempotency-Key.** Retry a request that may or may not have landed and
you get the original answer, which is how you should handle a timeout.

## How a billing cycle runs

Once your subscription exists, tmbilling drives it on a durable clock — a Postgres job queue
rather than an in-memory timer. A restart loses nothing, and tmbilling catches up a missed minute
instead of skipping it.

On each tick, for every subscription whose period has ended:

<steps>

### Roll the term forward

tmbilling advances the period. If the subscription has a fixed number of cycles left, the
counter drops. A subscription that runs out of cycles stops renewing rather than cancelling.

### Assemble the invoice

tmbilling gathers recurring lines, prorations from any mid-cycle change, metered usage for the
period that just closed, and any unbilled one-off charges waiting to be swept in.

### Apply discounts, then tax, then credits

Coupons and promotional credits come off before tax. Refundable credits and excess payments come
off after it. That order is what keeps the tax figure defensible.

### Collect

If the subscription collects automatically, tmbilling charges the customer's primary payment
method, falling back to the backup cards on any decline.

### Dun on failure

A failed charge moves the invoice to `payment_due` and starts the retry schedule. You configure
what happens when the retries run out.

</steps>

Every step emits events, and you can receive each one as a webhook. To see exactly what your
integration will get, read the [event reference](https://twominutebilling.com/help/developers/webhooks/events) — tmbilling generates it from
its own event registry, so it cannot drift from what actually fires.

## Where to start

<u-page-grid>
<u-page-card description="Bill your first customer in test mode, in TypeScript or curl." title="See it work" to="https://twominutebilling.com/help/developers/getting-started/quickstart">



</u-page-card>

<u-page-card description="Start with the hierarchy, then the catalog, then subscriptions." title="Design your integration" to="https://twominutebilling.com/help/developers/concepts/account-hierarchy">



</u-page-card>

<u-page-card description="Authentication, idempotency, errors and pagination — what every call needs." title="Write your client" to="https://twominutebilling.com/help/developers/api-essentials/authentication">



</u-page-card>
</u-page-grid>

## Related

- [Why developers build on the billing API](https://twominutebilling.com/solutions/developers)
- [Quickstart](https://twominutebilling.com/help/developers/getting-started/quickstart)
- [Account hierarchy](https://twominutebilling.com/help/developers/concepts/account-hierarchy)


## Sitemap

See the full [sitemap](https://twominutebilling.com/sitemap.md) for all pages.
