Idempotent API design
Our payout service occasionally paid a lender twice, about 30 times a month. I designed client-supplied idempotency keys, wrote the migration for two years of payout records and rolled it out behind a flag. Duplicates went to zero the next quarter.
github.com/amorgan/payout-keys-notes