Implementing Transactional API Idempotency With Node.js and PostgreSQL
With idempotency keys in Redis, a crash can still charge twice. Keep the key in the same Postgres transaction as the write (Node.js) so a crash rolls back both.
We haven't written up this one. HackerNoon has the full story — the link below goes straight to it.
Source: hackernoon.com