Compensating Action
A compensating action is a new operation that corrects the business effect of an earlier committed operation when that operation cannot simply be rolled back. In payment processing, if a capture arrives after an order has already been cancelled because of a failure event, the backend issues a refund through the provider and ensures that the refund happens only once.
Minimal example
INSERT INTO payment_refunds (payment_id, status)
VALUES (?, 'PENDING')
ON DUPLICATE KEY UPDATE payment_id = payment_id;