Results 1 to 8 of 8
  1. #1
    Join Date
    May 2007
    Posts
    467
    Tokens
    0

    Default how to do a IPN?

    Hello can some one tell me how to make a php paypal IPN like say they pay x money and it will update a table in my database like or insert a row to a table if you know what i mean?

  2. #2
    Join Date
    Jun 2005
    Posts
    2,688
    Tokens
    0

    Latest Awards:

    Default

    Use paypal api

  3. #3
    Join Date
    May 2007
    Posts
    467
    Tokens
    0

    Default

    Okay as i do not know what paypal api and some one told me it good to use IPN for what i want. so can some one help.

  4. #4
    Join Date
    Jul 2007
    Posts
    30
    Tokens
    0

    Default

    I would also consider using PDT as well. Does this help you out?

  5. #5
    Join Date
    Jul 2007
    Location
    Scotland
    Posts
    529
    Tokens
    0

    Default

    Code one or get a verified account and get a paypal API from th paypal sie (only verified accounts).

  6. #6
    Join Date
    May 2007
    Posts
    467
    Tokens
    0

    Default

    okay i am so lost now as you all say APi , PDT and all so ill ask i just want a script that will like say you pay money and it will like add data to a mysql data base like points or some thing now can i do that?

  7. #7
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    IPN is the service. API is the download-able script to make your site interact with PayPal.

  8. #8
    Join Date
    May 2007
    Posts
    467
    Tokens
    0

    Default

    would some thing like this work

    Code:
    <?php
    $conn = mysql_connect("****","****","*****");
       mysql_select_db(******) or die(mysql_error());
    $req = 'cmd=_notify-validate';
    
    foreach ($_POST as $key => $value) {
    $value = urlencode(stripslashes($value));
    $req .= "&$key=$value";
    }
    
    $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
    $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
    $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
    $fp = fsockopen ('www.sandbox.paypal.com', 80, $errno, $errstr, 30);
    
    $item_name = test
    $payment_status = complete
    $payment_amount = 1.00
    $payment_currency = USD
    $receiver_email = *****************
    $payer_email = ************************
    if (!$fp) {
    echo "There was a problem connecting to the IPN server, check your port status.";
    } else {
    fputs ($fp, $header . $req);
    while (!feof($fp)) {
    $res = fgets ($fp, 1024);
    if (strcmp ($res, "VERIFIED") == 0) {
    if ($payment_status != "completed") or ($receiver_email != "[email protected]") or ($payment_amount != "payment amount here")
    {
    echo "No paying";
    }
    else
    {
    mysql_query("INSERT INTO `goods` (`username`, `key`, `downloadlink`) VALUES('hello', '55453234', 'http://blah.zip')") or die(mysql_error());
    }
    }
    else if (strcmp ($res, "INVALID") == 0) {
    echo ('oh well');
    }
    }
    fclose ($fp);
    }
    ?>

Posting Permissions

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