Results 1 to 6 of 6

Thread: IPN Paypal

  1. #1
    Join Date
    Jun 2007
    Posts
    197

    Default IPN Paypal

    Hi,

    Firstly I would like to say great product. I'm working away on templating the site etc..

    What my problem is I'm trying to setup the IPN for paypal. What happens though is paypal send a warning back saying payment not accepted.

    My code is as follows could someone have a look as see what I'm doing wrong.

    Thanks in advance

    <?PHP

    include("../include/payment/class.paypal_ipn.php");
    include("../include/config.php");
    include("../include/function.php");

    global $config,$conn;

    $paypal_info=$_POST;

    $paypal_ipn = new paypal_ipn($paypal_info, "[email protected]", 'Notify');

    $paypal_ipn->send_response();

    if (!isset($receiver_email)){
    $paypal_ipn->error_out("Fraud attempt was detected. (PayPal's receiver email is not set)");
    exit;
    }

    $paypal_currency = 'GBP';

    if ($paypal_currency != $mc_currency) {
    $paypal_ipn->error_out("Fraud attempt was detected. (Payer uses another currency then site)");
    exit;
    }

    // should be changed:

    if(strtolower($receiver_email) != strtolower($config[paypal_receiver_email])) {
    $paypal_ipn->error_out("Fraud attempt was detected. (PayPal's receiver email is not equal to attempting's receiver email: $receiver_email)");
    exit;
    }

    if($paypal_ipn->is_verified()) {

    $uniqueid = explode("|", $custom);
    $userid = $uniqueid[0];
    $pack_id = $uniqueid[1];
    $period = $uniqueid[2];
    $theprice = $uniqueid[3];

    $expired_time = date("Y-m-d H:i:s", strtotime("+$period"));

    $sql = "update subscriber set
    pack_id=$pack_id,
    subscribe_time='".date("Y-m-d H:i:s")."',
    expired_time='$expired_time'
    where UID = $userid";
    $conn->execute($sql);

    $sql = "update signup set
    account_status = 'Active'
    where UID=$userid";
    $conn->execute($sql);

    $sql = "select * from signup where UID=$userid";
    $rs_u = $conn->execute($sql);

    $to = $rs_u->fields['email'];
    $name = $config['site_name'];
    $from = $config['admin_email'];
    $subj = "Payment is received successfully";

    STemplate::assign("userid",$rs_u->fields['UID']);
    STemplate::assign("username",$rs_u->fields['username']);
    STemplate::assign("pack_id",$pack_id);
    STemplate::assign("pack_name",$rs_p->fields['pack_name']);
    STemplate::assign("amount", $theprice);
    STemplate::assign("period", $period);
    STemplate::assign("expired_time", $expired_time);
    $body = STemplate::fetch("email/notify_payment.tpl");
    mailing($to,$name,$from,$subj,$body);

    } else {

    $paypal_ipn->error_out("Fraud attempt was detected. (PayPal didn't validate the request data)");

    }

    exit;

    ?>
    ------------------------------------
    Make an arse of yourself:
    http://www.youtwatonline.com
    ------------------------------------

  2. #2
    Join Date
    Jun 2007
    Posts
    197

    Default

    Anyone help?

    This is a real issue for me.
    I've managed to get the script to allow payments, however on return to the site and it says payment sucessfull, it shows the ammount of time added to users account but once you login it shows up as account expired.

    For some reason it is not adding any information to the database after sucessful payment has been accepted.

    I have currently had to turn of the package feature because of this.

    Please can anyone help?

    Regards,
    Mathew.
    ------------------------------------
    Make an arse of yourself:
    http://www.youtwatonline.com
    ------------------------------------

  3. #3
    Join Date
    May 2007
    Posts
    686

    Default

    Has this just been enables? I mean you havent added it to a server that already has free members?

  4. #4
    Join Date
    Jun 2007
    Posts
    197

    Default

    Hi and thank you for replying!

    I don't understand what you mean but hopefully this will help answer your question:

    I setup the site and at present have the PayPal payments turned off because after a sucessfull payment the data is not added to the database as mentioned above.

    Some users have signed up on a FREE account because of the packages currently being unavailable.

    I can not turn on the packages because of the errors above, so currently my site is running for FREE which can't continue as I want users to signup and pay a small fee for hosting etc.. for their accounts.

    Hope this helps.
    Mat.
    ------------------------------------
    Make an arse of yourself:
    http://www.youtwatonline.com
    ------------------------------------

  5. #5
    Join Date
    May 2007
    Posts
    588

    Default

    think the package feature is still too bugged at the moment....see my post about it... http://forums.buyscripts.in/viewtopic.php?t=320

  6. #6
    Join Date
    Jun 2007
    Posts
    197

    Default

    Thanks I will follow up on your post.
    ------------------------------------
    Make an arse of yourself:
    http://www.youtwatonline.com
    ------------------------------------

Similar Threads

  1. change paypal from USD to CDN
    By jayscot in forum Template Modifications
    Replies: 1
    Last Post: 03-18-2009, 06:05 PM
  2. No Paypal
    By one11 in forum Sales Questions
    Replies: 0
    Last Post: 08-19-2008, 06:46 PM
  3. paypal
    By talentuncover in forum Installation Support
    Replies: 3
    Last Post: 10-12-2007, 04:24 PM
  4. PayPal Subscriptions
    By arbie in forum Installation Support
    Replies: 4
    Last Post: 09-21-2007, 04:47 PM
  5. paypal
    By pierref in forum Installation Support
    Replies: 5
    Last Post: 06-07-2007, 12:40 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •