Reference

Money

Integer kobo, everywhere, and how to get user input into it safely.

Every amount in Harbour, in the API, in the SDK and in webhooks, is an integer number of kobo. There is no float anywhere, and the SDK refuses one rather than rounding it quietly.

Everything is kobo

1_200_000      // ₦12,000.00   ← readable in JavaScript
1200000        // the same number
12000.5        // rejected: InvalidArgumentError, fractions of a kobo lose precision
"1200000"      // rejected: pass a number, or convert it properly (below)
12000          // accepted, but it is ₦120: always think in kobo

100 kobo is ₦1. A field that holds money is always named *_kobo — amount_kobo, fee_kobo, net_kobo, refunded_kobo — so there is never a question about the unit. Payments are naira; Harbour's own subscription is priced in dollars and lives elsewhere.

From user input

A person typing into a form gives you a string. Convert it without touching a float:

import { Money } from '@nordaxiz/harbour-connect';

Money.toKobo('120,000.50');   // 12000050
Money.toKobo('840000');       // 84000000
Money.toKobo('₦45,000');      // InvalidArgumentError: symbols are not amounts
Money.toKobo('1.005');        // InvalidArgumentError: more than two decimal places

toKobo() rejects currency symbols, signs, more than two decimal places and badly grouped thousands instead of guessing what was meant. Strip the symbol in your form layer, then hand the number over.

Back to naira

Money.format(12_000_050);     // "120,000.50"
Money.format(1_200_000);      // "12,000.00"

The dashboard shows amounts in tabular figures with the kobo in a smaller size, so columns line up. If you are rendering amounts in your own product, tabular numerals are worth the one CSS line.