Online payments (students paying the school)¶
Applies to: owners and administrators with Settings.Manage (set-up); students using the student portal (paying); staff with Payments.View (seeing the result). Plan must include Payments and the Student Portal. Last reviewed: 2026-11-18.
Students can pay their invoices online from the student portal. The money goes straight into the school's own PayFast account. DriveFlow never holds it.
This page is about the school collecting from its students. Paying DriveFlow for the school's subscription is a separate flow that uses DriveFlow's own PayFast account; see Billing invoices. More about the PayFast integration is in PayFast.
What is supported¶
| Question | Answer |
|---|---|
| Which gateways can a school set up for student payments? | PayFast only. |
| Whose merchant account is used? | The school's own. Each school enters its own PayFast merchant details. |
| What can be paid online? | A student's own invoice with status Pending, PartiallyPaid or Overdue and a balance of at least R 5.00. |
| Who can pay? | The student, signed in to the student portal. Walk-in invoices cannot be paid online. |
| Part payments? | Only when the school switches on Allow part payments. |
| Card details stored in DriveFlow? | No. The student pays on PayFast's own page. |
Set up online payments¶
Before you start
You need a PayFast merchant account. In PayFast, the merchant ID, merchant key and passphrase are under Settings > Integration. Viewing the DriveFlow settings page needs Settings.View; saving needs Settings.Manage.
- In DriveFlow go to ADMINISTRATION > Settings and open Payments (page address
/settings/payments, page title Payment Settings). WithoutSettings.Managethe page shows "You can view these settings but not change them." - Scroll to Online Payments (PayFast).
-
Fill in:
Field Meaning Merchant ID Your PayFast merchant ID. Digits only. Helper text: "PayFast > Settings > Integration". Merchant key Your PayFast merchant key. Required the first time. Once saved, the helper reads "A key is saved. Enter a new one only to change it." Passphrase "Only if you set a passphrase in PayFast (recommended)." Must match the passphrase in PayFast exactly. Remove the saved passphrase Tick box shown once a passphrase is saved; tick it to clear the passphrase. Allow part payments "Off: students pay the whole balance of an invoice. On: they choose how much." Test mode (PayFast sandbox) "Use your PayFast sandbox details to try it without real money." -
Switch the On/Off switch at the top of the section to On.
- Click Save online payments.
Result: "Online payments saved. Students can now pay from the portal." (or "Online payments saved." when the switch is off).
Screenshot to be added
Screen: Payment Settings page. Should show: Online Payments (PayFast) section with Merchant ID, Merchant key, Passphrase, Allow part payments and Test mode.
The merchant key and passphrase are never shown again after saving. Leaving those boxes empty when saving keeps the saved values.
Test mode
While test mode is on, the page warns: "Test mode is on: students won't be charged, and nothing is paid into your account. Switch it off before students start paying for real."
Set-up errors¶
| Message | Cause |
|---|---|
| "The PayFast merchant ID is a number, e.g. 10000100. You'll find it under Settings > Integration in PayFast." | Merchant ID contains something other than digits. |
| "One of the PayFast details is too long. Please check you copied the right values." | |
| "Enter your PayFast merchant ID and merchant key before switching online payments on." | Switched on without both values saved. |
How a student pays¶
Screenshot to be added
Screen: Student portal Invoices page. Should show: the outstanding banner and the Make payment item in an invoice's actions menu.
- The student signs in to the student portal and opens Invoices (
/portal/invoices). A banner shows what is outstanding and, when online payments are on, "You can pay an invoice online with Make payment in its actions menu." Otherwise it reads "Please contact your driving school to arrange payment." - On the invoice's row, the student opens the three-dot menu and clicks Make payment. (View payments shows what has already been paid on that invoice and also offers paying.)
- The dialog Pay invoice
<number>shows "Balance owing". With part payments allowed, the student can change Amount to pay ("Pay the full balance or part of it (at least R 5.00)."). - The student clicks Pay R .... The row shows "Opening PayFast..." and the browser goes to PayFast.
- The student pays on PayFast by card, EFT or another method PayFast offers.
-
PayFast sends the student back to the portal's Payment page (
/portal/payment), which shows one of:Shown Meaning Confirming your payment… "We're waiting for PayFast to confirm it. This usually takes a few seconds." The page checks every 3 seconds, up to 20 times. Payment received "Thank you. R ... was paid towards invoice .... Your receipt has been emailed to you." PayFast confirmed the payment. "PayFast hasn't confirmed this payment yet. That can take a few minutes, for example with EFT. It will show on your invoices once confirmed, and you'll get a receipt by email." No confirmation after about a minute. The payment is still recorded when PayFast confirms later. Payment not completed "Nothing was paid. You can try again whenever you're ready." The student cancelled at PayFast, or the payment failed.
Payment reminder emails include a link straight to this flow when the school has online payments set up: .../portal/invoices?pay=<invoice> opens the pay dialog for that invoice after sign-in. See Invoice reminders.
The mobile app's student payment screens are described in the mobile app documentation.
What happens behind the scenes¶
sequenceDiagram
actor Student
participant DF as DriveFlow
participant PF as PayFast
Student->>DF: Clicks Pay
DF->>DF: Checks the invoice and creates a pending online transaction (reference DFS-..., amount, invoice)
DF->>PF: Student is sent to PayFast with the school's merchant details
alt Student cancels
PF->>DF: Back to the portal
DF->>DF: Transaction marked Cancelled
else Student pays at PayFast
PF->>DF: PayFast notifies DriveFlow (server to server)
DF->>DF: DriveFlow verifies the notification (see below)
DF->>Student: Payment recorded, invoice updated, receipt notification sent
end
Important
A payment is recorded only when PayFast's notification arrives and passes every check. The student returning to the portal is never treated as proof of payment.
Checks before the checkout starts¶
| Check | Message to the student |
|---|---|
| Plan includes Payments and the school has online payments switched on with merchant details | "Online payments aren't available at your driving school. Please contact them to pay." |
| The invoice belongs to this student | "Invoice not found." |
| The invoice is not Draft, Cancelled, Credit or Paid | "This invoice doesn't need paying." |
| Nothing left to pay after counting checkouts started in the last 60 minutes that are still pending | "A payment for this invoice is already in progress. If you didn't finish it, please try again in an hour." |
| Amount not above what is payable | "You can pay at most ... on this invoice." |
| Amount at least R 5.00 | "The smallest amount you can pay online is 5.00." or, when the whole balance is under R 5.00, "This balance is too small to pay online. Please contact your driving school." |
The 60-minute rule stops the same invoice being paid twice from two browser tabs. If the student cancels at PayFast and returns to the portal, the pending checkout is released immediately and they can try again.
Checks on PayFast's notification¶
The notification is accepted only when all of these hold:
- It names a payment reference DriveFlow created.
- The school of that payment has PayFast merchant details saved.
- The merchant ID in the notification is the school's merchant ID.
- The signature is valid for the school's passphrase.
- The payment status is COMPLETE. Any other status is acknowledged and nothing is recorded.
- PayFast's own server confirms that it sent the notification.
- The amount paid matches the amount requested (within one cent).
If any check fails, nothing is recorded and the rejection is written to the server log. PayFast retries notifications, so a temporary problem does not lose a payment.
What is updated on success¶
| Record | Change |
|---|---|
| Online transaction | Status Successful, PayFast payment ID and completion time stored. |
| Payment | A new payment with the next receipt number of the invoice's branch; amount as paid; method MobilePayment (shown as "Online / Mobile"); status Successful; reference number = the DFS reference; notes "Online payment via PayFast"; recorded by "Online (PayFast)". |
| Invoice | Amount paid increased; status becomes Paid when fully covered, otherwise PartiallyPaid. |
| Student | The Payment Received notification is sent (email with receipt, according to the school's notification settings). |
The payment then appears on FINANCE > Payments, on the invoice's View Payments, on the dashboard and in the Financial Report like any other payment.
Duplicate or simultaneous notifications for the same payment record it once. A checkout the student cancelled can still be recorded if PayFast later reports it complete (for example a slow EFT).
What happens on failure or cancellation¶
- Cancelled by the student: the transaction is marked Cancelled with the note "Cancelled by the student at PayFast." No payment is created; the invoice is unchanged.
- Not completed: the transaction stays Pending. After 60 minutes it no longer blocks a new attempt. Nothing cleans up or expires old pending transactions.
- Notification rejected: nothing changes in DriveFlow. If the student was charged, the money is in the school's PayFast account but no payment shows in DriveFlow; check the PayFast dashboard and record the payment by hand (see Payments).
Switching online payments off¶
Set the switch to Off and click Save online payments. Students no longer see Make payment. Notifications for payments already started are still processed, so a payment in flight is not lost.
Example¶
Driving school "Safe Start" enters its merchant ID and key, leaves Allow part payments off and switches online payments on. Student Naledi has invoice HQ-INV-00044 with a balance of R 1 200.00. She opens Invoices in the portal, clicks Make payment, then Pay R 1 200.00, and pays by card at PayFast. Back in the portal she sees Payment received. In DriveFlow the invoice is now Paid and FINANCE > Payments shows a new receipt with method "Online / Mobile" and status Successful.
Limitations and notes¶
- PayFast is the only gateway for student payments. The codebase also contains Paystack, Flutterwave and Stripe adapters, but no settings page or screen uses them.
- Refunding an online payment from DriveFlow is not supported in practice. See Refunds and voids. Refund in PayFast, then record the correction in DriveFlow.
- No saved cards, recurring debits or payment plans.
- Only invoices can be paid. A student cannot make a general deposit.
- One invoice per checkout.
- If the server's encryption keys change, saved merchant details can no longer be read; online payments then behave as if not set up until the details are entered again.
- Failed and rejected notifications are visible only in the server log; there is no screen listing online transactions.
- The return, cancel and notification addresses are part of the server configuration; schools do not set them.
Related articles¶
- Payments: how payments are recorded and receipted.
- Invoice reminders: reminder emails with a pay link.
- Refunds and voids: reversing an online payment.
- Payment history: finding online payments later.
- PayFast: the PayFast integration.
- Student portal: what students see.