A three-phase payment and invoicing system has been built for the GP Booking App, enabling practices to record manual payments, accept online card payments via Stripe, and generate invoices with PDFs.
The system lives within the existing Django project at appointments/:
| Component | File | Purpose |
|---|---|---|
| Payment models | appointments/models_payment.py |
PaymentConfig, PaymentTransaction |
| Invoice models | appointments/invoice_models.py |
Invoice, InvoiceLineItem |
| Stripe service | appointments/payment.py |
Stripe API integration |
| Webhook endpoint | appointments/webhooks.py |
POST /webhooks/stripe/ (CSRF exempt) |
| PDF generation | appointments/invoice_pdf.py |
WeasyPrint HTML→PDF |
| Email service | appointments/invoice_email.py |
Send invoices with PDF attachment |
| Views | appointments/views.py |
Record, Pay Online, Invoice CRUD |
| Templates | templates/appointments/ |
checkout, record_payment, invoice list/detail/pdf/email |
appointments_paymentconfig — practice-level Stripe credentials (encrypted)appointments_paymenttransaction — individual payment recordsappointments_invoice — invoices with status trackingappointments_invoicelineitem — invoice line items