A set of mock MPESA APIs designed to work exactly like the real APIs. Great for unit tests and payment system hardening
Precompiled binaries for released versions are available in the releases section of the GitHub repository. Supported OS/Arch:
- Darwin X64
- FreeBSD X64
- Linux X64
- Windows X64
Container images are available on https://quay.io/repository/ziscky/mock-pesa.
Simply: docker pull quay.io/ziscky/mock-pesa
For the docker container:
docker run -e MERCHANT_ID=1234 -e PASSKEY=4321 -p 7000:7000 --rm quay.io/ziscky/mock-pesa
For the precompiled binaries:
MERCHANT_ID=1234 PASSKEY=4321 ./mock-pesa
OR
./mock-pesa -conf=/path/to/conf
MaxAmount=70000
MinAmount=10
MaxCustomerTransactionPerDay=150000
MerchantID="12345"
CallBackDelay=0
SAGPasskey="54321"
EnabledAPIS = ["c2b"]
go get github.com/ziscky/mock-pesa
go test
go build github.com/ziscky/mock-pesa -o mock-pesa
Follow the official MPESA API guide, replace:
Endpoint: http://localhost:7000/
WSDL: https://safaricom.co.ke/mpesa_online/lnmo_checkout_server.php?wsdl
That's right, works exactly the same
For custom scenarios e.g Customer with insufficient funds
:
Endpoint: http://localhost:7000/{code}
where code is one of the official MPESA response codes,in this case: 01
Local WSDL doesn't play well with most SOAP clients
Use https://safaricom.co.ke/mpesa_online/lnmo_checkout_server.php?wsdl
I'm very open to PRs.
- Fork
- Create Branch
- Do magic
- Initiate PR