Vincere.dev Vincere
Fintech Production System

ESA

Cross-Border Bill Payment and Top-Up Platform

ESA
5
Suppliers
ECPay
Gateway
10 min
Reconciliation
State Machine
Architecture

Executive Summary

We built a LINE Mini App for Taiwan customers to pay Indonesian utilities and buy digital goods. Its backend treats payment and fulfillment as a verifiable state machine. It coordinates five suppliers and a Taiwan payment gateway without double charges, lost orders, or manual supplier-failure recovery.

The Problem

ESA processes real-money transactions between Taiwan customers and Indonesian suppliers. Each checkout touches ECPay, one or more suppliers, and an asynchronous webhook. Any step can time out, return ambiguously, or succeed silently. The system had to prevent duplicate charges and fulfillment, fall back when suppliers fail, compare IDR and NTD costs, integrate five provider contracts, and retain a complete order record.

5
Fulfillment Suppliers
2
Currencies
10 min
Reconciliation
Services Delivered
Dedicated Team

Cross-Border Bill Payment and Top-Up Platform

Architecture Overview

Data Layer
PostgreSQL Prisma
Backend & Orchestration
NestJS Cron Jobs
Frontend
LINE Mini App Admin Dashboard
Infrastructure

Key Technical Decisions

System Design

NestJS, Prisma, and PostgreSQL form one transactional core for the LINE Mini App and admin dashboard. Payments move PENDING → PAID → SUCCESS or FAILED. Items have separate lifecycles. A provider layer routes fulfillment through one contract. ECPay returns signed webhooks. A 10-minute cron finds stuck payments and alerts operators. A 12-hour cron syncs catalogs with per-supplier isolation.

Key Decisions

Payments use a state machine, making idempotency and recovery decidable. A provider abstraction isolates supplier details from payment logic. Suppliers are ranked by effective cost and fall back automatically. One Prisma transaction covers payment, items, history, and promo usage. Non-reversible effects wait until commit. Structured JSON stores provider requests, responses, and schema differences.

Implementation Highlights

State inspection short-circuits duplicate webhook and retry processing. ECPay callbacks pass CheckMacValue (AES-128-CBC) validation before state changes. Checkout returns immediately, while fulfillment runs asynchronously. Stored exchange rates drive IDR and NTD cost comparison. Payment history, item records, and provider exchanges reconstruct every order. Bounded concurrency protects supplier APIs during catalog sync.

Results & Validation

Runs in production behind a LINE Mini App for Taiwan customers buying Indonesian digital products.

State-machine lifecycles and idempotency prevent duplicate charges and fulfillment.

Five-supplier fallback protects customer experience during supplier outages.

Reconciliation finds stuck payments within minutes.

New suppliers integrate without changing core payment logic.

Persisted state and provider history reconstruct every order.

Key Insights

Idempotency, atomic writes, deferred side effects, and state machines prevent duplicate charges and fulfillment by design.

Supplier failure triggers automatic, cost-aware fallback.

Five suppliers with different auth and payload contracts sit behind one interface. The business core stays stable as integrations change.

Continuous reconciliation recovers from missed webhooks and provider failures.

Money-moving systems depend on asynchronous webhooks that can be delayed or dropped. Reconciliation enforces correctness after the request.

Who This Applies To

Applicable to payment platforms and marketplaces that orchestrate multiple providers. It fits cross-border commerce and money-moving systems that require idempotency, failover, and auditability, including LINE Mini App products.

Fintech Payments Multi-Supplier Cross-Border LINE Mini App

Technologies Used

Backend

NestJS Prisma

Frontend

LINE Mini App

Data & Integrations

PostgreSQL ECPay Webhooks

Patterns & Techniques

State Machine Idempotency Provider Abstraction Reconciliation Jobs Multi-Currency Audit Trail

Tools

GitHub

Building something similar?

We specialize in dedicated team for fintech companies. If you're facing challenges like the ones we solved for ESA, let's talk.

30 minutes · No commitment · We respond within 24h