Webhook handler lacks idempotency key
Review this Python Stripe-style webhook handler.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.
0:00 of about 25 min
Mark a line and say what kind of problem it is.0 findings
1@app.route("/webhook", methods=["POST"])
2def webhook():
3 event = json.loads(request.data)
4 etype = event["type"]
5 if etype == "invoice.paid":
6 data = event["data"]
7 credit_account(data["customer"], data["amount"])
8 elif etype == "invoice.payment_failed":
9 flag_dunning(event["data"]["customer"])
10 return "", 200
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.
Run or narrate your approach, then ask the coach.