Jump to content

terungwa

Member
  • Posts

    3
  • Joined

  • Last visited

Everything posted by terungwa

  1. I wish to be able to redirect to a custom page following the failure in payment as returned by payment gateway. To this end, I am using the ShoppingCartCheckoutCompletePage hook to check this using the variable $vars['ispaid']. When payment is successful, $vars['ispaid'] is true and the redirect to the thankyou page works. add_hook('ShoppingCartCheckoutCompletePage', 1, function ($vars) { # Will be true if the order has been paid if($vars['ispaid'] == true) { #redirect to thank you page header('location:'.thankYouPage); die; } else { header('location:'.transactionFailedPage); die; } } However the else statement is not executing when payment obviously fails, rather the viewinvoice.php page is loaded and payment status set to 'unpaid' Am I missing something? How can I redirect to the transaction failed page? Thanks.
  2. I have reviewed the responses in relation to this question I am asking here but, none successfully addresses this issue I am using the Get Clients Details API to retrieve some data held about a client in the WHMCS System for a given ID via a hook to be called each time a client logs into the backend. This is my code: function hook_obtain_client_details_on_login($params) { $url = "http://bemastech.com/store/includes/api.php"; $userid = $params['userid']; $postfields["action"] = "getclientsdetails"; $postfields["clientid"] = "{$userid}"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 100); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $data = curl_exec($ch); curl_close($ch); $data = explode(";", $data); foreach ($data as $temp) { $temp = explode("=", $temp); $results[$temp[0]] = $temp[1]; } if ($results["result"] == "success") { $_SESSION['email'] = $results["email"]; $_SESSION['phonenumber'] = $results["phonenumber"]; $_SESSION['userid'] = $results["userid"]; } else { die("An error occured. Please contact support. ({$results['message']})"); } } add_hook("ClientLogin",1,"hook_obtain_client_details_on_login",""); But, on login, this error is thrown up from my script: array(3) { [0]=> string(12) "result=error" [1]=> string(29) "message=Authentication Failed" [2]=> string(0) "" } My IP Address has been allowed to connect to the WHMCS API. I am using WHMCS Version 6.1.1 How can I resolve this problem ? Thank you in advance.
×
×
  • 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