Jump to content

sample callback file / url


tommyinnn

Recommended Posts

I've been working on a Plimus gateway mod, and wondered if any1 has a sample callback file they could post (any gateway) , or provide a screenshot of their coding, callback URL, or any help with this.... I don't need your complete code, just enough to help me figure out what i'm doing wrong.

I have a active post at http://forum.whmcs.com/showthread.php?t=2180&highlight=plimus but it's not really going anywhere...thanks for any help any1 can give, I've been working on this for ever and a day & am so close to getting it to work!

Link to comment
Share on other sites

  • 1 month later...

I have this working for me now, though only for single payments. I did not yet look into recurring ones.

 

Had to change the callback file a little - still not perfect but at least it works now:

 

# Required File Includes

include("../../../dbconnect.php");

include("../../../includes/functions.php");

include("../../../includes/gatewayfunctions.php");

include("../../../includes/invoicefunctions.php");

 

$gatewaymodule = "plimus"; # 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

$status = $_POST["transactionType"];

$invoiceid = $_POST["invoiceid"];

$transid = $_POST["referenceNumber"];

$amount = $_POST["amount"];

 

if( $amount <= 4.99) $fee = 0.75;

if(($amount >= 5.00) && ($amount <= 8.99)) $fee = round(($amount*0.150),2);

if(($amount >= 9.00) && ($amount <= 49.99)) $fee = round(($amount*0.100),2);

if(($amount >= 50.00) && ($amount <= 59.99)) $fee = round(($amount*0.090),2);

if(($amount >= 60.00) && ($amount <= 79.99)) $fee = round(($amount*0.080),2);

if(($amount >= 80.00) && ($amount <= 99.99)) $fee = round(($amount*0.070),2);

if(($amount >= 100.00) && ($amount <= 139.99)) $fee = round(($amount*0.060),2);

if(($amount >= 140.00) && ($amount <= 279.99)) $fee = round(($amount*0.050),2);

if($amount >= 280.00) $fee = round(($amount*0.045),2);

 

$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=="CHARGE") {

# Successful

addInvoicePayment($invoiceid,$transid,$amount,$fee,$gatewaymodule);

logTransaction($GATEWAY["name"],$_POST,"Successful");

} else {

# Unsuccessful

logTransaction($GATEWAY["name"],$_POST,"Unsuccessful");

}

 

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