All projects
F

FinTech · E-commerce · Client Project

Client Project

Flayona

Marketplace backend, payment integration and BNPL lending for a commercial e-commerce client: distributor pricing, Paystack, Mobile Money, KYC.

Client-confidential project: source code and internal implementation are not published. This case study covers my engineering contribution, the problem solved and the technologies used.

My Role
Freelance Software Developer (Contract)
Timeline
2025 – Present
Year
2025
Status
Client Project
PHPMySQLPaystack APIWhatsApp Cloud API

Role

Engaged directly by the client as the backend-focused full-stack developer; I own the platform's architecture, data model and production deployment.

Scope

Built the distributor-pricing engine, the BNPL lending system (KYC → credit decision → instalments), Paystack + Mobile Money payment flows, and four separate authenticated portals (customer, admin, credit officer, distributor).

Engineering depth

Auth (RBAC, TOTP 2FA, account lockout), payment webhooks (Paystack HMAC-SHA512, idempotent reconciliation), relational schema design (30+ tables), audit logging, and a PWA build tuned for low-end Android on patchy connections.

Overview

Flayona is a multi-vendor e-commerce and FinTech platform I built under contract for a commercial client: a retail marketplace offering everyday products, imported goods and wholesale deals, sold at region-specific prices and paid for via card or Mobile Money. Because it handles real money and extends real credit, correctness and security were the design constraint from day one, not an afterthought.

This is client-confidential work: source code and internal business logic aren't published, but the architecture and database shape below reflect the real system at a level appropriate to share publicly. What follows is my engineering contribution, not a marketing description.

Business problem

The client needed a platform where independent distributors could sell the same catalogue at different, region-specific prices, accept payment the way customers actually pay locally (Mobile Money as much as cards), and extend short-term credit without taking on undue default risk.

That meant solving three hard problems at once: payment reconciliation that never double-counts across two very different payment rails, an identity-verified lending flow that doesn't gate honest customers unnecessarily, and account security robust enough for four different types of user (customers, distributors, admin staff and credit officers) sharing one platform.

Key achievements

  • A production platform deployed and operating for a commercial client, handling real payments across two rails.
  • A working BNPL product with configurable terms, automated instalments and KYC-gated approval, running unattended via scheduled processing.
  • Four independently secured account types running from one maintained codebase with no privilege leakage between roles.

Engineering challenges

Reconciling two payment rails

Card and Mobile Money behave differently under retry and failure. HMAC-verified, idempotent webhook handling for Paystack, and PO-reference matching plus WhatsApp confirmation for Mobile Money, keep both settling into one consistent order record.

Securing four account types on one platform

Customers, distributors, admins and credit officers each needed strong, independent authentication: TOTP 2FA, lockout and OTP applied consistently across all four, so a bug in one portal's auth can't leak into another's.

Hosting constraints vs. engineering ambition

The client's budget ruled out managed cloud infrastructure. Choosing vanilla PHP over a framework, and MySQL over a managed Postgres service, was a direct tradeoff to fit that constraint without compromising on security fundamentals.

Technology stack

Core

PHPMySQLmysqliPrepared statementsPWA

Payments

Paystack APIMobile MoneyHMAC-SHA512 webhooksIdempotent processing

Security

TOTP 2FAAccount lockoutPasswordless OTPRBACCSRF

Comms

WhatsApp Cloud APISMSSMTP

Hosting

ApacheIONOS hostingHTTPS / SSL/TLS
Technical deep dive: architecture, database, engineering decisionsFor technical reviewers

Requirements

Requirements

  • Distributor-specific pricing and variant-level inventory per region.
  • Card payments (Paystack) and Mobile Money, reconciled reliably under retry.
  • A configurable Buy-Now-Pay-Later lending product with KYC-gated approval.
  • Four separate, securely authenticated user types with no privilege overlap.
  • Secure handling of identity documents submitted for KYC.
  • Fast, installable performance on low-end Android over patchy connections.

Research

Research & planning

  • Studied Paystack's payment and webhook lifecycle to design reconciliation that survives retries and out-of-order delivery.
  • Mapped the Mobile Money flow used locally, where the order/PO number becomes the payment reference and is confirmed over WhatsApp.
  • Applied the OWASP Top 10 directly to authentication, CSRF and access control across all four portals rather than as a generic checklist.

Solution

The solution

I designed and deployed the platform in vanilla PHP and MySQL, delivering the full lifecycle from requirements gathering and database modelling through architecture, production deployment, scheduled processing and post-launch support. That's a deliberate tradeoff: no framework, no build step, chosen so the client's own team could host and maintain it cheaply on standard shared hosting, at the cost of writing more plumbing by hand.

Pricing is distributor-driven: a master catalogue holds a reference price and the admin's private cost, while the price a customer actually pays is set by the distributor serving their region, so the same SKU can be priced differently across the country without duplicating the catalogue.

