Why Stripe Connect?
Several options exist for marketplace payments, but Stripe Connect offered key advantages:
- Regulatory compliance - Stripe handles money transmission licensing
- Connected accounts - Direct relationships with recipients, not aggregated funds
- Flexible payouts - Platform controls payout timing
- Global reach - Supports international expansion
- Developer experience - Well-documented APIs and testing tools
Split Calculation Service
The split calculation was implemented as a dedicated service:
SplitCalculationService
- getProviderRate(providerId, serviceType)
- getVenueRate(venueId)
- getPlatformFee(bookingValue)
- calculateSplit(booking) -> { platform, provider, venue }
This separation meant business rules for splits could evolve independently of the payment integration.
Handling Edge Cases
The implementation addressed several complex scenarios:
Partial refunds: When a booking was partially refunded (e.g., service shortened), the refund was proportionally distributed based on original splits.
Disputes: Chargebacks were handled through Stripe's dispute process, with the platform retaining evidence of service delivery.
Failed payouts: If a connected account could not receive funds (e.g., verification incomplete), funds were held and retried automatically.
Multi-currency: While initial launch was UK-only (GBP), the architecture supported adding currencies for international expansion.
Webhook Reliability
Stripe webhooks were processed through a queue to ensure:
- At-least-once processing - failed handlers retried
- Ordering - events processed in sequence per booking
- Idempotency - duplicate events handled gracefully
Lessons Learned
- Test with Stripe's test mode extensively - edge cases in payments are expensive to discover in production
- Build reconciliation from day one - matching Stripe records to internal state saves debugging time
- Plan for disputes - have evidence collection built into the booking flow
- Consider payout timing - provider and venue cash flow expectations matter to business relationships