M-Pesa gateway
- Customer
- STK Push
- Daraja API
- Your server
- Callback
- Paid
Auth tokens, STK Push, callbacks, reconciliation and going live.
Live on Zoom · starts 25 Nov 2026 · 2 weeks, daily
Learn to build the payment rails behind real products: M-Pesa STK Push with Daraja, crypto checkout with wallets and smart contracts, and Web3 apps you can ship.
No coding experience needed. We start from zero.
POST /mpesa/stkpush/v1/processrequest
{ "Amount": 2000, "PhoneNumber": "2547…" }
→ ResponseCode: 0 (prompt sent)
CALLBACK ResultCode: 0
✓ MpesaReceiptNumber: QK7…
WEB3 wallet.sendTransaction({ to, value })
✓ confirmed · webhook firedAuth tokens, STK Push, callbacks, reconciliation and going live.
Wallet connect, BTC/ETH/USDT payments, confirmations and Web3 app integration.
Every class is live and you get the recording afterwards. Tap a day to see what you will learn and a sample of the code. You do not need to understand the code yet: we explain every line from scratch.
Actors, money flow and architecture of a gateway. Set up your dev environment and project.
Create a Daraja app, use the sandbox, and fetch OAuth access tokens.
$r = http($base . '/oauth/v1/generate?grant_type=client_credentials', ['Authorization: Basic ' . base64_encode($key . ':' . $secret)]); $token = $r['access_token'];
Build the request, password and timestamp, and trigger the PIN prompt on a phone.
$ts = date('YmdHis');
$body = [
'BusinessShortCode' => $shortcode,
'Password' => base64_encode($shortcode . $passkey . $ts),
'Timestamp' => $ts,
'TransactionType' => 'CustomerPayBillOnline',
'Amount' => 2000, 'PartyA' => $phone, 'PartyB' => $shortcode,
'PhoneNumber' => $phone, 'CallBackURL' => $callbackUrl,
'AccountReference' => 'ORDER42', 'TransactionDesc' => 'Payment',
];Receive Safaricom callbacks, store receipts and update order status.
$cb = json_decode(file_get_contents('php://input'), true)['Body']['stkCallback'];
if ($cb['ResultCode'] === 0) {
// mark the order as paid and store the M-Pesa receipt
}
echo '{"ResultCode":0,"ResultDesc":"Accepted"}';Query transaction status, handle timeouts and cancellations, and avoid double charges.
Callback secrets, validation, logging and the Go Live checklist.
Build and deploy a working checkout page that collects money by STK Push.
Wallets, networks, gas fees and testnets. How a crypto payment is confirmed.
Create orders, show payment details and wait for confirmations.
Write and deploy a simple payment contract that emits an event for every payment.
event Paid(address indexed payer, uint256 orderId, uint256 amount);
function pay(uint256 orderId) external payable {
require(msg.value > 0, "No payment");
emit Paid(msg.sender, orderId, msg.value);
}Connect a wallet and send a payment from your web app with ethers.js.
const provider = new ethers.BrowserProvider(window.ethereum);
const signer = await provider.getSigner();
const tx = await signer.sendTransaction({
to: SHOP_ADDRESS, value: ethers.parseEther("0.01")
});
await tx.wait(); // payment confirmed on-chainWatch blockchain events and match each payment to the right order.
contract.on("Paid", (payer, orderId, amount) => {
markOrderPaid(orderId, payer, amount); // match on-chain payment to your order
});Combine M-Pesa and crypto, then handle refunds and reconciliation.
Demo your gateway, deploy it and get feedback.
Times and topics may be adjusted slightly by your instructor. Class time will be shared in the WhatsApp group.
Set up wallets, send and receive crypto safely, and avoid common scams.
What Web3 is, how NFTs work and how people earn in this space.
How blockchains, blocks and transactions work, explained without jargon.
Use AI tools to write, research and automate everyday work.
Create a chatbot that answers customer questions and takes orders.
Lending, swaps and stablecoins: how decentralized finance really works.
Build AI assistants that handle customer support, reports and reminders for a financial business.
Create your own token and a simple wallet interface on a test network.
See how AI spots suspicious transactions and scores risk, with hands-on examples.
Learn the common mistakes behind crypto hacks and how to avoid them.
Send and receive money across borders with stablecoins and build a simple demo.
Combine AI and blockchain to build smarter decentralized apps.
Want first access to new classes? Message us on WhatsApp and we will add you to the list.