The BNPL engine runs an internal credit score, generates a digital contract and an instalment schedule (1–24 months, 0–22% flat interest, capped non-compounding late fees), and a scheduled cron job charges instalments automatically as they fall due, all gated behind KYC verification.

Paystack card payments and Mobile Money are both integrated. Standard orders settle out-of-band via Mobile Money and WhatsApp confirmation; pre-order deposits go through a Paystack webhook verified with HMAC-SHA512 and processed idempotently, so a retried or duplicate event can never double-apply.

Four secure authentication domains (customers, distributors, administrators and Credit Officers) each carry TOTP two-factor authentication, account lockout, passwordless OTP and role-based access control, so a compromised customer session can never reach admin or distributor tooling.

Architecture

System architecture

Flayona is a server-rendered PHP application over MySQL (mysqli), installed as a PWA. Cross-cutting concerns (authentication guards per role, CSRF, payments, KYC upload, credit logic and audit logging) live in a shared library so every page composes the same vetted building blocks rather than reimplementing security per route.

Four separate portals sit behind their own auth guards: the customer storefront, the admin back office, the credit-officer portal that reviews BNPL applications, and the distributor portal with its own point-of-sale, stock and orders.

Payment is asynchronous by design: standard orders resolve out-of-band via Mobile Money and WhatsApp confirmation, pre-order deposits go through a signature-verified Paystack webhook, and a cron job drives automated BNPL instalment charging independently of any user session, so a customer closing their browser mid-checkout can never leave the order in an ambiguous state.

Loading diagram…
High-level system architecture

Data

Database design

The schema (30+ tables in production) is organised around commerce and credit. A master products table carries a reference price and the admin's private cost, while a distributor_products table sets the region-specific price and distributor_variant_stock tracks stock per distributor: the mechanism that makes distributor-specific pricing possible without duplicating the catalogue.

Orders link to order_payments (card or Mobile Money), and BNPL orders additionally link to a KYC application, a credit score and a schedule of instalments. Roles are separated at the data layer too: admins, credit officers and distributors are distinct account types with their own credentials and TOTP secrets.

Loading diagram…
Entity-relationship model

Features

Key features

Distributor-specific pricing

Region-based fulfilment with per-distributor pricing and variant-level inventory, so the same catalogue is priced differently by region without duplication.

Configurable BNPL lending

1–24 month terms, tiered flat-interest pricing (0–22%), automated instalments, capped non-compounding late fees, gated behind KYC.

Paystack + Mobile Money

Card and Mobile Money payments; card flows reconciled via HMAC-SHA512-verified, idempotent webhooks.

Four secure authentication domains

Customers, distributors, admins and Credit Officers, each with TOTP 2FA, account lockout and passwordless OTP.

KYC document handling

Identity documents stored privately behind ownership-checked, authenticated access.

Distributor POS & stock

Distributors run point-of-sale, manage stock and fulfil orders from their own portal.

Loyalty, promotions & internal credit scoring

Configurable loyalty, membership, pre-order, professional-discount and internal credit-scoring capabilities.

Audit logging across every portal

An append-only audit trail records sensitive actions across all four authentication domains.

Engineering

Engineering decisions

Framework-free by deliberate tradeoff

Vanilla PHP and MySQL with no framework or build step: a conscious choice prioritising the client's ability to host and maintain the platform cheaply over developer convenience.

Full lifecycle ownership

Requirements gathering, database modelling, architecture, production deployment, scheduled processing and post-launch support, delivered end to end for the client.

Idempotent, race-safe payments

Webhook processing keys off signature verification and idempotency so retries and concurrent events can't double-apply.

KYC-gated credit

BNPL approval is strictly gated behind identity verification, encoded so the rule can't be bypassed by any code path.

Security

Security & correctness

  • TOTP two-factor authentication and account lockout across all four authentication domains.
  • HMAC-SHA512 webhook signature verification before any payment state changes.
  • Idempotent, race-safe transaction reconciliation.
  • Private, ownership-checked storage for KYC documents.
  • CSRF protection and role-based access control throughout.

Interface

Screenshots

Flayona storefront home delivering by region across Ghana
The mobile-first storefront, delivering by region across Ghana.
Flayona checkout with delivery or pickup, paid by Mobile Money
Checkout: delivery or pickup, paid by Mobile Money against a PO reference.
Flayona admin back office dashboard
The admin back office: revenue, profit, orders and payment reconciliation.
Flayona distributor portal dashboard
A distributor's portal: regional pricing, stock and orders to action.

Reflection

Lessons learned

01

Payment correctness comes from modelling state precisely: idempotency and signature verification aren't optional extras once real money is involved.

02

Separating auth domains cleanly at the start avoids cross-role access bugs later; retrofitting that separation is much harder.

03

A client's hosting budget is a real design constraint, not a footnote. It shapes stack choices as much as functional requirements do.

What's next

Future roadmap

  • This is ongoing client work; further features are scoped directly with the client as the platform grows.