Modularize frontPayment() function in front_payment.php script to allow use with api.