I have a pop up payment gateway which I have a public push back url to know the success data from the bank.
mysite.com/push_back
// push back url gave to bank in order to send back data
function push_back() {
$content = file_get_contents("php://input");
$obj = json_decode($content);
$tran_id = $obj->tran_id;
$status = $obj->status;
//insert into db successfully
//redirect code is not working. eg: header("Location: http://example.com/myOtherPage.php");
}
Note: I created a push back link and provide to bank which its running in background to send the data for me.
HTML FORM
<!— Modal content —>
<div class="modal-content">
<form method="POST" target="webservice" action="payment-gateway-url" id="merchant_request">
<input type="hidden" name="hash" value="asdfxc123sfd" id="hash"/>
<input type="hidden" name="tran_id" value="123" id="tran_id"/>
</form>
</div>
<input type="button" value="confirm" id="button-confirm" class="btn btn-primary" />
<script type="text/javascript">
$(document).on('click', '#button-confirm', function() {
PaymentGateway.checkout();
});
</script>
I have successfully got the push back data from the payment gateway. However, I cant write the execute redirect script it to another page. It seems like the code doesn't execute. I have tried to search google, but I haven't found the right solution.