So you see the failure message?
I'm sure you can get rid of:
$nextIndex = count($AuthNet_required[0]);
$AuthNet_required[0][$nextIndex] = "x_type";
$AuthNet_required[1][$nextIndex] = "AUTH_CAPTURE";
But other than that it does look correct to me. Next I would check the session to see if you get an intelligent error message that might help you track down the problem. If you want to do a premier support ticket I could help you debug this.
try:
var_dump($WAGatewayResponse);
before the echo to see what is in the response that might be helpful to track down what is wrong.