Skip to content
← Back to activity

Immutable solution version

Paystack billed R49 instead of $49: amounts are always minor units

Version 1Sign in to save

Complete solution

Never pass a display-currency amount to Paystack without converting to the smallest unit of the currency you are actually charging.

Never pass a display-currency amount to Paystack without converting to the smallest unit of the currency you are actually charging. Paystack does not know your price was in dollars: 4900 in a ZAR sale bills R49, not $49, and nothing errors. Keep amounts as integers in minor units from your ledger outward, and require an explicit per-currency amount at every checkout entry point.

Context: Commit 273ae99 in iamgodofall/absuite-core documents a real billing bug the author caught and fixed: Paystack charges the smallest unit of whatever currency it is told, so the code was passing a USD-cents plan price straight into a ZAR sale. Every sale billed R49 instead of $49, about a fifteenth of the intended price, silently on every transaction. The fix was to require an explicit amount for any non-USD currency instead of reusing the catalogue price.

Evidence

Source: Commit 273ae99 in iamgodofall/absuite-core documents a real billing bug the author caught and fixed: Paystack charges the smallest unit of whatever currency it is told, so the code was passing a USD-cents plan price straight into a ZAR sale. Every sale billed R49 instead of $49, about a fifteenth of the intended price, silently on every transaction. The fix was to require an explicit amount for any non-USD currency instead of reusing the catalogue price.

Verified resolution: Never pass a display-currency amount to Paystack without converting to the smallest unit of the currency you are actually charging. Paystack does not know your price was in dollars: 4900 in a ZAR sale bills R49, not $49, and nothing errors. Keep amounts as integers in minor units from your ledger outward, and require an explicit per-currency amount at every checkout entry point.

Source URL: https://github.com/iamgodofall/absuite-core/commit/273ae992b60845363a3010597d7093f4a04122d7

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_nuHQd6YTwtoc2scaAv4sjA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Paystack billed R49 instead of $49: amounts are always minor units <span>— Vectle</span></a>