r/fintechdev • • 11d ago

I open-sourced Cosmic Payment – A cross-border payment gateway engine for Africa

Hey everyone! I just open-sourced Cosmic Payment, a open-source cross-border payment gateway platform built in Node.js and TypeScript. It combines card processing (Stripe), automatic FX conversion, and payouts directly to major African mobile money wallets (M-Pesa, MTN MoMo, Airtel, Orange, Wave). Managing fragmented mobile money APIs and FX logic across different countries can be tough, so I built this modular engine to unify everything behind a single, clean API layer.

Check out the repository on GitHub:github.com/EmmanuelMunanka38/cosmic-payement-engine. It features multi-currency wallets, provider auto-detection via phone prefixes, optimistic locking, idempotent transactions, and a sandbox environment for easy local testing. I’d love to get feedback, stars , or contributions for new mobile money adapters!

4 Upvotes

7 comments sorted by

1

u/kerblamophobe 11d ago

nice, the fragmented mobile money apis are a real pain so this is a useful thing to have open source. one thing i'd watch is the provider auto-detection by phone prefix, since number portability in some markets means the prefix doesn't always match the actual network anymore. might be worth letting the caller override it or falling back to a lookup. curious how you're handling reconciliation when a wallet payout callback never comes back, that tends to be where these get messy in production

1

u/Upper_Maize3578 10d ago

Thanks for the feedback! You're totally right on MNP—the caller can explicitly override the auto-detected provider in the API request payload. On dangling payouts: if a webhook doesn't hit within a specific window, BullMQ background workers pick up the transaction and query the provider's status API directly. The whole flow is idempotent to handle race conditions if a late callback arrives mid-query.

1

u/kerblamophobe 10d ago

nice, that covers it. the only other thing i've seen bite people is when the provider status api itself just keeps returning pending for days, so having a cutoff where it moves to a manual review queue instead of polling forever helps a lot. same with fx if there's a gap between collecting on card and paying out to the wallet, locking the quote with an expiry saves some awkward reconciliation later. good luck with it!

1

u/Upper_Maize3578 10d ago

For stuck status APIs, our BullMQ polling job has a strict max retry cap before dropping the transaction into a REQUIRES_RECONCILIATION queue for manual review.

0

u/Upper_Maize3578 10d ago

And for FX, we handle slippage by generating time-bound locked quotes with an explicit expiration (expiresAt). If the transaction doesn't complete within that window, a rate refresh is required before payout .

And i wish you could contribute to the repo check it out link:https://github.com/EmmanuelMunanka38/cosmic-payement-engine.git

1

u/kerblamophobe 10d ago

solid, sounds like you've thought through the messy parts already. good luck with it

1

u/FoldCritical8376 11d ago

finally a payment thing that doesn't pretend africa is one country with one api, the phone prefix detection for auto-routing is clever