Why it existed
Tunisia's online payments reached 19 million transactions in 2025, through about a thousand sites. More than 600 public repositories integrate Konnect or Flouci by hand, and the only JavaScript package for either had 32 downloads a month. Both gateways notify a shop with an unsigned GET that anyone could forge. tnpay makes the safe integration the easy one.
What I built
- Typed clients for Konnect and Flouci: create a payment, read it back, refund it.
- A webhook handler that takes only the reference from the request, fetches the payment from the gateway, and runs your code once per payment however many times the webhook is delivered.
- A fake Konnect and a fake Flouci, in-process, so tests and local development need no account.
- Runs on Node 20+ and edge runtimes; one function serves as a Next.js route handler.
Outcome
Three packages on npm, 75 tests including a property test that delivers webhooks in random orders, a live checkout demo on the Konnect sandbox, and two bugs found and fixed against the real API.