Glossary

Idempotency

The property that doing the same thing twice has the same effect as doing it once.

In plain words

Pressing a lift button five times calls the lift once. That button is idempotent. A "pay" button that charges you again on every tap is not, and that is exactly what payment code must never be.

In practice

Networks repeat messages: a customer taps twice, a provider resends a callback. Make every step safe to repeat: record a unique ID for each request, check the current state before changing it ("is this payment still pending?"), lock the row while you change it, and add unique keys in the database as the last line of defence.

See Accept M-Pesa payments in Laravel.

Found this useful?

Every lesson stays free. Tap the thumbs up so we know what works, or say thanks with a soda or a coffee: it pays for hosting and new lessons.

Buy me a sodaBuy me a coffee

Want more on this?

Tell us which part was not clear, ask for a follow-up lesson, or request a lesson on any topic. We read every request.

I would like
Only to tell you when it is ready.

WhatsApp

Join the channelChat with us

Free lessons and updates in the channel. Questions about learning or training? Chat with us.