• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Alertpay doesnt work automatic

swordman

Member
Joined
Jun 5, 2011
Messages
394
Reaction score
7
Hi Otlanders,

I have tryed to let my alertpay work. But nope, it doesnt work automatic.
I followed the tutorial of Spider.

This is the standard ipn.php
any changes needed?
PHP:
<?php
/**
 * @author AlertPay
 * @edited by  SpiderOt
 */
 

    //The value is the Security Code generated from the IPN section of your AlertPay account. Please change it to yours.
    define("IPN_SECURITY_CODE", "");         //put the code from last picture
    define("MY_MERCHANT_EMAIL", "");        //your alertpay email

    mysql_select_db('', mysql_connect('localhost', 'root', ''));        //database information
    $ip = $ip = $_SERVER['REMOTE_ADDR'];
    $file = 'alertpay.log'; 
    $accountid = urldecode($_POST['apc_1']);
    $points = urldecode($_POST['points']);
    //Setting information about the transaction
    $receivedSecurityCode = urldecode($_POST['ap_securitycode']);
    $receivedMerchantEmailAddress = urldecode($_POST['ap_merchant']);    
    $transactionStatus = urldecode($_POST['ap_status']);
    $testModeStatus = urldecode($_POST['ap_test']);     
    $purchaseType = urldecode($_POST['ap_purchasetype']);
    $totalAmountReceived = urldecode($_POST['ap_totalamount']);
    $feeAmount = urldecode($_POST['ap_feeamount']);
    $netAmount = urldecode($_POST['ap_netamount']);
    $transactionReferenceNumber = urldecode($_POST['ap_referencenumber']);
    $currency = urldecode($_POST['ap_currency']);     
    $transactionDate= urldecode($_POST['ap_transactiondate']);
    $transactionType= urldecode($_POST['ap_transactiontype']);
    $reportedamount = urldecode($_POST['ap_amount']);
    
    //Setting the customer's information from the IPN post variables
    $customerFirstName = urldecode($_POST['ap_custfirstname']);
    $customerLastName = urldecode($_POST['ap_custlastname']);
    $customerAddress = urldecode($_POST['ap_custaddress']);
    $customerCity = urldecode($_POST['ap_custcity']);
    $customerState = urldecode($_POST['ap_custstate']);
    $customerCountry = urldecode($_POST['ap_custcountry']);
    $customerZipCode = urldecode($_POST['ap_custzip']);
    $customerEmailAddress = urldecode($_POST['ap_custemailaddress']);
    
    //Setting information about the purchased item from the IPN post variables
    $myItemName = urldecode($_POST['ap_itemname']);
    $myItemCode = urldecode($_POST['ap_itemcode']);
    $myItemDescription = urldecode($_POST['ap_description']);
    $myItemQuantity = urldecode($_POST['ap_quantity']);
    $myItemAmount = urldecode($_POST['ap_amount']);
    
    //Setting extra information about the purchased item from the IPN post variables
    $additionalCharges = urldecode($_POST['ap_additionalcharges']);
    $shippingCharges = urldecode($_POST['ap_shippingcharges']);
    $taxAmount = urldecode($_POST['ap_taxamount']);
    $discountAmount = urldecode($_POST['ap_discountamount']);
$log = "test";
    
    if ($ip != "174.142.185.131" && $ip != "174.142.185.132") {
        $log = "".$transactionDate." [WARNING - ATTEMPTED CHEATING] Wrong Ip from ".$customerFirstName." ".$customerLastName." ".$customerEmailAddress." From ".$ip." For ".$points." points to account ".$accountid." Transaction=".$transactionStatus."";
        }
        if ($receivedMerchantEmailAddress != MY_MERCHANT_EMAIL) {
            // The data was not meant for the business profile under this email address.
            // Take appropriate action 
            $log = "".$transactionDate." [WARNING - ATTEMPTED CHEATING] Wrong Merchant Email Address from ".$customerFirstName." ".$customerLastName." ".$customerEmailAddress." From ".$ip." For ".$points." points to account ".$accountid." Transaction=".$transactionStatus."";
        }
        else {    
            //Check if the security code matches
            if ($receivedSecurityCode != IPN_SECURITY_CODE) {
                // The data is NOT sent by AlertPay.
                // Take appropriate action.
                $log = "".$transactionDate." [WARNING - ATTEMPTED CHEATING] Wrong Security Code >>".$receivedSecurityCode."<< from ".$customerFirstName." ".$customerLastName." ".$customerEmailAddress." From ".$ip." For ".$points." points to account ".$accountid." Transaction=".$transactionStatus."";
            }
            else {
                if ($transactionStatus == "Success") {
                    if ($testModeStatus == "1") {
                        // Since Test Mode is ON, no transaction reference number will be returned.
                        // Your site is currently being integrated with AlertPay IPN for TESTING PURPOSES
                        // ONLY. Don't store any information in your production database and 
                        // DO NOT process this transaction as a real order.
                        $log = "".$transactionDate." [WARNING - ATTEMPTED CHEATING] With Test Mode from ".$receivedSecurityCode." ".$customerFirstName." ".$customerLastName." ".$customerEmailAddress." From ".$ip." For ".$points." points to account ".$accountid." Transaction=".$transactionStatus."";
                    }
                    else {
                        if ($totalAmountReceived == 5) $amount = 300;        //if they pay 10 euro they will get 600 point
                        if ($totalAmountReceived == 10) $amount = 650;        //if they pay 15 euro they will get 900 point
                        if ($totalAmountReceived == 20) $amount = 1400;        //if they pay 20 euro they will get 1300 point
                            if ($transactionStatus == "Success" && $currency == "EUR"){
				$add = mysql_query("UPDATE `accounts` SET `premium_points` = `premium_points` + '".$amount."' WHERE `id` = '". (int) $accountid."' ");
                                $log = $transactionDate." - ".$totalAmountReceived." ".$currency." from ".$customerFirstName." ".$customerLastName." ".$customerEmailAddress." For ".$amount." points to account ".$accountid."   Transaction=".$transactionStatus."";
                            }
                        else {
                                $log = "".$transactionDate." [WARNING -Wrong-Amount] ".$totalAmountReceived." ".$currency." from ".$customerFirstName." ".$customerLastName." ".$customerEmailAddress."-".$ip."  For ".$points." points to account ".$accountid."   Transaction=".$transactionStatus."";
                        }
                    }
                }
                        // This REAL transaction is complete and the amount was paid successfully.
                        // Process the order here by cross referencing the received data with your database.                                                         
                        // Check that the total amount paid was the expected amount.
                        // Check that the amount paid was for the correct service.
                        // Check that the currency is correct.
                        // ie: if ($totalAmountReceived == 50) ... etc ...
                        // After verification, update your database accordingly.
                else {
                        $log = "".$transactionDate." [WARNING - ATTEMPTED CHEATING] Transaction was cancelled from ".$customerFirstName." ".$customerLastName." ".$customerEmailAddress." From ".$ip." For ".$points." points to account ".$accountid." Transaction=".$transactionStatus."";
                        // Transaction was cancelled or an incorrect status was returned.
                        // Take appropriate action.
                }
            }
            
    $open = fopen($file, "a"); 
    fwrite($open, $log); 
    fwrite($open, "\r\n");
    fclose($open); 
        }
?>
 
Back
Top