       purchased.gems = gems
       user.set('purchased', purchased)
       user.save((err) -> done(err))
-      
+
     else
       user.update({$inc: {'purchased.gems': gems}}, {}, (err) -> done(err))
-      
+
   recalculateGemsFor: (user, done) ->
 
     Payment.find({recipient: user._id}).select('gems').exec((err, payments) ->

          return @sendDatabaseError(res, err) if err
          @incrementGemsFor(req.user, product.gems, (err) =>
            return @sendDatabaseError(res, err) if err
            @sendCreated(res, @formatEntity(req, payment))
          )
        )
      )
    )

    
  #- Stripe payments
    
  handleStripePaymentPost: (req, res, timestamp, productID, token) ->
    
    # First, make sure we save the payment info as a Customer object, if we haven't already.
    if not req.user.get('stripeCustomerID')
      stripe.customers.create({

        (err) =>
          return @sendDatabaseError(res, err)
      )

    else
      @beginStripePayment(req, res, timestamp, productID)


  beginStripePayment: (req, res, timestamp, productID) ->
    product = products[productID]
