Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Once off payments via Paypal

Options
  • 25-06-2009 11:42pm
    #1
    Closed Accounts Posts: 1,171 ✭✭✭


    Hi,

    I have a website which allows users list particular items for sale. Currently, users are paying by cheque and the process is a bit unwieldly. I am looking at integrating Paypal into the site so I can offer Visa Payments. What I would like to do is sent the sales id/ref number to Paypal and have it return that to my site once the payment has been made so I can update the record on the database. I have spent some time looking on the Paypal site to see if this can be achieved but there seems to be a wealth of options on there...

    So, basically wondering if anyone has done this and if they can point me in the direction of the information (from doing a web search, IPN seems to be mentioned but not sure how I sign up for this).

    Thanks very much in advance for any help!


Comments

  • Registered Users Posts: 379 ✭✭TheWaterboy


    Hi paulocon

    Yes this isnt too hard to do with Paypal. The basic idea is as follows:

    User is on your website and click buy it now button.
    Hidden variables from your website are then sent to Paypal - price, currency etc.
    User pays as normally
    User is given a thankyou page in Paypal and a default message to say that they will be returned to the website they came from in 5 seconds/

    In your Paypal account options you must set it up so as to tell paypal to return to your website - In your profile => Website Payment Preferences you need to set Auto-Return to On and then enter a return URL - This will be the page they will be sent to - www.mysite/thankyou.php

    When you save these settings you will then be given a secure merchant ID which you will need.

    In the code on your return page you then need to use your secure merchant id to do some checks with the data you receive from Paypal. Through these checks you can find out if it is a valid transaction and based on this you can update your database - transaction amount, shipping details etc., display a thank you message or alternatively display an error message.

    I havent the code with me off hand but if you need a hand implementing it then give me a shout. I have put the paypal integration into 4 or 5 sites without any problems


  • Closed Accounts Posts: 1,171 ✭✭✭paulocon


    Hi paulocon

    Yes this isnt too hard to do with Paypal. The basic idea is as follows:

    User is on your website and click buy it now button.
    Hidden variables from your website are then sent to Paypal - price, currency etc.
    User pays as normally
    User is given a thankyou page in Paypal and a default message to say that they will be returned to the website they came from in 5 seconds/

    In your Paypal account options you must set it up so as to tell paypal to return to your website - In your profile => Website Payment Preferences you need to set Auto-Return to On and then enter a return URL - This will be the page they will be sent to - www.mysite/thankyou.php

    When you save these settings you will then be given a secure merchant ID which you will need.

    In the code on your return page you then need to use your secure merchant id to do some checks with the data you receive from Paypal. Through these checks you can find out if it is a valid transaction and based on this you can update your database - transaction amount, shipping details etc., display a thank you message or alternatively display an error message.

    I havent the code with me off hand but if you need a hand implementing it then give me a shout. I have put the paypal integration into 4 or 5 sites without any problems

    Thanks for that. Just one question.. does Paypal return these hidden variables to the page you specify?


  • Registered Users Posts: 7,518 ✭✭✭matrim


    paulocon wrote: »
    Thanks for that. Just one question.. does Paypal return these hidden variables to the page you specify?

    If you specify an IPN page paypal will return alot of information about the transaction

    Here's a link to a good PHP template for IPN processing http://developer.paypal-portal.com/pdn/board/message?board.id=ipn&thread.id=14078


  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    IPN is only essential if you're offering downloads after someone pays - it stands for "instant payment notification" and basically, if the payment is completed or cancelled in Paypal, it can send back that info to your page so that you can decide whether to give them the link to the download, etc.

    Otherwise the email you receive from PayPal should be sufficient, as long as you include all the necessary details in the form being sent to PayPal.


  • Closed Accounts Posts: 1,171 ✭✭✭paulocon


    If anyone has any simple code they would like to share, it'd be greatly appreciated.

    Have the site up and running bar the paypal section - what I want to do is..

    - User adds a listing which gets stored on MySQL database with a status of 'pending'.
    - User is presented with a link to pay - form will pass Listing ID into Paypal.
    - If Payment is successful, the listing on the database gets updated to 'paid' (using the returned Status ID) and the user gets an email

    Like I said, any help would be greatly appreciated..


  • Advertisement
Advertisement