need help with Paypal IPN script

Discussion in 'PHP' started by nastynappy, Mar 2, 2008.

  1. #1
    I have a paypal IPN script, im not good at Advanced PHP , i am beginner..
    the script is attached.

    can you please make it to add a query to mysql if payment is verified???
    the query should be according to this example:

    if (isset($_POST['submit'])) {
    mysql_query("insert into links (`linkname`, `linkurl`,`paid`) values ('test', 'http://test.com', 'n')");
    // do the IPN script
    if(VERIFIED) {
    mysql_query("update table links set paid = 'y'");
    }
    }
    PHP:
    this is just an example of my code..
    now, i know my code works, but ... how will it know which row to update?? i mean how will it know which site's payment has been verified just now??

    if you can help me, then ill be really glad

    Thanks
     

    Attached Files:

    nastynappy, Mar 2, 2008 IP
  2. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #2
    you can pass the site field name in the form on ur site as data and then by picking those transaction values you could find on which site payment was made.

    Regards

    Alex
     
    kmap, Mar 2, 2008 IP
  3. nastynappy

    nastynappy Banned

    Messages:
    499
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #3
    you did not read what i wanted to do.
    i said i want a query to be ran, cuz i dont want to login to my account to verify every transaction manually..
     
    nastynappy, Mar 3, 2008 IP
  4. aaron_nimocks

    aaron_nimocks Im kind of a big deal Staff

    Messages:
    5,563
    Likes Received:
    627
    Best Answers:
    0
    Trophy Points:
    420
    #4
    Basically what you need to do is add another field for email address in your database.

    Then your IPN function you are using returns a value of $payer_email.

    You then do a query to find the row = $payer_email then update paid to = yes.

    Sorry I dont have time to write out the code but that is the way I would do it.
     
    aaron_nimocks, Mar 3, 2008 IP
  5. nastynappy

    nastynappy Banned

    Messages:
    499
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #5
    okay thanks, i got the point.

    but how does WHMCS or any other shopping cart scripts track the payment?
    I use WHMCS, and it doesnt use PayPal IPN to track the payment..
    i mean, is there any other way to track payment? just becuz , i dont want to go messing around with my account's settings.. PayPal IPN needs to be configured VIA the paypal account to be working , and i dont want to edit any settings..
     
    nastynappy, Mar 4, 2008 IP
  6. nastynappy

    nastynappy Banned

    Messages:
    499
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #6
    any help ???

    cant anyone help me please?
     
    nastynappy, Mar 5, 2008 IP
  7. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #7
    If u pay me i can help u

    $50 for fixing this problem

    50% advance

    You wont need to login to ur paypal account to verify


    Regards

    Alex
     
    kmap, Mar 5, 2008 IP
  8. nastynappy

    nastynappy Banned

    Messages:
    499
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #8
    no thanks, i dont need help from someone who is wants money to help someone.
     
    nastynappy, Mar 6, 2008 IP
  9. nastynappy

    nastynappy Banned

    Messages:
    499
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #9
    can any GOOD member please help me ??
     
    nastynappy, Mar 7, 2008 IP
  10. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #10
    You don't have to alter the paypal account to use IPN, set the notify URL for the response. All the information needed is in the IPN docs. Aaron_nimocks pointed you in the right direction.

    Considering this thread is 5 days old, it might be worthwhile to find someone to pay to do it.
     
    shallowink, Mar 7, 2008 IP
  11. nastynappy

    nastynappy Banned

    Messages:
    499
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #11
    yeah , i know he pointed me in right direction, but since im new at PHP, i cant understand it as you guys..
    can you atleast tell me how to find the the payer's field in database an do a query upon payment validation ??
    and what to write in <input type="hidden" name="notify_url" value="" /> ??
    Please help !
     
    nastynappy, Mar 7, 2008 IP
  12. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #12
    How would I know what the database field is? You have to look at the db. Far as the field for notify url, it doesn't have to be a hidden field. The script should set it before it initiates the transaction with paypal's IPN.
     
    shallowink, Mar 7, 2008 IP
  13. nastynappy

    nastynappy Banned

    Messages:
    499
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #13
    so the return_url and notify_url should be same?
    and i am trying to do this:
    upon validation :
    update table links Set paid='y'
    PHP:
    and now comes the hard part.
    it should update the only row, whose payment has been validated just now, i think it should be done using the $_GET thingy, but i cant figure out how :(
     
    nastynappy, Mar 8, 2008 IP
  14. nastynappy

    nastynappy Banned

    Messages:
    499
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #14
    nevermind, i figured it out myself..

    MODS , please close this thread.

    Thanks
     
    nastynappy, Mar 9, 2008 IP