I have been integrating a payment gateway in Cakephp. Below are the versions used:
Cakephp: 3.4.13
PHP: 5.6.15
Problem:
I need to submit a form using POST request to payment gateway website but some fields contains confidential data(merchant id etc) so I cannot show them in the form. Otherwise someone can read them using developer tools(inspecting element). Also I need to add some custom fields before submit the form.
So I would like to redirect the user to payment gateway website with required fields using POST request from the Controller's action.
I tried to find solution but couldn't succeeded. Found a similar question here but there is no answer. Is there any way to do the same in Cakephp 3.x?
Payment gateway form:
<?= $this->Form->create(false, ['url' => <URL>, 'id'=>'payForm']) ?>
<?= $this->Form->hidden('payment_notification_url', ['value'=> $this->Url->build('/payment/notify', true)]); ?>
<?= $this->Form->hidden('payment_redirect_url', ['value'=>$this->Url->build('/payment/getMoney', true)]); ?>
<?= $this->Form->hidden('merchant_id', ['value'=> <merchant_id>]); ?>
<?= $this->Form->hidden('reference', ['value'=> <reference>]); ?>
<?= $this->Form->hidden('email', ['value'=> <email>]); ?>
<?= $this->Form->hidden('fname', ['value'=> <first_name>]); ?>
<?= $this->Form->hidden('lname', ['value'=> <last_name>]); ?>
<?= $this->Form->hidden('address', ['value'=> <address>]); ?>
<?= $this->Form->hidden('town', ['value'=> <state>]); ?>
<?= $this->Form->hidden('country', ['value'=> <country>]); ?>
<?= $this->Form->hidden('postcode', ['value'=> <zipcode>]); ?>
<?= $this->Form->hidden('amount', ['class' => 'amount', 'value'=> <amount>]); ?>
<?= $this->Form->hidden('currency', ['value'=> 'US']); ?>
<?php echo $this->Form->end() ?>