Code Room
Code reviewHard
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.
Learn the concepts
@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}), 201Run or narrate your approach, then ask the coach.