A billing management system for a ride-hailing platform, handling fare calculations, payment processing, and financial reconciliation.

Overview

Backend system for managing billing operations of a ride-hailing platform. Built with Go and CockroachDB, processing ride transactions, calculating fares, managing driver payouts, and handling financial reconciliation.

Key Features

  • Fare Calculation: Dynamic pricing based on distance, time, demand, and service type
  • Payment Processing: Integration with payment gateways for charges and driver payouts
  • Billing Reconciliation: Automated matching of rides, payments, and settlements
  • Multi-currency Support: Transactions across different currencies
  • Invoice Generation: Automated invoice creation
  • Dispute Management: Workflow for payment disputes and refunds
  • Financial Reporting: Reports for revenue tracking and audits

Technical Architecture

Distributed architecture with the following components:

  • Database: CockroachDB for distributed, consistent data storage
  • Microservices: Separate services for fare calculation, payments, invoicing, and reconciliation
  • Event-Driven Processing: Asynchronous handling for payment webhooks and transaction updates
  • API Gateway: Routing and authentication for billing operations
  • Background Workers: Scheduled jobs for reconciliation and reporting
Go CockroachDB REST API gRPC PostgreSQL Protocol Docker Redis

Core Functionality

Fare Calculation Engine

  • Base fare + distance-based pricing
  • Time-based charges for wait times and trip duration
  • Surge pricing during peak hours
  • Promotional discount application
  • Service type multipliers (economy, premium, luxury)

Payment Processing

  • Multiple payment method support (cards, wallets, cash)
  • Automatic retry logic for failed transactions
  • PCI-compliant card data handling
  • Split payments for shared rides
  • Scheduled driver payouts

Reconciliation System

  • Daily financial reconciliation reports
  • Automated matching of rides to payments
  • Discrepancy detection and flagging
  • Commission calculation for platform revenue
  • Tax calculation and reporting

Technical Highlights

  • Distributed transactions with strong consistency
  • Idempotent API design for payment processing
  • Audit logging for financial compliance
  • Automated testing
  • Payment gateway failure handling

Project Context

Developed at 2F Capital (July 2022 - February 2023) for a ride-hailing platform’s billing system. Collaborated with senior engineers to design services, refactor code, and maintain financial accuracy.

Key experience gained:

  • Financial system design and reconciliation
  • Distributed databases (CockroachDB)
  • Payment processing systems
  • Data consistency in distributed environments