The Idempotency-Key HTTP header field
It&#x27;s a bit funny to see an IETF draft for this!<p>Adding idempotency support to Stripe&#x27;s API was one of the things I built while an intern in 2015. We&#x27;ve since rewritten it almost entirely, but many the technical decisions made in 2015 still stand.<p>One of the things that IETF doesn&#x27;t specify (&quot;an appropriate response&quot;) is that Stripe&#x27;s Idempotency API has a response body has the latest rendering of the resource. Here&#x27;s what I mean:<p><pre><code>  # Set tax exempt status
  curl &#x2F;v1&#x2F;customers&#x2F;cus_AJ6m5vWl7scnn6 \
    -H &quot;Idempotency-Key: aaaaaaaaaa&quot; \
    -d tax_exempt=reverse

  → {id: &#x27;cus_AJ6m5vWl7scnn6&#x27;, object: &#x27;customer&#x27;, tax_exempt: &#x27;reverse&#x27;, ...}

  # An unrelated request sets the customer&#x27;s email
  curl &#x2F;v1&#x2F;customers&#x2F;cus_AJ6m5vWl7scnn6 \
    -H &quot;Idempotency-Key: bbbbbbbbbb&quot; \
    -d email=&#x27;foo@bar.com&#x27;

  → {id: &#x27;cus_AJ6m5vWl7scnn6&#x27;, object: &#x27;customer&#x27;, tax_exempt: &#x27;reverse&#x27;, email: &#x27;foo@bar.com&#x27;, ...}

  # Set tax exempt status with the first idempotency key:
  curl &#x2F;v1&#x2F;customers&#x2F;cus_AJ6m5vWl7scnn6 \
    -H &quot;Idempotency-Key: aaaaaaaaaa&quot; \
    -d tax_exempt=reverse

  # The customer is re-rendered on the latest version
  → {id: &#x27;cus_AJ6m5vWl7scnn6&#x27;, object: &#x27;customer&#x27;, tax_exempt: &#x27;reverse&#x27;, email: &#x27;foo@bar.com&#x27;, ...}</code></pre>