As a php/PayPal novice, I used LinkLok as a method to create secure digital downloads on my site. Now that I'm revisiting Linklok after using for some time, I see that it doesn't allow me to easily deal with and log refunds. I'd like to develop my own script which will do the follow:

1. Start with an html form that contacts PayPal on submission.
2. Using IPN, I'll double check that it's not a fraudulent payment, that it's the right amount, etc.
3. Upon success, the user will be emailed a message with a copy of the link that expires after 1 click.

I feel fine about 1. and 2. above, but am not sure about 3. Somehow the link would have to be "encoded" (I guess that this is what Linklok does?) or anybody would be able to download it once word got out. Any help in starting this would be great. And, I would very much like to program it as opposed to using some 3rd party solution.

Thanks so much,