Advanced Search

Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Communicating with PayPal to update database

  1. #1
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default Communicating with PayPal to update database

    I need paypal to verify that a transaction has successfully completed, then communicate with a mysql database in order to update an inventory.

    Has anyone had experience doing something like this or know of online resources with information?

    I am using PHP and MySQL. A PHP script will send a user to Paypal in order to complete a transaction. I don't want to update my database until I am sure that the transaction has completed.

    I need to receive a conformation from Paypal and then update the database.

    I CAN NOT do this manually. It needs to be automatic.

    Thanks in advance! These forums are the best!

  2. #2
    Join Date
    Jul 2007
    Location
    Irmo, SC
    Posts
    96
    Thanks
    10
    Thanked 7 Times in 7 Posts

    Default

    I do that same thing using Paypal IPN. You have to turn on paypal ipn in your paypal preferences. Once paypal has the money it sends you a transaction back to your server. In the script that accepts the transaction you can have it update your tables.

    if you need more info let me know. First thing I would do would be to look into the paypal ipn interface

  3. The Following User Says Thank You to gpigate For This Useful Post:

    JasonDFR (09-30-2008)

  4. #3
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    Thanks a lot for your reply!

  5. #4
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    PayPal IPN is the way to go. It works well once you get it set up right. Through trial and error I got mine working well. If anyone needs a hand with this issue, feel free to contact me and I'll help out.

    Also, a big thank you to Greg for replying to my post and exchanging emails with me while I worked through this; Thanks Greg!

    Jason

  6. #5
    Join Date
    Jul 2007
    Location
    Irmo, SC
    Posts
    96
    Thanks
    10
    Thanked 7 Times in 7 Posts

    Default

    Glad you got it working.

  7. #6
    Join Date
    Oct 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy I found that connector you were looking for

    Cindy, is this the thing you were looking for?
    www.liangdianup.com/computeraccessories_1.htm
    It's on the list of computer accessories and parts. They have the DVI video thing to convert that jap monitor to work with your other computer. Just about any other kind of wire adaptor, usb connectors, monitor extension wires, ps2 extention wires, and all kinds of female and male swap connectors and things that I think would help your shop. If that above link don't work then goto www.lducompany.com and click on computer accessories. Let me know if that is what you need and give me your email address again.

    I

  8. #7
    Join Date
    Nov 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I'm trying to get this to work for a long time and have been having trouble. Im new to this and programming your help will be surely be appreciated. After leaving paypal page want to go back to the website and update the database.

  9. #8
    Join Date
    Jan 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hello,

    I want to create a small e-business interface on my webpage and would like to use Paypal for the payment. I use PHP/MySQL (but I am no specialist at all) and I have already created my "Buy Now" button which transfers the information to paypal. But it remains to integrate the Paypal payment confirmation which is supposed to be sent back and that will automatically update my database.

    I think this is exactly what you were looking for when you wrote this posting...

    And since I am newbie with all that I would be very interested to learn more about the way you proceeded. I have found the piece of PHP code given as example on the IPN page of Paypal, but I don't know where I should put that file, and how to verify the different variables.

    Also I would like to test the process but I haven't used the paypal sandbox so far. Did you use it ?
    And I wonder how you avoid that 2 people start "buying" the same item, until the sale has not been confirmed (i.e. until the database has not been updated)...

    Would you be so kind to help me setting this up ?

    Thanks a lot for your help, and Happy New Year!

    Sincerely yours,
    Chris

    P.S: By the way I saw you were located in France ? If you are French, on peut discuter aussi en Francais aussi si vous preferez :-)

  10. #9
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    Bonjour,

    Je suis Americain, mais j'habite en France. Je parle un peu la francais.

    I modified the PayPal PHP Instant Payment Notification script and got it to do what I needed.

    I will edit it a bit and put a bunch of comments in and then post it for you. I'll try to get it up by tonight.

    It took a little time to get it working, but I think it was because I was a PHP novice. Once you understand the basic idea of what the script is doing, it isn't that hard to make it work.

    The sandbox is a bit tricky to get working too. But it does work and you should try to use it.

    To use the sandbox, you need to change this line in the IPN script:

    Code:
    $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);
    to:

    Code:
    $fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
    The following two uri are on the paypal site in the instructions for the IPN script to use in place of the two I posted above (https://cms.paypal.com/us/cgi-bin/?c...ntpaymentnotif), but I never used them:

    https://www.paypal.com/cgi-bin/webscr
    https://www.sandbox.paypal.com/cgi-bin/webscr

  11. #10
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    Check out the attached files. You'll definitely need some basic knowledge of PHP and MySQL and a basic understanding of how PayPal IPN works.

    The attached zip contains two files. paypal_ipn.php and paypal_ipn.sql .

    paypal_ipn.php is the instant notification script you'll need to put into a web accessible directory and inform PayPal of it's location.

    paypal_ipn.sql contains the sql statements that can be used to create the standard database tables to be used with the paypal_ipn.php script . These came directly from the PayPal website.

    Read all the comments I made on paypal_ipn.php .

    If you have any questions after reading through the script and the documentation on PayPal's site, let me know.

    I am fairly certain that the script works, but it does need modification to meet your needs. Notably you'll enter your database connection information and email address(es). I have tried to comment the script heavily. You should be able to tell where edits need to occur.

    If anyone finds any problems with the script, please let me know, or correct them and repost. If you have any ideas of how to make it better or easier to understand, please share them!

    Bonne chance !

    Jason

Tags for this Thread

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
  •