Code Room
Code reviewMedium
Question
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.
Learn the concepts
@app.route("/webhook", methods=["POST"])def webhook(): event = json.loads(request.data) etype = event["type"] if etype == "invoice.paid": data = event["data"] credit_account(data["customer"], data["amount"]) elif etype == "invoice.payment_failed": flag_dunning(event["data"]["customer"]) return "", 200Run or narrate your approach, then ask the coach.