I ever wrote similar one. It uses PHP-AGI script. So, the AGI will present the IVR, tone detection, presenting balance, process to payment gateway, and do the transfer using either agi_dial() command or set priority on dialplan. It can be used for Elastix or Trixbox. User will simply enter their card number, cvv2 code, and expired date. There will be a credit card number and expired date validation feature. Let me know as I could show you a demo.