Created
May 17, 2016 11:41
-
-
Save neo22s/0aa16b50cbd94cd6ada3c94f75c748ee to your computer and use it in GitHub Desktop.
securepay.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$merchant_id = 'merchant'; | |
$txnpassword = 'pwd'; | |
$order_id = 'order123'; | |
$amount = 5308;//53.2 | |
$currency = 'AUD'; | |
$fp_timestamp = gmdate('YmdHIis'); | |
$fingerprint = $merchant_id.'|'.$txnpassword.'|0|'.$order_id.'|'.$amount.'|'.$fp_timestamp; | |
$fingerprint = sha1($fingerprint);//SHA1 ABC0010|txnpassword|0|ORDER_ID|5320|201106141010 | |
if ($_POST) | |
{ | |
$fingerprint = $merchant_id.'|'.$txnpassword.'|'.$order_id.'|'.$amount.'|'.$_POST['timestamp'].'|'.$_POST['summarycode']; | |
$fingerprint = sha1($fingerprint);//ABC0010|mytxnpasswd|MyReference|1000|201105231545|1 | |
if ($_POST['summarycode'] == 1 AND $_POST['fingerprint']==$fingerprint AND $_POST['amount']==$amount) | |
{ | |
die('paid!'.$_POST['txnid']); | |
} | |
else | |
die($_POST['restext']); | |
} | |
else | |
{ | |
?> | |
<form method="post" action="https://payment.securepay.com.au/test/v2/invoice"> | |
<input type="hidden" name="display_receipt" value="no"> | |
<input type="hidden" name="bill_name" value="transact"> | |
<input type="hidden" name="merchant_id" value="<?=$merchant_id?>"> | |
<input type="hidden" name="primary_ref" value="<?=$order_id?>"> | |
<input type="hidden" name="txn_type" value="0"> | |
<input type="hidden" name="amount" value="<?=$amount?>"> | |
<input type="hidden" name="currency" value="<?=$currency?>"> | |
<input type="hidden" name="fp_timestamp" value="<?=$fp_timestamp?>"> | |
<input type="hidden" name="fingerprint" value="<?=$fingerprint?>"> | |
<input type="hidden" name="callback_url" value="http://test.chema.ga/securepay.php"> | |
<input type="hidden" name="return_url_target" value="parent"> | |
<input type="hidden" name="return_url" value="http://test.chema.ga/securepay.php"> | |
<input type="hidden" name="page_header_image" value="http://domain.com/thumb_just-random-title-here-3_1.jpg"> | |
<input type="hidden" name="title" value="Pay ORDER_ID"> | |
<input type="hidden" name="primary_ref_name" value="description order"> | |
<input type="submit" value="Pay now"> | |
</form> | |
<? | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment