am trying to connect with filspay API directpay method, they request to send the parameters through GET REQUEST to their server and add our IP to their white list so we can contact the payment server.
The querystring look like https://api.filspay.com/Default.aspx?trxRefNumber=[String]&PinId=[Integer]&Amount=[Double]&Description=[String]&hashCode=[String]&MerchantId=[Integer]
Our first file code is :
<?php
function generateRandomString($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, strlen($characters) - 1)];
}
return $randomString;
}
$amount = 1;
$amount = stripslashes($amount);
$amount = strip_tags($amount);
$amount = htmlentities($amount, ENT_QUOTES, 'UTF-8');
$hashCode = md5(md5('e643d9b6-bcfc-47').'001'.'670127'.'35422'.'35.00'.'49f25465b6c62aa15f88d5e1ae179011cb8ee70e');
$trxRefNumber = generateRandomString (20) ;
$merchantid = '670127';
$pinid = '35422';
?>
<form action="filspay2.php" method="POST" name="filspay_send">
<input type="hidden" name="trxRefNumber" value="<?php echo $trxRefNumber; ?>">
PinID : <input type="text" name="PinId" value="<? echo $pinid; ?>"> <br>
<input type="hidden" name="amount" value="<?php echo $amount; ?>">
<input type="hidden" name="Description" value="sdaf adf sd">
<input type="hidden" name="hashCode" value="<?php echo $hashCode; ?>">
<input type="hidden" name="MerchantId" value="<?php echo $merchantid; ?>">
<br>
<input type="submit" name="pay" value="pay">
</form>
while second file which contact their server is
<?php
$r = new HttpRequest('https://api.filspay.com/Default.aspx', HttpRequest::METH_POST);
$r->addPostFields(array('trxRefNumber' => $_Post['trxRefNumber']));
$r->addPostFields(array('PinId' => $_Post['PinId']));
$r->addPostFields(array('amount' => $_Post['amount']));
$r->addPostFields(array('Description' => $_Post['Description']));
$r->addPostFields(array('hashCode' => $_Post['hashCode']));
$r->addPostFields(array('MerchantId' => $_Post['MerchantId']));
try {
echo $r->send()->getBody();
} catch (HttpException $ex) {
echo $ex;
}
But am still getting this error : Server Error
403 - Forbidden: Access is denied. You do not have permission to view this directory or page using the credentials that you supplied.
I confirm that they add our IP address to their white list.