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

PHP
SDK language
  • PHP
  • Node.jsComing soon
  • PythonComing soon
  • JavaComing soon
  • GoComing soon
  • .NETComing soon
Any language can call the API today
<?php

12_000_00      // ₦12,000.00   ← readable in PHP 7.4+
1200000        // the same number
12000.00       // rejected: InvalidArgumentException, floats lose precision
"12000"        // rejected: pass an int, or convert it properly (below)

100 kobo is ₦1. A field that holds money is always named *_koboamount_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:

PHP
SDK language
  • PHP
  • Node.jsComing soon
  • PythonComing soon
  • JavaComing soon
  • GoComing soon
  • .NETComing soon
Any language can call the API today
<?php

use Nordaxiz\HarbourConnect\Money;

Money::toKobo('120,000.50');   // 12000050
Money::toKobo('840000');       // 84000000
Money::toKobo('₦45,000');      // InvalidArgumentException: symbols are not amounts
Money::toKobo('1.005');        // InvalidArgumentException: 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

PHP
SDK language
  • PHP
  • Node.jsComing soon
  • PythonComing soon
  • JavaComing soon
  • GoComing soon
  • .NETComing soon
Any language can call the API today
<?php

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.