What is idempotent settlement?
Processing the same paid event twice must not deliver the goods twice or double-count revenue. Key off the gateway's reference and ignore repeats.
Gateways retry webhooks when your server is slow or returns an error, so receiving the same success event several times is normal, not a bug. Your handler must produce the same result no matter how many times it runs: one order marked paid, one fulfilment, one revenue entry.
The standard pattern is to record the gateway's transaction reference the first time you process it, and short-circuit any later event carrying the same reference. Do the check and the state change inside one database transaction to close race windows.