api-design.hardAPI-DESIGN click a line to flag it1@PostMapping("/api/payments")
2public PaymentResponse charge(@RequestBody ChargeRequest req) {
3 Payment payment = paymentService.charge(
4 req.getCustomerId(),
5 req.getAmountCents()
6 );
7 return PaymentResponse.from(payment);
8}
no lines flagged
#113PracticeHard20 min · 200 XP
Payment Endpoint Has No Idempotency Key
Customers are occasionally charged twice for a single checkout, always when the network was slow and the client retried.
Flagged linesNo lines flagged yet
Flag a line or write a note to submit.