Jump to content

WHMCS Payment Gateway not working


jubba890

Recommended Posts

I am creating my payment gateway and I did everything that the Docs say (turned error reporting on) and there is no clue on why the error is (Payment Gateway log is empty too)

 

/modules/gateways/IZTPay.php

<?php

function IZTPay_config() {
   $configarray = array(
    "FriendlyName" => array("Type" => "System", "Value"=>"IZTPay"),
    "email" => array("FriendlyName" => "E-Mail:", "Type" => "text", "Size" => "50", ),
    "apikey" => array("FriendlyName" => "API Key:", "Type" => "text", "Size" => "80", ),
    "apikeypass" => array("FriendlyName" => "API Key Password:", "Type" => "text", "Size" => "80", ),
    /*"transmethod" => array("FriendlyName" => "Transaction Method", "Type" => "dropdown", "Options" => "Option1,Value2,Method3", ),
    "instructions" => array("FriendlyName" => "Payment Instructions", "Type" => "textarea", "Rows" => "5", "Description" => "Do this then do that etc...", ),
    "testmode" => array("FriendlyName" => "Test Mode", "Type" => "yesno", "Description" => "Tick this to test", ),*/
   );
return $configarray;
}

function IZTPay_link($params) {

# Gateway Specific Variables
$gatewayusername = $params['email'];
# $gatewaytestmode = $params['testmode'];

# Invoice Variables
$invoiceid = $params['invoiceid'];
$description = $params["description"];
       $amount = $params['amount']; # Format: ##.##
       $currency = $params['currency']; # Currency Code

# Client Variables
$firstname = $params['clientdetails']['firstname'];
$lastname = $params['clientdetails']['lastname'];
$email = $params['clientdetails']['email'];
$address1 = $params['clientdetails']['address1'];
$address2 = $params['clientdetails']['address2'];
$city = $params['clientdetails']['city'];
$state = $params['clientdetails']['state'];
$postcode = $params['clientdetails']['postcode'];
$country = $params['clientdetails']['country'];
$phone = $params['clientdetails']['phonenumber'];

# System Variables
$companyname = $params['companyname'];
$systemurl = $params['systemurl'];
$currency = $params['currency'];

# Enter your code submit to the gateway...

$code = '<form method="http://www.inzernettechnologies.com/IZTPay/3payment.php">
<input type="hidden" name="email" value="'.$gatewayusername.'" />
<input type="hidden" name="invoiceid" value="'.$invoiceid.'" />
<input type="hidden" name="amount" value="'.$amount.'" />
<input type="hidden" name="systemurl" value="'.$systemurl.'" />
<input type="hidden" name="company" value="'.$companyname.'" />
<input type="hidden" name="description" value="'.$description.'" />
<input type="submit" value="Pay Now" />
</form>';

return $code;
}

/*function IZTPay_refund($params) {

   # Gateway Specific Variables
$gatewayusername = $params['username'];
$gatewaytestmode = $params['testmode'];

   # Invoice Variables
$transid = $params['transid']; # Transaction ID of Original Payment
$amount = $params['amount']; # Format: ##.##
   $currency = $params['currency']; # Currency Code

   # Client Variables
$firstname = $params['clientdetails']['firstname'];
$lastname = $params['clientdetails']['lastname'];
$email = $params['clientdetails']['email'];
$address1 = $params['clientdetails']['address1'];
$address2 = $params['clientdetails']['address2'];
$city = $params['clientdetails']['city'];
$state = $params['clientdetails']['state'];
$postcode = $params['clientdetails']['postcode'];
$country = $params['clientdetails']['country'];
$phone = $params['clientdetails']['phonenumber'];

# Card Details
$cardtype = $params['cardtype'];
$cardnumber = $params['cardnum'];
$cardexpiry = $params['cardexp']; # Format: MMYY
$cardstart = $params['cardstart']; # Format: MMYY
$cardissuenum = $params['cardissuenum'];

# Perform Refund Here & Generate $results Array, eg:
$results = array();
$results["status"] = "success";
   $results["transid"] = "12345";

# Return Results
if ($results["status"]=="success") {
	return array("status"=>"success","transid"=>$results["transid"],"rawdata"=>$results);
} elseif ($gatewayresult=="declined") {
       return array("status"=>"declined","rawdata"=>$results);
   } else {
	return array("status"=>"error","rawdata"=>$results);
}

}*/

?>

 

/modules/gateways/callback/IZTPay.php

<?php

# Required File Includes
include("../../../dbconnect.php");
include("../../../includes/functions.php");
include("../../../includes/gatewayfunctions.php");
include("../../../includes/invoicefunctions.php");

$gatewaymodule = "IZTPay"; # Enter your gateway module name here replacing template

$GATEWAY = getGatewayVariables($gatewaymodule);
if (!$GATEWAY["type"]) die("Module Not Activated"); # Checks gateway module is active before accepting callback

# Get Returned Variables - Adjust for Post Variable Names from your Gateway's Documentation
$status = $_POST["x_response_code"];
$invoiceid = $_POST["x_invoice_num"];
$transid = $_POST["x_trans_id"];
$amount = $_POST["x_amount"];
$fee = $_POST["x_fee"];

$invoiceid = checkCbInvoiceID($invoiceid,$GATEWAY["name"]); # Checks invoice ID is a valid invoice number or ends processing

checkCbTransID($transid); # Checks transaction number isn't already in the database and ends processing if it does

if ($status=="1") {
   # Successful
   addInvoicePayment($invoiceid,$transid,$amount,$fee,$gatewaymodule); # Apply Payment to Invoice: invoiceid, transactionid, amount paid, fees, modulename
logTransaction($GATEWAY["name"],$_POST,"Successful"); # Save to Gateway Log: name, data array, status
} else {
# Unsuccessful
   logTransaction($GATEWAY["name"],$_POST,"Unsuccessful"); # Save to Gateway Log: name, data array, status
}

?>

 

When I pay with the module it says "An Error Occurred. Please Try Again." with no debug information or anything, I have PHP logging enabled and it still doesn't work, maybe it is my PHP code? it should redirect to the 3payment.php and then when they logged in etc I would post it back to the callback URL.

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