I'm setting up a payment gateway for my software product which users can buy off the web and use. I'm using paypal website payments standard to get started.
There's a basic issue troubling me. The workflow for my user is: Login to my product site (free license for a trial period) -> Pay to extend license
Now suppose a user - [email protected] registers on my site and logs in. I then show him the buy now button (paypal's). He clicks on it, gets redirected to paypal, pays, gets redirected back to my site. In the background, I set up paypal's IPN feature and get notified of this transaction and its details. Now - how do I link this purchase with my user? How do I know that [email protected] made the payment.
Note: I'm not using autoreturn + PDT method because of its basic flaw - if user closes browser after payment but before returning to the autoreturn page, my post payment logic never runs. Using IPN guarantees running of post payment logic but how do I link the payment with the username on my site that initiated and completed the payment?