title: Implementing gift card
body: <p>I'm meeting an issue to implement gift card in an e-commerce website working with paypal.
  I'll try to be as clear as possible.</p>
  
  <p>Once the user has validate his cart, he can enter a code as gift card to get a discount. The gift card (and the code) can be used only once and it isnt linked to the user. </p>
  
  <p>So when the user enter the code, I check if it exist if it allready has been used, get the discount and so on...</p>
  
  <p>On the postsale of paypal (once the paiment has been accepted), I set the gift card as used.</p>
  
  <p>Now, how can I prevent the gift card beeing used twice (or more). Because when user enter the code and goes to paypal, another user can use this same gift card while the first user did'nt confirm the paiment (and didnt process the postsale).</p>
  
  <p>I thought giving a status to the gift card, for instance 'In use' before redirecting to paypal but if the user leave paypal without confirming his purchase, the gift card will always be InUse and then I wouldnt be able to check it again....</p>
  
  <p>I hope I've been understood and thanx for your help :)</p>