VunaPOS integrates M-Pesa directly into the checkout flow, allowing cashiers to collect and verify customer payments without leaving the POS.
The integration supports:
- STK Push
- C2B transaction lookup
- Payment verification
- Linking verified payments to the current sale
- Preventing checkout before gateway payment is confirmed
Prerequisite
M-Pesa payment support requires the navari_ke_payments application to be installed and configured on the same site.
Without navari_ke_payments, VunaPOS can still use standard ERPNext Modes of Payment, but the M-Pesa STK Push and C2B flows will not be available.
STK Push
Explain the flow:
- Open Checkout.
- Select the M-Pesa payment mode.
- Choose STK Push.
- Enter the customer’s phone number.
- Click Send STK.
- Ask the customer to approve the prompt.
- Click Check.
- Confirm that the payment was received.
- Click Use Payment.
- Complete the sale.
C2B Payments
Explain the flow:
- Open Checkout.
- Select the M-Pesa payment mode.
- Choose C2B Payment.
- Search using customer name, phone number, or transaction ID.
- Select the matching payment.
- Confirm amount and status.
- Click Use Payment.
- Complete the sale.
Payment Verification
When a Mode of Payment is linked to a payment gateway, VunaPOS prevents checkout until that gateway flow is completed.
For M-Pesa, this means either:
- the STK Push completes successfully, or
- the cashier selects a valid C2B transaction
Until one of those actions is completed, the sale cannot be submitted.
A sent STK request alone is not enough. The payment must complete successfully before it can be used.
For C2B payments, the cashier must select the transaction that should be applied to the sale.
ERPNext Invoice Handling
After the M-Pesa payment is completed or selected, VunaPOS creates the required Sales Invoice or POS Invoice as normal.
The M-Pesa transaction ID is stored on the corresponding Mode of Payment row for reference.
VunaPOS does not create any additional ERPNext accounting document specifically for the gateway transaction.