Putting it together...
In my rev project I check for registration. If it's not there, users can go to this window:
Users click on the button "on-line store" (script) and are shown a blocking sub stack while the registration stack is loaded into memory from my web site.

Then the registration stack loads:

(you can get a sample stack here)
The openstack routine reads a text file on my website for the latest prices and displays them.
When the User clicks the "Send" button...

  1. The proper registration key is created (the program is running from the user's machine, so you can use information like the disc serial number or the MAC address.--see Ken Ray's site!)
  2. A random number is generated for tracking the customer through PayPal
  3. This information is written to a log file on your site
  4. The program uses Scott Rossi's PayPal button modified with your info to launch the browser and take the user directly to PayPal.

After the customer pays, PayPal redirects them to a cgi on your site [your PDT.cgi]. This cgi does this:
  1. sends a POST message back to PayPal-- containing your 'identity token'
  2. recieves from PayPal (if the post gets through) the following information:
    1. success (or some error message-- if it's empty, your post failed!)
    2. customer's first and last name
    3. email address
    4. purchased item
    5. price
    6. your pass-through variable
    7. other stuff
Your cgi should then-
  1. check that the item and price are correct
  2. "status" is "completed"
  3. your PayPal account email is correct (i.e. the money is going to YOU!)
If any of these is not satisfactory, you should withold the license key!
If everything checks out, your cgi should:
  1. construct a 'Thank you' html page, displaying the registration key
  2. update your key_log
  3. email the customer with the key [or do this with the IPN.cgi]
  4. email yourself, "subject: Buy another cup o' Joe!"
Pitfalls My greatest difficulty was getting my rev cgi to POST. You need the internet library and you need it properly set up for your version of rev. Check the rev mailing list for more info. If PayPal is not responding to your cgi, your POST is not working!
Also problematic: Hint: set up a log.txt file to keep track of what's happening; who sends what and revieves what when and where.

NEW
My registration stack now has a button on card 2 to automatically enter the registration information in my application. So users don't need to copy and paste their key. Check it out.

But wait! there's more!
PayPal will send another message to your website--(not so) Instant Payment Notification. This is useful if customers use echecks or something else that takes time to clear. You should use this also.

getting to know about IPN (Instant Payment Notification) >> next >>