Reputation: 305
I am integrating secure pay direct post with my website. Below is the form I have used in the main (index.php) page. The form requires many different parameters to be passed as HIDDEN fields as shown below.
One of the hidden field used is 'EPS_RESULTURL' where the result is redirect to after both APPROVED or DECLINED transactions.
Index.php
<form name="input" action="https://api.securepay.com.au/test/directpost/authorise" method="post">
<input type="hidden" name="EPS_MERCHANT" value="<?php echo $EPS_MERCHANTID;?>">
<input type="hidden" name="EPS_TXNTYPE" value="<?php echo $EPS_TXNTYPE;?>">
<input type="hidden" name="EPS_REFERENCEID" value="<?php echo $EPS_REFERENCEID;?>">
<input type="hidden" name="EPS_AMOUNT" value="<?php echo $EPS_AMOUNT;?>">
<input type="hidden" name="EPS_TIMESTAMP" value="<?php echo $EPS_TIMESTAMP;?>">
<input type="hidden" name="EPS_FINGERPRINT" value="<?php echo $fingerprint;?>">
<input type="hidden" name="EPS_RESULTURL" value="http:://www.mydomain.com/result.php"/>
<input type="text" name="EPS_CARDNUMBER" id="EPS_CARDNUMBER" placeholder="card number" class="cardnumber"/>
<input type="text" name="EPS_EXPIRYMONTH" id="EPS_EXPIRYMONTH" placeholder="mm" class="month"/>
<input type="text" name="EPS_EXPIRYYEAR" id="EPS_EXPIRYYEAR" placeholder="yyyy" class="year"/>
<input type="text" name="EPS_CCV" id="EPS_CCV" placeholder="cvv"/>
<input type="submit" name="submit" id="submit" class="submitBtn">
</form>
result.php
<?php
print_r($_POST);
?>
For Approved Transaction:
The URL is redirected to result.php and hence prints the POST data received from the server. However, in the browser the URL is still
https://api.securepay.com.au/test/directpost/authorise.
I wish somehow I could stay in my own site www.mydomain.com instead of redirecting to https://api.securepay.com.au/test/directpost/authorise
Thanks.
Upvotes: 0
Views: 1423
Reputation: 587
I know this is very old, but for anyone want to avoid this , SecurePay now has EPS_REDIRECT
to change this behaviour
<input type="hidden" name="EPS_REDIRECT" value="TRUE"/>
will move to your page , with result parameters as a GET
Upvotes: 1
Reputation: 1400
Change result.php
to:
<?php
header("location:yoururl.php");
exit();
?>
And it will redirect you where you want to be. Generally speaking, results.php
is where you want to pick that $_POST
data, parse it and do something with it, redirecting the user afterwards. Even more generally speaking, results.php
is where you will do some magic and shoot the user over to thanksforpaying.php
.
Hope that helped.
Upvotes: 0