ENGINEERING STORY

Stripe Connect + Driving School Payments

What looked like adding online payments became designing how money moves through the entire platform.

8 min read

Node.jsExpressStripe ConnectStripe CheckoutPayment IntentsSetup IntentsWebhooks3D SecureEvent Driven Architecture

Payment Flow

ST

Student

BK

Lesson Booking

Stripe Connect Engine

PY

Platform Commission + Instructor Payout

CommissionInstructor Share

T-48 Charging

Scheduled before lessons

3D Secure

Authentication handled

Automatic Payouts

After lesson completion

Refund Rules

Protected by business logic

Students protected

No unfair charges

Instructor payouts automated

Paid only after lessons complete

Platform commissions retained

Money splits automatically

Duplicate payouts prevented

Race-condition safe processing

What We Thought Was Just Stripe Payments

When we started working on the DSP platform, the original goal sounded simple.

Students should be able to book driving lessons and pay online. Instructors should receive their money, and Stripe would handle the rest.

Simple enough.

But once we started looking at how the business actually worked, we realized that accepting payments was only a small part of the problem.

The real challenge was deciding what should happen after someone clicks "Book Lesson".

Because money, schedules, refunds, instructors, and the platform itself all had to work together. And that's where things got interesting.

Booking A Lesson Isn't The Same As Paying For One

Some lessons are days or even weeks away.

Charging students immediately for a lesson that might still be cancelled didn't feel right.

But waiting until the last moment created another problem.

What if the card declined? What if the bank required 3D Secure authentication? What if the student simply disappeared?

Suddenly, "Take payment with Stripe" became much more complicated. We needed a better approach.

The 48-Hour Rule Solved A Lot Of Problems

Instead of charging every booking immediately, we designed two payment flows. Most of the time, the process remained invisible.

Lesson within 48 hours

  1. 1Student books lesson
  2. 2Payment taken immediately
  3. 3Booking confirmed

Lesson more than 48 hours away

  1. 1Card saved during booking
  2. 2T-48 automatic charge attempted
  3. 3Booking confirmed on success

Cards Don't Always Behave

Some cards required 3D Secure. Others failed due to insufficient funds. Students sometimes abandoned checkout.

Instead of treating failures as errors, we treated them as part of the workflow.

Users could resume unfinished payments. Retry failed charges. Complete authentication when required.

And once lessons had passed, payment flows became locked.

Paying Instructors Was More Complicated Than Expected

Getting money from students was only half the story.

The platform keeps a commission on every lesson. Money couldn't simply pass through. And instructors shouldn't be paid immediately because cancellations and refunds still existed.

So payouts became tied to lesson completion. Only completed lessons became eligible.

An automated payout system continuously looked for completed lessons, successful payments, and unpaid lessons.

Then Stripe Connect transferred instructor shares while retaining platform commissions.

Refunds Needed Rules Too

Refunds were not button clicks. They were business rules.

Completed lessons couldn't be refunded. Paid-out lessons couldn't be refunded. Duplicate refunds were blocked.

Admins couldn't accidentally break accounting. The system protected itself.

We Stopped Thinking About Payments

Eventually, we realized we weren't building Stripe features. We were building trust.

Students trusted they wouldn't be charged unfairly. Instructors trusted they'd get paid.

The platform trusted commissions and payouts would always remain balanced.

Stripe became the engine. Business rules became the real product.

System Architecture

Student

Book Lesson

Setup Intent

Card Saved

T-48 Scheduled Charge

Payment Intent

Lesson Completed

Stripe Connect

Instructor Payout + Platform Commission

Instructor SharePlatform Commission

How The System Handles Edge Cases

Deferred Charging

Cards are saved and charged automatically 48 hours before lessons.

Resume Checkout

Students can continue incomplete payments.

Smart Authentication

3D Secure challenges handled gracefully.

Automated Payouts

Completed lessons trigger instructor payouts.

Refund Protection

Invalid refunds blocked automatically.

Race Condition Protection

Each lesson can only be paid once.

Tech Stack

Node.js

Backend

Node.jsExpress
Stripe

Payments

Stripe ConnectStripe CheckoutPayment IntentsSetup Intents3D Secure

Money Movement

Destination ChargesPlatform CommissionsConnected AccountsScheduled Payout Jobs

Infrastructure

Stripe WebhooksEvent Driven ArchitectureAtomic ProcessingRace Condition Protection

Business Logic

T-48 ChargingInstructor Payout AutomationRefund RulesCancellation RulesLesson Status Rules

Most users never think about payment systems.

That's exactly how they should work. We design the business rules behind payments, automation, and integrations so your platform stays reliable as it grows.