Code Room
Code reviewHardcr-g138
Subject Api designLevel Senior–Staff~25 minCommon in Networking & APIs interviewsIndustries Software development

Question

Review this Python payment-charge endpoint.

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('/v1/charges', methods=['POST'])def create_charge():    body = request.get_json()    amount = body['amount']    card = body['card_token']     charge = gateway.charge(card, amount)   # calls external processor    db.charges.insert({'id': charge.id,                       'amount': amount,                       'status': charge.status})    return jsonify({'id': charge.id}), 201
Run or narrate your approach, then ask the coach.