From subscribe to unlock & ride
Rent path: subscribe → pay → unlock BhaरBike → ride → live tracking.
Orange renter journey: book BhaरBike → pay → unlock → GPS peace of mind.
User taps subscribe
Everything begins when someone picks a plan in the BhaरBike app.
The app packages what they chose and opens the door for payment — still safe, still reversible until pay succeeds.
Backend & API
Your Node server is the gatekeeper: it checks input and prepares Razorpay.
Middleware and validators run first; only clean payloads become rows and payment intents.
Razorpay checkout
Money is collected by Razorpay — BhaरBike never stores card or UPI PINs.
Success isn’t guessed: the app sends proof back; the API verifies the signature before trusting “paid”.
Saved in Supabase
One database row ties the human, the bike slot, and the payment together.
Supabase Postgres is the single source of truth for dashboards, unlock logic, and history.
Admin notification
Ops sees new paid rentals immediately — no spreadsheet chasing.
Teams confirm fleet health, spot failures early, and trust the same data the unlock API will read.
Bike unlock
Paid → unlock: the app asks the server “is this renter cleared?” before the motor frees.
Try the button: the API re-checks payment, moves the order to ongoing, updates Supabase, and calls the IoT shim when a bike_id exists.
Live tracking
See where the bike is during the rental — peace of mind for you and ops.
With MAPBOX_ACCESS_TOKEN you get a real dark map and orange path. Without it, the same story plays as a full-width animated preview. Trusted renters can later open the green Rider flow — same platform.
