[REL] 2checkout INS - Auto VIP Payments [Uber/zCMS]

Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    :joy: Jonteh is offline
    MemberRank
    Apr 2007 Join Date
    New York, USALocation
    3,375Posts

    [REL] 2checkout INS - Auto VIP Payments [Uber/zCMS]

    THIS WILL ONLY WORK IF YOU HAVE A 2CHECKOUT ACCOUNT.

    This may or may not work. I've tested it to an extent but not fully. This is the first time I wrote an IPN from scratch and it looks good. I'm rewriting it into a class for my personal use, but here is the base for any budding programmers to learn from.

    http://cloud.soshort.me/2co.rar

    Enjoy guys, PHP code below if you don't want to download it.

    PHP Code:
    <?php

        
    require_once "global.php";
        
        
    // ########################
        // Zap Hotel 2Checkout IPN
        // ########################
        
        
    $ipn['vendor_id'] = '';
        
    $ipn['secret_word'] = '';
        
        
    $allowedItems = Array("SuperVip""PlatinumVip""Throne");
        
        if(isset(
    $_POST["item_list_amount_1"]) && isset($_POST["order_number"]))
        {
            
    $ipn['total_price'] = filter($_POST["item_list_amount_1"]);
            
    $ipn['order_num'] = filter($_POST["order_number"]);
        }
        
        
    $md5 md5($ipn['secret_word'] . $ipn['vendor_id'] . $ipn['order_num'] . $ipn['total_price']);
        
    $secretKey strtoupper($md5);
        
        if(isset(
    $_POST["md5_key"]) && $secretKey == $_POST["md5_key"])
        {
            if(isset(
    $_POST["message_type"]))
            {
                
    $message filter($_POST["message_type"]);
                
                if(
    $message == "INVOICE_STATUS_CHANGED")
                {
                    if(isset(
    $_POST["invoice_status"])) { $status filter($_POST["invoice_status"]); } else { exit; }
                    if(isset(
    $_POST["ship_name"])) { $username filter($_POST["ship_name"]); } else { exit; }
                    if(isset(
    $_POST["item_name_1"])) { $item filter($_POST["item_name_1"]); } else { exit; }
                    
                    
    // Check the prices against the product before we go any further.
                    
    if($item == "SuperVip" && $ipn['total_price'] == "10.00")
                    {
                        
    $final_product "SVIP";
                    }
                    else if(
    $item == "PlatinumVip" && $ipn['total_price'] == "20.00")
                    {
                        
    $final_product "PVIP";
                    }
                    else if(
    $item == "Throne" && $ipn['total_price'] == "3.00")
                    {
                        
    $final_product "T";
                    }
                    else
                    {
                        exit;
                    }
                    
                    if(
    $status == "deposited")
                    {
                        switch(
    $final_product)
                        {
                            case 
    "SVIP"// Give them Super VIP
                            
                                
    mysql_query("UPDATE users SET  activity_points = activity_points + '2000000' WHERE `username` = '" .  $username "'");
                                
    mysql_query("UPDATE users SET credits =  credits + '2000000' WHERE `username` = '" $username "'");
                                
    mysql_query("UPDATE users SET rank = '3' WHERE username = '" $username "'");
                                
    mysql_query("UPDATE users SET points = points + '2' WHERE username = '" $username "'");
                                
    mysql_query("INSERT INTO vip_payments (username, type) VALUES ('"$username ."', 'S')");
                                
                                break;
                            
                            case 
    "PVIP"// Give them Plat VIP
                            
                                
    mysql_query("UPDATE users SET  activity_points = activity_points + '5000000' WHERE `username` = '" .  $username "'");
                                
    mysql_query("UPDATE users SET credits =  credits + '5000000' WHERE `username` = '" $username "'");
                                
    mysql_query("UPDATE users SET rank = '4' WHERE username = '" $username "'");
                                
    mysql_query("UPDATE users SET points = points + '6' WHERE username = '" $username "'");
                                
    mysql_query("INSERT INTO vip_payments (username, type) VALUES ('"$username ."', 'P')");
                                
                                break;
                            
                            case 
    "T"// Give them a throne
                            
                                //mysql_query("INSERT INTO `shop_purchases`  (`username`, `product`) VALUES ('" . $username . "', 'Throne')");
                                
    mysql_query("INSERT INTO vip_payments (username, type) VALUES ('"$username ."', 'Throne')");
                                
                                break;
                        }
                    } 
    // TODO: More status updates.
                
    }
            } 
    // TODO: More messages.
            
    else 
            {
                exit;
            }
        }
        else
        {
            exit;
        }
        
    ?>
    Last edited by Jonteh; 04-03-12 at 09:30 AM.


  2. #2
    C# Programmer Jax is offline
    MemberRank
    Dec 2009 Join Date
    1,030Posts

    Re: [REL] 2checkout INS - Auto VIP Payments [Uber/zCMS]

    Cheer's for this mate. Using this straight away, hate having to confirm every purchase.

  3. #3
    Account Upgraded | Title Enabled! Muscab is offline
    MemberRank
    Oct 2009 Join Date
    264Posts

    Re: [REL] 2checkout INS - Auto VIP Payments [Uber/zCMS]

    I saw you coding this over TeamViewer earlier today, seems legit man, well done overall.

  4. #4
    prjRev.com Kryptos is offline
    MemberRank
    Feb 2010 Join Date
    Planet EarthLocation
    579Posts

    Re: [REL] 2checkout INS - Auto VIP Payments [Uber/zCMS]

    It's alright but I think the SQL query, for the platinumVIP for example, should be something like.. (Sorry for any mistake, pretty tired)

    PHP Code:
    mysql_query("UPDATE `users` SET `rank` = '4' WHERE `username` = '" $username "' AND `rank` < '4'"); 

  5. #5
    Gamma Spamma Liam is offline
    MemberRank
    Dec 2011 Join Date
    Down UnderLocation
    2,946Posts

    Re: [REL] 2checkout INS - Auto VIP Payments [Uber/zCMS]

    This is great, love to see you releasing more stuff Jonteh! 10/10

    Sadly, I don't use 2Checkout..

  6. #6
    The one and only! Hejula is offline
    MemberRank
    Nov 2008 Join Date
    4,128Posts

    Re: [REL] 2checkout INS - Auto VIP Payments [Uber/zCMS]

    Surprised no one has pointed this out yet, it does not function! This is merely a base, it does not communicate with the 2CO API, so a bit of work is required before you can use this.

  7. #7
    ex visor Aaron is offline
    MemberRank
    May 2007 Join Date
    MichiganLocation
    4,028Posts

    Re: [REL] 2checkout INS - Auto VIP Payments [Uber/zCMS]

    2Checkout is such a great company.
    Nice script btw.

    Just had to point out that if you're going to do CC processing, then definitely use them.

  8. #8
    Account Upgraded | Title Enabled! DoctorCooper is offline
    MemberRank
    Oct 2011 Join Date
    R:\aGEZONELocation
    317Posts

    Re: [REL] 2checkout INS - Auto VIP Payments [Uber/zCMS]

    Thanks for this :)

  9. #9
    :joy: Jonteh is offline
    MemberRank
    Apr 2007 Join Date
    New York, USALocation
    3,375Posts

    Re: [REL] 2checkout INS - Auto VIP Payments [Uber/zCMS]

    Quote Originally Posted by Hejula View Post
    Surprised no one has pointed this out yet, it does not function! This is merely a base, it does not communicate with the 2CO API, so a bit of work is required before you can use this.
    It does function, or it should. Just set the correct URL in your 2checkout account & when purchases etc are made it will send the $_POST data to the INS.

    Quote Originally Posted by Kryptos View Post
    It's alright but I think the SQL query, for the platinumVIP for example, should be something like.. (Sorry for any mistake, pretty tired)

    PHP Code:
    mysql_query("UPDATE `users` SET `rank` = '4' WHERE `username` = '" $username "' AND `rank` < '4'"); 
    Yes, I suppose. But I don't think any of my staff are going to buy VIP

    Quote Originally Posted by Aaron View Post
    2Checkout is such a great company.
    Nice script btw.

    Just had to point out that if you're going to do CC processing, then definitely use them.
    They are. It took me this long to realise. They accept everything, it's great.

    Here's the finished version:

    PHP Code:
    <?php

        
    require_once "global.php";
        
        
    // ########################
        // Zap Hotel 2Checkout IPN
        // ########################
        
        
    $ipn['vendor_id'] = '';
        
    $ipn['secret_word'] = '';
        
        
    $allowedItems = Array("SuperVip""PlatinumVip""Throne");
        
        if(isset(
    $_POST["item_list_amount_1"]) && isset($_POST["order_number"]))
        {
            
    $ipn['total_price'] = filter($_POST["item_list_amount_1"]);
            
    $ipn['order_num'] = filter($_POST["order_number"]);
        }
        
        
    $md5 md5($ipn['secret_word'] . $ipn['vendor_id'] . $ipn['order_num'] . $ipn['total_price']);
        
    $secretKey strtoupper($md5);
        
        if(isset(
    $_POST["md5_key"]) && $secretKey == $_POST["md5_key"])
        {
            if(isset(
    $_POST["message_type"]))
            {
                
    $message filter($_POST["message_type"]);
                
                if(
    $message == "INVOICE_STATUS_CHANGED")
                {
                    if(isset(
    $_POST["invoice_status"])) { $status filter($_POST["invoice_status"]); } else { exit; }
                    if(isset(
    $_POST["ship_name"])) { $username filter($_POST["ship_name"]); } else { exit; }
                    if(isset(
    $_POST["item_name_1"])) { $item filter($_POST["item_name_1"]); } else { exit; }
                    
                    
    // Check the prices against the product before we go any further.
                    
    if($item == "SuperVip" && $ipn['total_price'] == "10.00")
                    {
                        
    $final_product "SVIP";
                    }
                    else if(
    $item == "PlatinumVip" && $ipn['total_price'] == "20.00")
                    {
                        
    $final_product "PVIP";
                    }
                    else if(
    $item == "Throne" && $ipn['total_price'] == "3.00")
                    {
                        
    $final_product "T";
                    }
                    else
                    {
                        exit;
                    }
                    
                    if(
    $status == "deposited")
                    {
                        switch(
    $final_product)
                        {
                            case 
    "SVIP"// Give them Super VIP
                            
                                
    mysql_query("UPDATE users SET activity_points = activity_points + '2000000' WHERE `username` = '" $username "'");
                                
    mysql_query("UPDATE users SET credits = credits + '2000000' WHERE `username` = '" $username "'");
                                
    mysql_query("UPDATE users SET rank = '3' WHERE username = '" $username "'");
                                
    mysql_query("UPDATE users SET points = points + '2' WHERE username = '" $username "'");
                                
    mysql_query("INSERT INTO vip_payments (username, type) VALUES ('"$username ."', 'S')");
                                
                                break;
                            
                            case 
    "PVIP"// Give them Plat VIP
                            
                                
    mysql_query("UPDATE users SET activity_points = activity_points + '5000000' WHERE `username` = '" $username "'");
                                
    mysql_query("UPDATE users SET credits = credits + '5000000' WHERE `username` = '" $username "'");
                                
    mysql_query("UPDATE users SET rank = '4' WHERE username = '" $username "'");
                                
    mysql_query("UPDATE users SET points = points + '6' WHERE username = '" $username "'");
                                
    mysql_query("INSERT INTO vip_payments (username, type) VALUES ('"$username ."', 'P')");
                                
                                break;
                            
                            case 
    "T"// Give them a throne
                            
                                //mysql_query("INSERT INTO `shop_purchases` (`username`, `product`) VALUES ('" . $username . "', 'Throne')");
                                
    mysql_query("INSERT INTO vip_payments (username, type) VALUES ('"$username ."', 'Throne')");
                                
                                break;
                        }
                    } 
    // TODO: More status updates.
                
    }
            } 
    // TODO: More messages.
            
    else 
            {
                exit;
            }
        }
        else
        {
            exit;
        }
        
    ?>
    Updated main post.

    Oh, BTW:

    This was a bastard to code. The documentation differs from how it's actually implemented so there's a lot of guess work to be done. If you want to write your own from scratch, I recommend looking at this first.

    ~ Jonteh

  10. #10
    Not active anymore! Winter is offline
    MemberRank
    Aug 2009 Join Date
    AustraliaLocation
    461Posts

    Re: [REL] 2checkout INS - Auto VIP Payments [Uber/zCMS]

    A really nice release Jonty! Cheers.

  11. #11
    Member GHB is offline
    MemberRank
    Jan 2012 Join Date
    79Posts

    Re: [REL] 2checkout INS - Auto VIP Payments [Uber/zCMS]

    I use the MOSMS, and how can I connect the service to that code?
    (SMS service)
    Help please!

  12. #12
    :joy: Jonteh is offline
    MemberRank
    Apr 2007 Join Date
    New York, USALocation
    3,375Posts

    Re: [REL] 2checkout INS - Auto VIP Payments [Uber/zCMS]

    Quote Originally Posted by GHB View Post
    I use the MOSMS, and how can I connect the service to that code?
    (SMS service)
    Help please!
    This is for 2checkout only. Please read the CAPITALIZED BOLD TEXT (xD) at the top

  13. #13
    Alpha Member Danny is offline
    MemberRank
    Oct 2011 Join Date
    My PCLocation
    2,158Posts

    Re: [REL] 2checkout INS - Auto VIP Payments [Uber/zCMS]

    Great job Jonteh, you always impress me

  14. #14
    Apprentice Okok is offline
    MemberRank
    Jul 2011 Join Date
    9Posts

    Re: [REL] 2checkout INS - Auto VIP Payments [Uber/zCMS]

    does this work with revcms?

  15. #15
    :joy: Jonteh is offline
    MemberRank
    Apr 2007 Join Date
    New York, USALocation
    3,375Posts

    Re: [REL] 2checkout INS - Auto VIP Payments [Uber/zCMS]

    Quote Originally Posted by Okok View Post
    does this work with revcms?
    You can make it work.

    Just remove:
    PHP Code:
    require_once "global.php"
    and replace it with your mysql settings, eg:
    PHP Code:
    $con mysql_connect('127.0.0.1''root''password');
    mysql_select_db('database'$con); 
    :) hope it helps



Page 1 of 2 12 LastLast

Advertisement