使用php在ccavenue页面上添加动态内容

时间:2013-10-04 07:29:49

标签: php ccavenue infusionsoft

我目前正在将ccavenue与site.which成功发生整合。现在我想知道有多少ccavenue的成功发生以及发生了多少失败事务.ccavenue在他自己的帐户上显示这些数据但我希望它在infusionsoft上。所以为了这个目的,我将代码添加到redirecturl页面,如果事务发生成功,用户将添加infusionsoft添加,但当我执行它时,它不会显示我想要的确切输出,如infusionsoft上显示成功的用户详细信息。这是我试过的代码任何帮助都会表示赞赏。

<? require("libfuncs.php");
   require("isdk.php");
   include "Barcode39.php";

   session_start();


    $app = new iSDK;   
if ($app->cfgCon("connectionName"))
{
/*

    This is the sample RedirectURL PHP script. It can be directly used for integration with CCAvenue if your application is developed in PHP. You need to simply change the variables to match your variables as well as insert routines for handling a successful or unsuccessful transaction.

    return values i.e the parameters namely Merchant_Id,Order_Id,Amount,AuthDesc,Checksum,billing_cust_name,billing_cust_address,billing_cust_country,billing_cust_tel,billing_cust_email,delivery_cust_name,delivery_cust_address,delivery_cust_tel,billing_cust_notes,Merchant_Param POSTED to this page by CCAvenue. 

*/

    $WorkingKey = "my key" ; //put in the 32 bit working key in the quotes provided here
    $Merchant_Id= $_REQUEST['Merchant_Id'];
    $Amount= $_REQUEST['Amount'];
    $Order_Id= $_REQUEST['Order_Id'];
    $Merchant_Param= $_REQUEST['Merchant_Param'];
    $Checksum= $_REQUEST['Checksum'];
    $AuthDesc=$_REQUEST['AuthDesc'];

        $Checksum = verifyChecksum($Merchant_Id, $Order_Id , $Amount,$AuthDesc,$Checksum,$WorkingKey);


    if($Checksum=="true" && $AuthDesc=="Y")
    {
        echo "<br>Thank you for shopping with us. Your credit card has been charged and your transaction is successful. We will be shipping your order to you soon.";

                $contactId =$_SESSION["contactId"];
                $groupId = 384;
                $result = $app->grpAssign($contactId, $groupId);

                $bc = new Barcode39($_SESSION["contactId"]);

                // set text size
                $bc->barcode_text_size = 5;

                // set barcode bar thickness (thick bars)
                 $bc->barcode_bar_thick = 4;

                // set barcode bar thickness (thin bars)
                 $bc->barcode_bar_thin = 2;

                // save barcode GIF file
                 $bc->draw($arr['ContactId'].".png");

        //Here you need to put in the routines for a successful 
        //transaction such as sending an email to customer,
        //setting database status, informing logistics etc etc
    }
    else if($Checksum=="true" && $AuthDesc=="B")
    {
        echo "<br>Thank you for shopping with us.We will keep you posted regarding the status of your order through e-mail";

        //Here you need to put in the routines/e-mail for a  "Batch Processing" order
        //This is only if payment for this transaction has been made by an American Express Card
        //since American Express authorisation status is available only after 5-6 hours by mail from ccavenue and at the "View Pending Orders"
    }
    else if($Checksum=="true" && $AuthDesc=="N")
    {
        echo "<br>Thank you for shopping with us.However,the transaction has been declined.";

                $contactId =$_SESSION["contactId"];
                $groupId = 386;
                $result = $app->grpAssign($contactId, $groupId);
        //Here you need to put in the routines for a failed
        //transaction such as sending an email to customer
        //setting database status etc etc
    }
    else
    {
        echo "<br>Security Error. Illegal access detected";
        $contactId =$_SESSION["contactId"];
                $groupId = 386;
                $result = $app->grpAssign($contactId, $groupId);
        //Here you need to simply ignore this and dont need
        //to perform any operation in this condition
    }
}
?>

1 个答案:

答案 0 :(得分:0)

由于您在评论中声明要在交易成功时通过infusionsoft发送电子邮件,因此您可以使用EmailService执行此操作。

有关emailService的详细信息,请访问:

http://help.infusionsoft.com/api-docs/emailservice

如果您想发送电子邮件模板,可以使用:

$app->sendTemplate(array(12,16,22), 3380);

如果您要发送非电子邮件模板,请使用以下命令:

$clist = array(123,456,789); 
$status = $app->sendEmail($clist,"Test@test.com","~Contact.Email~", "","","Text","Test Subject","","This is the body");

根据你想要的那个,你需要把它放在你的成功if语句中,并为它提供正确的参数。