Search code examples
phpformspostgateway

Cut "Array" from post information


following issue, we just started to develop a payment gateway and unfortunately the documentation of the targeted api is almost not existent and the support of the bank is also awful.

In the documentation, under Message Format AUTHORIZATION REQUEST, we find this example:

mid=12345&terminal=1234&version=3.1&command=CRAUTH&ref_no=3421_14120348_14120348&ref_date=20141203061048&service_id=11&cust_id=1&cur_abbr=THB&amount=300.00&backURL=https://www.yourshopreturnurl.com/

So we have created the gateway (WooCommerce) and used this form to pass our array value:

$scb_args_array = array();
            foreach($ccavenue_args as $param => $value) { $scb_args_array[] = "$param=$value"; }
$paramsJoinedNew = implode('&', $scb_args_array); 

            return '<form action="'.$live_url.'" method="post" id="ewire_payment_form">
                    <input type="hidden" name="bank_Values" value="'. $paramsJoinedNew .'" />
                    <input type="submit" class="button-alt" id="submit_ewire_payment_form" value="'.__('Pay via bank', 'woothemes').'" /> <a class="button cancel" href="'.$order->get_cancel_order_url().'">'.__('Cancel order &amp; restore cart', 'woothemes').'</a>
                    </form>';}    

The result of this form is:

Array ( [bank_Values] => mid=12345&terminal=1234&version=3.1&command=CRAUTH&ref_no=3421_14120348_14120348&ref_date=20141203061048&service_id=11&cust_id=1&cur_abbr=THB&amount=300.00&backURL=https://www.yourshopreturnurl.com/  )    

Submitting this to the bank, results in a blank page of the bank without any debug information.

We assume that ARRAY ( [bank_Values] => is the problem, is there any way to strip that part out of the post information, so it only sends the raw value as in their example?

Also maybe someone has another idea what could solve the problem.

Thank you for your help!


Solution

  • If you want to send raw data then for every data create a separate input field like below

      <input type="hidden" name="mid" value="12345" />
      <input type="hidden" name="version" value="3.1" />