Prompt
appointment booking api with payments
Latest observation
Oct 15, 2026
OpenAI APIWeb search: off
Here’s a solid blueprint for an appointment booking API with payments.
Core features
- User registration/login
- Service provider management
- Service catalog
- Availability scheduling
- Appointment booking/rescheduling/canceling
- Payment processing
- Refunds/cancellations
- Notifications (email/SMS)
- Admin dashboard endpoints
Suggested stack
- Backend: Node.js + Express / NestJS, or Django / FastAPI
- Database: PostgreSQL
- Cache/queue: Redis
- Payments: Stripe / Razorpay / PayPal
- Auth: JWT + refresh tokens
- Notifications: SendGrid, Twilio, Firebase
Main entities
- User: customer or provider
- Provider: business/person offering services
- Service: haircut, consult, massage, etc.
- Availability: slots by provider
- Appointment: booking record
- Payment: transaction record
- Refund: if canceled or failed
API endpoints
Auth
POST /auth/registerPOST /auth/loginPOST /auth/refresh
Providers & services
GET /providersGET /providers/:idPOST /providersGET /servicesPOST /services
Availability
GET /providers/:id/availabilityPOST /providers/:id/availabilityGET /slots?provider_id=1&date=2026-10-15
Appointments
POST /appointmentsGET /appointments/:idGET /users/:id/appointmentsPATCH /appointments/:id/reschedulePATCH /appointments/:id/cancel
Payments
POST /payments/intentPOST /payments/webhookGET /payments/:idPOST /payments/:id/refund
Booking flow
- Customer selects provider, service, date, and slot.
- API checks slot availability.
- Create appointment with status
pending_payment. - Create payment intent with payment provider.
- On successful payment webhook:
- mark payment
paid - confirm appointment
confirmed
- mark payment
- If payment fails or times out:
- release slot
- mark appointment
cancelledorpayment_failed
Important status values
Appointment
pending_paymentconfirmedcancelledcompletedno_showrescheduled
Payment
requires_paymentprocessingpaidfailedrefundedpartially_refunded
Key implementation points
- Use transaction locking to avoid double booking.
- Store payment provider transaction IDs.
- Make payment webhooks idempotent.
- Define cancellation policy and refund rules.
- Prevent booking overlapping slots.
- Timezone handling is critical.
Example POST /appointments
{
"user_id": 12,
"provider_id": 3,
"service_id": 7,
"start_time": "2026-10-20T10:00:00Z",
"end_time": "2026-10-20T10:30:00Z",
"payment_method": "card"
}
Example response
{
"appointment_id": 101,
"status": "pending_payment",
"payment_intent_id": "pi_12345",
"amount": 5000,
"currency": "USD"
}
Example database tables
appointments
- id
- user_id
- provider_id
- service_id
- start_time
- end_time
- status
- created_at
- updated_at
payments
- id
- appointment_id
- user_id
- amount
- currency
- provider_payment_id
- status
- created_at
- updated_at
availability_slots
- id
- provider_id
- start_time
- end_time
- is_booked
If you want, I can also provide:
- a complete REST API spec
- a PostgreSQL schema
- a Node.js/Express implementation
- a Stripe payment flow example