A retried refund with an idempotency key

A retried refund with an idempotency key A sequence diagram generated by Archify. POST /refunds, key k1 INSERT k1 IN_PROGRESS Primary key makes the reservation atomic issue refund store response, COMPLETED Same transaction as the refund 201 Created (lost) retry POST, key k1 INSERT k1 conflicts stored response 201 Created, same body No second refund First attempt Retry, same key Client · mobile app · Sequence participant Client mobile app Refund API · Spring Boot · Sequence participant Refund API Spring Boot Key table · idempotency_keys · Sequence participant Key table idempotency_keys Ledger · refunds · Sequence participant Ledger refunds Legend main request return message