views:

151

answers:

1

I'm trying to create a simple paypal purchase system. Going through a few tutorials, it seems like I need to use the IPN (Instant Payment Notification) system to keep track of whether the order is paid.

Is it sufficient to use the return url variable instead, and pass in the order id? For example, something like return="http://mysite.com/paid?id=5&pass=xyS2y"

The variables - PayPal HTML Variables

+1  A: 

No - the user might not return to your site after payment.

If you do get a PayPal return you still need to validate it just as you would for IPN in order to confirm payment went through, for the correct amount, for the correct items, for the correct payee account (you), for the correct customer, for the correct order reference, in the correct currency, with the correct shipping amount etc. etc. Your needs on this validation may vary depending on how complicated the payment you are taking is (if it's just a donation for instance that's less processing compared to say a multiple product order).

You will also need to make sure you don't double-process the order when you get the IPN through later.

Graphain
Thanks! If they do return however, can I assume the payment is completed? What I'm concerned about is that paypal states that the return page should state that the transaction is completed - but in reality the IPN might be delayed till after they return, correct?
stringo0
@stringo0 the IPN could be delayed for a while but it is "guaranteed" that you will get it (they keep sending until you give the valid response and give up after x days). If the return variables indicate they've paid then you do the same verification you would do with an IPN (postbacks to PayPal etc.) and can then confirm the payment went through. You'll have to make sure you don't then process the IPN as well later as a separate order.
Graphain