Payment retry can double-submit the order
The retry button remains enabled while the payment request is in flight. Disable the action and make the server command idempotent.
POST /orders Idempotency-Key: missing
AI Code Review
Decision-oriented report generated by an AI agent. Keep the first screen focused on outcome, risk and recommended next action.
The retry button remains enabled while the payment request is in flight. Disable the action and make the server command idempotent.
POST /orders Idempotency-Key: missing
Use line classes when a report includes a diff so additions, removals and hunk headers remain scannable in long code blocks.
diff --git a/src/checkout.php b/src/checkout.php
@@ -12,7 +12,8 @@ final class Checkout
public function submit(Order $order): Response
- return $this->gateway->charge($order);
+ $this->guard->preventDuplicateSubmit($order);
+ return $this->gateway->charge($order);
}
Add a language class to plain code blocks. The report kit script applies syntax colors without loading third-party assets.
async function submitOrder(order) {
if (!order.idempotencyKey) {
throw new Error("Missing idempotency key");
}
return gateway.charge(order);
}
The current message says only that payment failed. Add clear copy for retrying or switching payment method.
Required fields are checked before submit and repeated in the command handler.