M-Pesa Integration
Use integrated M-Pesa checkout when your site can verify the provider's payment before completing the sale. A manually configured payment method called M-Pesa is not automatically an STK/C2B integration.
Before using the integration
Ask the administrator to configure the supported payment connector, its gateway account, company/currency and provider credentials/callbacks. Current deployments use Vuna Payments; older configuration and some messages use the name navari_ke_payments. The connector must provide the site's payment-request and C2B-register functionality.
Link the appropriate Payment Gateway Account on the relevant payment row in the POS Profile. A company ledger account on Mode of Payment is also required. Test provider confirmation before giving cashiers access.
Without a connector you can still record a manual M-Pesa payment according to your business's verification procedure, but VunaPOS cannot send STK prompts or search provider transactions for that manual row.
Collect an STK payment
- Open checkout and select the gateway-linked M-Pesa payment method.
- Allocate the intended amount to that payment method. Check the total before sending a prompt.
- Open STK Push, confirm the customer's phone number and select Send STK.
- Ask the customer to approve the prompt on their phone.
- Wait for the payment status to update. Use the status-check action if it remains pending.
- Use the verified payment in checkout, then complete the sale.
Sending the prompt is not proof of payment. A pending, failed or expired request must not be recorded as a successful gateway payment. Keep the same checkout open while checking a delayed result; do not send another prompt just because a response is slow.
The customer-facing reference uses the available invoice/order reference, rather than a retry key. Where no document reference is available, a VUNAPOS label may be used.
Use an existing C2B payment
- Select C2B Payment in the gateway dialog.
- Search for the provider transaction using the available phone/reference information.
- Confirm that the transaction, amount and currency match the customer and this sale.
- Select/attach the matching payment and use it in checkout.
- Complete the sale after successful verification.
A transaction already consumed, reconciled or reserved for another checkout cannot simply be attached again. A match in search is not permission to use somebody else's payment.
If the customer paid but checkout failed
Check the payment status and the invoice/order result before taking more money. Keep the transaction reference and ask the cashier/accounts lead to investigate an already-used or unavailable payment. Cancelling a payment selection or allowing it to expire is not a refund from the provider.
For sale checkout, the verified reference is attached to the invoice payment. Receiving money through the separate Payments page creates an ERPNext Payment Entry; see Receiving and Reconciling Payments.
[Video: Sending an STK prompt, waiting for provider confirmation and completing checkout without sending a second prompt]
[Screenshot: C2B lookup showing a matching amount, transaction reference and payment status]