Forum Moderators: phranque
The way it works is you send a unique id in the form of one of the variables - you can use item_number if that is not used for a product id. You then define a second url for the IPN to post back to - let's call it payment_complete.pl (or .php, .asp . . . )
You post the payment to payPal. When the payment is complete, it posts the item number and a response to payment_complete.pl - what you are looking for is VERIFIED. You then use that response to update your records. If you don't get VERIFIED, then of course you take appropriate action (send email that the trans. failed, etc.)
The beauty of this is it can apply to credit cards, echecks, or even subscription payments (although I have not used it for recurring subscriptions, only for echecks and CC payments.) If you put your order completion emails in the script that receives the IPN, you won't even get notified until the payment is complete.
So if it's a credit card, PP will post the response back to payment_complete.pl almost immediately. For echecks, which often take days to complete, the completed payment IPN can occur days later. Recurring subscriptions (in theory) will occur as they happen, depending on how your PP is set up.
Dig around in the IPN documentation, there are code samples for all programming languages.