title: Where to store dynamic data for paypal express checkout (digital goods)
body: <p>Imagine a site like istockphoto or envato where the user can only purchase digital credits...</p>
  
  <p>How would one implement this in the cleanest, easiest way using paypal's API's? The docs there are a bit confusing to navigate...</p>
  
  <p>Aside from that general "best-practices" question, my guess was to start with the Integration Wizard at <a href="https://devtools-paypal.com/integrationwizard/" rel="nofollow">https://devtools-paypal.com/integrationwizard/</a> and select "Express Checkout - Digital goods"</p>
  
  <p>After setting up some test accounts on the sandbox, I've kinda sorta got it working- but I'm confused how I track dynamic data across the session.</p>
  
  <p>I.e. where would I securely store the "number of credits" and "userid" values so that it gets added to this user (who may not have an email address, nevermind one matching their paypal account) upon successful payment. Is a database/callback system necessary?</p>
  
  <p>Assuming so for the time being, my guess is to maybe store the data in a database where the primary key is the TOKEN received at SetExpressCheckoutDG(), and prepopulated fields are the data I want to keep... and then the final confirm.php page will check the database at that token and implement that data... but something just seems strange about that, i.e. relying on a callback (could be timeouts, etc.) and I'm not sure if it's really the most secure way of doing it.</p>
  
  <p>If using examples, please stick with PHP (not curl or other langs). Thanks!</p>