Code Room
Code reviewMediumcr-g107
Subject IdempotencyLevel Mid–Senior~25 minCommon in Networking & APIs interviewsIndustries Software development

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.

Talk through your review
Code to reviewpython
@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 "", 200
Run or narrate your approach, then ask the coach.