paypal ipn integration with a virtual service

Discussion in 'PHP' started by alincatalin, Apr 11, 2011.

  1. #1
    Hi guys

    How do i integrate paypal ipn with a virtual service?

    Example:
    I have a classified ad script made by me ,user goes to form to post his ad,then he clicks submit ,after that script will send him to paypal to pay for his ad...after payment paypal sends him back then if payment has been maid his ad info is posted to the database if not his ad will not be allowed to be posted.

    Anyone knows how to do that ? Can you tell us?
     
    alincatalin, Apr 11, 2011 IP
  2. Extension103

    Extension103 Guest

    Messages:
    29
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    this is something i really need to learn also.

    without much knowledge of the ipn i do know that you can set a return url. so a very simple way of mamiing this work would be to:

    file1 adds data to mysql database (the ad info, contact, etc).

    file 1 sends user to payal.

    user pays at paypal and is sent to the return url

    return url = file2

    file2 updates the data in the database to "approved" status on form submit.





    that seems the simplest way, but i do think there is a way to it from one script. i just dont know it.
     
    Extension103, Apr 15, 2011 IP
  3. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #3
    The above solution is not secure as the user could go to the return URL without having paid.

    The IPN script sends a message to your server directly, which you respond to correctly and then it sends the payment status. Once you have this and confirm its marked as settled you then can update your db to make the advert live.

    You can find sample code for integrating to the IPN on PayPals website https://cms.paypal.com/cgi-bin/mark...nt_ID=developer/library_code_ipn_code_samples
     
    AstarothSolutions, Apr 15, 2011 IP
  4. alincatalin

    alincatalin Member

    Messages:
    392
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    30
    #4
    So you say that there is no secure way to automate this?

     
    alincatalin, Apr 15, 2011 IP
  5. Extension103

    Extension103 Guest

    Messages:
    29
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    yes there is a secure way.

    the way i pointed out IS NOT SECURE , sorry it was a possible work around if you could find a better way.

    the reply by AstarothSolutions is the correctand secure way to do it.

    if i was needing this right now i would look for a class that has this ipn wrapped up nice and neatly, search php classes .com for a good script.
     
    Extension103, Apr 15, 2011 IP
  6. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #6
    The IPN method is fairly secure, better still if it is done under an SSL but is not 1000% secure. Using their webservice under an SSL is their most secure method rather than the IPN but for 99% of sites the IPN is fine.
     
    AstarothSolutions, Apr 15, 2011 IP