GladysDevelopers

Amounts and currencies

Send decimal text in major units and preserve exact amounts in your integration.

Send money in major currency units. With currency: "KES", an amount of "1500.50" means KES 1,500.50. The API returns money as decimal strings with the currency's fixed number of decimal places.

{
  "amount": "1500.50",
  "currency": "KES"
}

Use that body shape for a payment amount. Keep monetary input and returned amounts as strings in your application so large values and fractional digits survive. Do not multiply or divide current API amounts by 100.

Currency precision

CurrencyDecimal placesExample response amount
KES2"1500.50"
USD2"1500.50"
USDT6"1.000001"
BTC8"0.00012345"
ETH18"1.000000000000000001"

Currency codes are uppercase and case sensitive. A registered currency defines precision; it does not promise an external deposit or payout rail. A payment needs a payer wallet and merchant settlement wallet with matching currency and environment. Fee collection also needs matching system wallets. Current M-Pesa and bank payouts use KES, and the Kenyan payroll engine requires KES.

Input and rounding

Requests accept a plain decimal string or a raw JSON number. Prefer strings: a JSON number constructed with floating-point arithmetic may have lost digits before the API receives it.

Send text containing digits and an optional decimal point, such as "1500.50". Exponent notation ("1e3" or 1e3), commas, surrounding whitespace, NaN and Infinity are invalid. Monetary input rounds half-up to currency precision:

KES requestRounded amount
"1.004""1.00"
"1.005""1.01"
"1500""1500.00"

Payment amounts must remain positive after rounding: "0.004" KES rounds to zero and cannot create a payment. Use the amount returned by the API as the accepted value. Amounts must fit the storage range: fewer than 100,000,000,000,000,000,000 major units in absolute value, with the currency's precision. Endpoint-specific positivity requirements still apply.

Read and calculate exact amounts

Payment amount, fee, net_amount, refunded_amount and refundable_amount, and refund amount, are strings. Other monetary API objects follow the same contract, including wallets, transactions and payroll. Currency applies to all monetary fields on the object.

Use exact decimal arithmetic when comparing balances, adding amounts or calculating a refund. Construct decimal values from the returned strings; avoid Number, parseFloat and ordinary floating-point arithmetic on money. Configure decimal arithmetic to retain enough digits for the supported values. Display and export the original exact amount, including trailing decimal places.

"0.00" is a real amount. Keep optional/null values distinct from zero, and never add amounts with different currencies into a financial total. Counts, booleans and percentage rates are separate from money and retain their own types.

For payments, use the returned net_amount and refundable_amount rather than reconstructing them from client-side history. Refund requests can omit amount to refund the remaining amount; see Refunds.

Webhook versions and retained history

New payment webhooks include version: 2 and use the same major-unit strings. Verify the signature against the raw request body before parsing or normalizing it. See Signature verification.

A replay of a stored, older unversioned webhook can still contain integer cents. Its signed body stays unchanged. If you handle that retained format, normalize its cent amounts once based on the event version. Do not rescale version 2 amounts, and reject unsupported versions. Keep historical audit records tied to the contract under which they were recorded.

On this page