Lesson G6 · Build your own gateway
Review and harden
By the end of this track you can write a small service that charges, stores every event and notifies your app.
● Sandbox only2 steps + checkpoint
0/6 finished
Step 1
The idea
Run the kit's check_integration.py on your code and fix every high finding. Then walk the failure table in Payment design: cancel, no answer, wrong PIN, duplicate, missing callback, short payment.
Step 2
How it works
Walk the failure table
For each case, say what your gateway does and show it in the sandbox: the customer cancels, never answers, types a wrong PIN; a duplicate callback; a missing callback; a short payment.
Before real money
- A payout path with idempotency keys (P1, P2).
- Daily reconciliation (D3).
- Alerts when payments stay accepted or unknown too long.
- Production secrets in a secret store.
Sandbox noteStill missing before real money: a payout path with idempotency keys, reconciliation, alerts, and production secrets in a secret store.
Go deeper
Without notes: how does your gateway avoid marking a cancelled payment as paid, or crediting a duplicate callback?
Answer in your own words first.
Show the answerHide the answer
It only marks paid on a success callback or STK Query result with the right amount, and it ignores any callback for a row that is already final.