How to build: Booking (checkout)
Create the booking on Middleware Backend. Start payment on Middleware Backend. Core Backend stores the booking / payment rows.
Re-check availability → POST bookings → POST payments/initialize → PSP or wallet → webhook → confirmationRoutes: /checkout (app/(guest)/checkout), /booking/confirmation.
The Next app currently still POSTs Core .../entity/booking in services/booking.ts. Switch to Middleware. Payments initialize is not wired in config/api-routes.ts yet — add it.
Booking Summary / Guest Details
implemented Checkout UI. Dates and rate package come from search state. Guest must be logged in so JWT uuid is the booking owner.
Checkout / create booking
Middleware Backend · winner · live
POST https://middleware-dev.bookdirect.live/api/v1/nellalink/bookings
Authorization: Bearer {access_token}
Content-Type: application/json{
"ratePackageId": "{rate_plan_uuid}",
"checkIn": "2026-10-01T14:00:00.000Z",
"checkOut": "2026-10-03T11:00:00.000Z",
"numGuests": 2,
"specialRequests": "Late arrival"
}Middleware sets owned_by from JWT, checks availability, writes Core booking as pending.
Payment Method / Payment Processing
Middleware Backend · winner · live
POST https://middleware-dev.bookdirect.live/api/v1/bookdirect/payments/initialize
{
"booking_uuid": "{booking_uuid}",
"provider": "paystack",
"amount_kobo": 6000000,
"currency": "NGN",
"callback_url": "https://dev.bookdirect.live/booking/confirmation"
}provider may be paystack or wallet. Wallet uses GET .../payments/wallet/balance and GET .../payments/wallet/virtual-account.
Webhook (PSP → Middleware, no user JWT):
POST https://middleware-dev.bookdirect.live/api/v1/bookdirect/payments/webhook/paystack
Slow webhook fallback:
POST https://middleware-dev.bookdirect.live/api/v1/bookdirect/payments/verify/{reference}
Booking Confirmation / Booking Receipt
implemented /booking/confirmation. Poll booking until confirmed (webhook did it). Do not let the browser mark paid.
Emails (POST .../bookdirect/emails/send) are to implement — no emails folder in routes.json yet.
Called by Middleware Backend, not by frontend
POST https://backend-dev.bookdirect.live/public/api/v1/nellalink/smart-meta-manager/entity/booking
POST .../entity/payment