payments/retry.pyLocal change
def retry_charge(order):
return gateway.charge(
amount=order.total,
customer=order.customer_id
# no stable retry key
)
The failure path
The gateway creates the charge, but its response times out.
Retrying without the original key could create a second
charge.
Requirement
PAY-184: retry a payment request without creating a
duplicate charge.
Finding
The gateway call has no stable idempotency key tying the
retry to the original payment attempt.
Fix direction
Pass the original attempt's key on every retry. Use a new
key only for a new payment attempt.
Verify
Test response timeouts and duplicate requests against the
gateway's actual idempotency contract.