Hello, community !
We are excited to announce the release of our new M-pesa adaptor
With it, you can trigger STK push prompts, register listener URLs for payment notifications, remit taxes to the Kenya Revenue Authority, and purchase goods and services. We’ve also included a versatile HTTP helper function for additional use cases.
Check out the adaptor docs: m-pesa docs
Here are some examples of what you can do with the current version:
1. Initiate a STK push prompt to a Safaricom mobile number.
stkPush({
"Amount": 1,
"PartyA": 254708374149,
"PartyB": 174379,
"PhoneNumber": 254708374149,
"CallBackURL": "https://mydomain.com/path",
"AccountReference": "CompanyXLTD",
"TransactionDesc": "Payment of X"
});
2. Pay for goods and services directly from your business account to a till number.
buyGoods({
"Initiator": "testapi",
"SecurityCredential": "sbMXpuhMX5LzieNiDrx",
"Amount": 1,
"PartyA": 600999,
"PartyB": 600000,
"AccountReference": 353353,
"Requester": 254708374149,
"Remarks": "ok",
"QueueTimeOutURL": "https://mydomain.com/b2b/queue/",
"ResultURL": "https://mydomain.com/b2b/result/"
});
3. Check the status of a transaction.
checkTransactionStatus({
"Initiator": "testapi",
"SecurityCredential": "ctHDk+dN14A22B5GyQQvI",
"TransactionID": "OEI2AK4Q16",
"PartyA": 600998,
"IdentifierType": 4,
"ResultURL": "https://mydomain.com/TransactionStatus/result/",
"QueueTimeOutURL": "https://mydomain.com/TransactionStatus/queue/",
"Remarks": "fdfdfdfdf",
"Occassion": "null",
});
4. Remit taxes to the Kenya Revenue Authority.
remitTax({
"Initiator": "testapi",
"SecurityCredential": "Uq1qluCjSYfMF3XEvlpfuatnW",
"Amount": 1,
"PartyA": 600995,
"AccountReference": 353353,
"Remarks": "ok",
"QueueTimeOutURL": "https://mydomain.com/b2b/queue/",
"ResultURL": "https://mydomain.com/b2b/result/"
})
5. Register a URL to receive payment notifications.
registerUrl({
"ShortCode": 600426,
"ResponseType": "Completed",
"ConfirmationURL": "https://mydomain.com/confirmation",
"ValidationURL": "https://mydomain.com/validation"
});
6. Use the HTTP helper to register a URL
request("POST", "/mpesa/c2b/v1/registerurl",
{
"ShortCode": 600426,
"ResponseType": "Completed",
"ConfirmationURL": "https://mydomain.com/confirmation",
"ValidationURL": "https://mydomain.com/validation"
});
Feel free to try this out on on your own project or at demo.openfn.org .