Given a situation where a developer must design an API that processes payment transactions, which of the following approaches BEST ensures that the API handles repeated submissions of the same transaction in an idempotent manner?
Generate random transaction IDs for each submission and use these IDs to detect duplicates.
Use a stateless protocol that does not require server-side tracking of transaction states.
Implement idempotent receipt tokens that must be submitted with each transaction.
Store the state of each transaction in a database with enforced write locks to prevent concurrent writes.