Clean "add_payment" to be simpler : don't need to declare $payment in the main as it used only to add to an existing array Fix "edit_payment" that was trying to set a payment on the $payment_id (expected payment data : $payments)