Payments

Concurrent partial refunds exceed capture

Why it happens

Two workers calculate refundable amount from the same snapshot.

Potential bug

Total refunded exceeds the captured amount.

Mitigation

Lock the aggregate or atomically decrement available refundable amount; include pending refunds.

See it in context