Question

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

Was it helpful?

Solution

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).

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top