User Guide: Multi-Gateway Setup & Virtual Payment Simulator
This guide covers how to set up payment gateways (Razorpay, Stripe, Square, PayPal, M-Pesa, UPI QR) and how cashiers use the Virtual Payment Simulatorduring POS checkout to test or simulate digital transactions without physical card machines.
Table of Contents
- Overview of Supported Payment Methods
- Configuring Payment Gateways
- Using the Virtual Payment Simulator in POS Billing
- Settlement Modes: Direct vs. Hold
- Troubleshooting & Payment FAQ
1. Overview of Supported Payment Methods
Your POS terminal supports omnichannel payments configured per outlet:
| Gateway / Method | Supported Regions | Features |
|---|---|---|
| UPI Dynamic QR | India | Instant zero-fee QR code printed on invoice or displayed on customer-facing screen. |
| Razorpay | India / Global | Credit/Debit Cards, Netbanking, UPI, Wallets, and Auto-Refunds. |
| Stripe | US / EU / Global | Credit/Debit Cards, Apple Pay, Google Pay, SEPA. |
| Square POS | US / CA / UK / AU | Square Terminal hardware sync, tap-to-pay, chip cards. |
| PayPal | Global | Web checkout, international card payments. |
| Safaricom M-Pesa | Kenya / East Africa | Direct STK Push to customer's mobile phone and C2B Till verification. |
| Bank Transfer / Cash | Global | Cash drawer settlement and direct bank reference logging. |
2. Configuring Payment Gateways
To configure payment gateways for your store:
- Open Settings$\rightarrow$ Payment Gateways (
payment_gateways_screen.dart). - You will see tabs for each supported gateway:
- UPI / Dynamic QR:
- Enter your UPI ID / VPA (e.g.
merchant@okhdfcbank). - Enter your registered Payee Legal Name (e.g.
Retail Store Private Limited). - Toggle Print Dynamic QR on InvoicesON.
- Enter your UPI ID / VPA (e.g.
- Razorpay:
- Toggle Enable RazorpayON.
- Select Environment: **Test Mode (Sandbox)**or Live / Production.
- Enter Key ID (e.g.
rzp_test_...orrzp_live_...). - Enter Key Secret.
- Stripe:
- Toggle Enable StripeON.
- Select Environment (Testor Live).
- Enter Publishable Key (
pk_test_...orpk_live_...). - Enter Secret Key (
sk_test_...orsk_live_...).
- Square:
- Enter Application ID, Location ID, and OAuth Access Token.
- M-Pesa (Kenya):
- Select Type: Till Numberor Paybill.
- Enter Shortcode, Consumer Key, Consumer Secret, and Lipa Na M-Pesa Passkey.
- UPI / Dynamic QR:
- Click Save Gateway Configuration.
3. Using the Virtual Payment Simulator in POS Billing
The Virtual Payment Simulator (virtual_payment_simulator_dialog.dart) allows cashiers to test, demo, or simulate digital card and UPI transactions when training staff, testing POS workflows, or when internet card terminals are offline.
Step-by-Step Checkout Flow:
- Ring up items on the POS Billing Screen (
salescreen.dart). - Tap Pay / Checkout.
- In the payment methods bar, click Card, UPI, or Simulate Digital Pay:
- The Virtual Payment Simulatormodal pops up:
- Dynamic QR Code Tab:
- Displays a live generated QR code embedded with merchant UPI/bill details and total payable amount.
- Click Simulate Customer Scan & Payto simulate a successful mobile payment callback.
- Credit / Debit Card Tab:
- Shows a virtual terminal interface.
- Choose Card Type: Visa, MasterCard, RuPay, or Amex.
- Click Simulate Card Tap / Chip Insert.
- You can simulate Approved (with simulated Auth Code & RRN) or test Decline / Insufficient Fundsresponses.
- M-Pesa STK Push Tab:
- Enter the customer's phone number (
2547XXXXXXXX). - Click Send STK Push.
- Watch live status polling until the customer enters their PIN.
- Enter the customer's phone number (
- Dynamic QR Code Tab:
- Once approved, the dialog returns a verified
VirtualPaymentResultcontaining:referenceId(e.g.TXN_984729184)authCode(e.g.AUTH8921)rrn(Retrieval Reference Number)cardBrand&last4
- The POS invoice automatically records the transaction reference, prints the receipt, and deducts the inventory.
4. Settlement Modes: Direct vs. Hold
In Payment Settings, you can choose between two restaurant/retail settlement modes:
- DIRECT Settlement: Payments immediately close the order, deduct stock, and record the invoice into the accounting ledger.
- HOLD / Pre-Auth Mode: Card pre-authorizations place a temporary hold on the customer's card (common in bar tabs and fine dining). The bill can be adjusted with tips or extra drinks before final settlement.
5. Troubleshooting & Payment FAQ
Q1: Can I run POS billing in Test Mode without real bank credentials?
**Yes.**Keep gateways in Test / Sandboxmode or use the Virtual Payment Simulator. The simulator generates realistic approval codes and test receipts without debiting real bank accounts.
Q2: What happens if a customer card transaction fails?
The simulator and live gateways show an instant red alert with the bank reason code (e.g., Declined: Insufficient Funds, Expired Card, or Network Timeout). The POS order remains on hold, allowing the cashier to retry or switch to cash.
Q3: Where can I see payment reference numbers for accounting reconciliation?
Open Reports$\rightarrow$ Cash & Payment Ledgeror Daily Shift Summary. Every digital payment lists its Gateway Name, Transaction ID, RRN, and timestamp.