---
title: "Money and currency"
description: "Send every amount as an integer in minor units with a currency code, expect half-up rounding per line, match currencies across levels, and handle zero amounts."
canonical_url: "https://twominutebilling.com/help/developers/api-essentials/money"
---
# Money and currency

> Send every amount as an integer in minor units with a currency code, expect half-up rounding per line, match currencies across levels, and handle zero amounts.

The API never uses floating-point money. Every amount is an integer in the currency's minor unit, sent with its currency code, and rounding follows one rule.

## Send amounts in minor units

Every amount in the API is an integer in the currency's minor unit, paired with an ISO 4217
currency code. You will not find a floating-point amount anywhere.

<table>
<thead>
  <tr>
    <th>
      Amount
    </th>
    
    <th>
      You send
    </th>
    
    <th>
      Currency
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      $19.99
    </td>
    
    <td>
      <code>
        1999
      </code>
    </td>
    
    <td>
      <code>
        USD
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      ₹499.00
    </td>
    
    <td>
      <code>
        49900
      </code>
    </td>
    
    <td>
      <code>
        INR
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      ¥1,200
    </td>
    
    <td>
      <code>
        1200
      </code>
    </td>
    
    <td>
      <code>
        JPY
      </code>
    </td>
  </tr>
</tbody>
</table>

`JPY` has no minor unit, so `1200` means ¥1,200 rather than ¥12. tmbilling knows each currency's
exponent. Your code only needs it when formatting for display.

<warning title="Don't convert to a float at the boundary">

Parsing `1999` into a float, dividing by 100 and sending it back is how you lose a cent. Keep the
integer, and divide only in your formatter at the moment of display.

</warning>

## Expect half-up rounding, per line

tmbilling rounds half-up to the nearest minor unit. That matters wherever a calculation lands on a
fraction: percentage discounts, proration for a partial period, tax on a line, or a per-unit price
times a quantity.

It rounds each line, then sums the rounded lines — rather than rounding one unrounded total. That
is why an invoice still adds up when your customer checks it by hand.

## Match currencies across the hierarchy

You set a currency at several levels, and they have to agree:

<table>
<thead>
  <tr>
    <th>
      Level
    </th>
    
    <th>
      Field
    </th>
    
    <th>
      What it sets
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      Business
    </td>
    
    <td>
      <code>
        default_currency
      </code>
    </td>
    
    <td>
      The currency the business bills in by default, and the one its reporting rolls up to.
    </td>
  </tr>
  
  <tr>
    <td>
      Price
    </td>
    
    <td>
      <code>
        currency
      </code>
    </td>
    
    <td>
      The one currency a price is denominated in. Sell in three currencies and you create three prices.
    </td>
  </tr>
  
  <tr>
    <td>
      Customer
    </td>
    
    <td>
      <code>
        currency
      </code>
    </td>
    
    <td>
      The currency you bill this customer in. It decides which prices you can put them on.
    </td>
  </tr>
  
  <tr>
    <td>
      Subscription
    </td>
    
    <td>
      derived
    </td>
    
    <td>
      Every item on one subscription shares one currency. tmbilling refuses a mixed-currency item list rather than converting it.
    </td>
  </tr>
</tbody>
</table>

tmbilling never converts currency when billing. Conversion exists only for reporting: give a
business exchange rates and its metrics roll up into its default currency. That never changes what
you charge a customer.

## Handle zero amounts

A zero-amount invoice is normal — a fully discounted period, or a trial that produced a document
but no charge. tmbilling posts it and marks it paid without calling a gateway.

Invoice amounts are never negative. Reduce what a customer owes with a discount line, a credit
application or a credit note. Each is its own object with its own ledger entries, so you keep the
reason for the reduction. See [Credits and the ledger](https://twominutebilling.com/help/developers/concepts/credits).

## Related

- [Tax](https://twominutebilling.com/help/developers/concepts/tax)
- [Credits and the ledger](https://twominutebilling.com/help/developers/concepts/credits)


## Sitemap

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