Jump to content

Thirdparty API call is failing within payment gateway callback file


kobopulse

Recommended Posts

I had successfully set up and integrated a third party payment integration system for a client on WHMCS. Inorder to Validate callback authenticity, the gateway provides a method of verifying that a callback

originated from them as shown in code below:

 

$mertid ='secretmerchantID';
$amt = '10000';
$tranxid = 'gtPay130958397220820';
$hashkey ='secretclientkey';

$hash =  hash('sha512', $mertid . $tranxid . $hashkey);

$url = 'https://ibank.gtbank.com/GTPayService/gettransactionstatus.xml?mertid='.$mertid.'&amount='.$amt.'&tranxid='.$tranxid.'&hash='.$hash;


$xmlString = file_get_contents($url);
if($xmlString === false)
{
echo "Response Description: GTPAY Verification service failed to open. 
       Please wait as the page reloads  in 5 seconds";
}
else
{
$xml = simplexml_load_string($xmlString );

var_dump($xml);
}

 

 

I am using the file_get_contents function to read the API response into a string, then simplexml_load_string function to Interprets the string of XML into an object with properties containing the data held within the xml string. On each successful transaction run $xml=simplexml_load_string($jString), returns FALSE.

 

However when I call this code in a file directly in a browser using the same transaction values, then $xml=simplexml_load_string($jString), returns the string of XML into an object as expected.

 

Strangely, when I place this code in a file within WHMCS root folder and I attempt to call directly in a browser using the same successful transaction values, then $xml=simplexml_load_string($jString), returns FALSE again.

 

What may be restricting this call to Third party API call within the WHMCS install?

 

Thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated