BookatlasTwo-Day MuleSoft → Salesforce Bootcamp
172 / 278 · Module 12 — Idempotency and Duplicate Prevention · filtered: code← prev⊞ allnext →

12.6Idempotency key

Sometimes the operation itself doesn't naturally have a stable entity key.

Example:

POST /payments

Payload:

{
  "customerId": "C001",
  "amount": 100
}

You cannot say:

customerId = idempotency key

because the customer can legitimately make multiple $100 payments.

Instead caller may send:

Idempotency-Key: PAY-817263

Then Mule records:

PAY-817263 already processed?

If no:

perform payment
store result

If yes:

return previous result
do not charge again