0

I am using paypal standard as my payment gateway.
My problem is that, in Paypal Standard payment method,

I have done my code as below:

When user click on return to merchant button from paypal then user return to the site with order data , and on that page my order entry will be inserted in my DB.

So my problem occur when someone pays but don't click on return to merchant link.

So in this case customer gets paid, but due to no entry my DB its not working proper.

Hope I am clear to all.

Thanks Avinash

Avinash
  • 6,064
  • 15
  • 62
  • 95
  • Dont' forget to select an answer on some of your outstanding questions. You've got at least one that's more than 9 months old that has a perfect answer. Thanks. – Jan K. Jun 10 '10 at 13:30

2 Answers2

1

You have to set up a callback IPN that listens for PayPal's response when the check out has been completed. This script can then handle the data entry portion. A great place to start is PayPal and its developer network.

Your solution, as you already noticed, is sub-optimal and error-prone (anything that relies on certain user behavior is to some extend).

Jan K.
  • 1,607
  • 2
  • 13
  • 22
  • 2
    Forget it. If this is a commercial project for a client, which I assume, go with the IPN listener, otherwise you'll be delivering half-assed work. Check out the following links: http://stackoverflow.com/questions/683332/simple-paypal-ipn-examples https://cms.paypal.com/uk/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_admin_IPNImplementation and https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_admin_IPNIntro – Jan K. Jun 10 '10 at 13:27
0

Digesting the IPN with a listener is pretty much the same as what you would be doing on your PDT success/return page so I usually just do both. Having just the IPN will ensure data integrity but since its nice to have a PDT success page that has some logic in it that welcomes the user back and ensures them that their transaction was successful by breaking down the message, you might as well just do your order processing there as well. Just keep track of the transaction IDs so nothing gets processed twice.

jumpdart
  • 1,702
  • 16
  • 35