Jump to content

Gateway Callback coding


pwner99

Recommended Posts

HELP :? I coded a gateway module but now I need to make a callback file as I don't really feel like manually accepting my clients orders and would really love some help :) Below is my callback file:

 

<?php

echo "OK";

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

$gatewaymodule = "DotPay"; # 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['t_status'];
$invoiceid = $_POST['control'];
$transid = $_POST['t_id'];
$amount = $_POST['amount'];
$fee=$amount*0.039; # Calculates DotPay Fee Based On 3.9% Fee and Transaction Amount

$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);
logTransaction($GATEWAY["name"],$_POST,"Successful");
} 

else {
# Unsuccessful
   logTransaction($GATEWAY["name"],$_POST,"Unsuccessful");
}

?>

 

Now here is the data my gateway sends to my server:

 

[id] => MERCHANT_ID
[t_id] => TRANSACTION_ID
[control] => INVOICE NUMBER
[amount] => AMOUNT PAID
[email] => EMAIL
[description] => DESCRIPTION
[t_status] => STATUS (1=ACCEPTED)
[codes] => 
[service] => 
[md5] => ee8b80137d05f2170d6c443a2cb1a7a2

 

So I selected the proper variables to make sure the invoice number and all the rest are in there, but nothing seems to work :shock:

 

Also is there a logfile or something I can check to see if my gateway connected and what errors came up?

Edited by pwner99
Link to comment
Share on other sites

  • 2 weeks later...
  • 11 months later...

Few weeks ago i configured a smilar gateway module with working call back. I request the invoice id directly from gateway. I store "invoice_id" variable in "custom" field of my gateway. I save only the invoice number for example "210" and ofc not "Invoice #210". Just save the number.

 

In call back i $_REQUEST["custom"]; then i put $invoiceid = $custom; and it works. If you receive "Invoice ID not found" for sure you made a mistake in this step imo.

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