def pay(db, order_id, amount): charge_card(amount) db.execute("UPDATE orders SET paid = true WHERE id = %s", (order_id,)) db.commit()