           if allocation >= expenses + amount
             callback()
           else
-            callback new KodingError "You don't have enough balance."
+            callback { message: "Insufficient balance." }
 
   # Return quota that group gives to its users.
   @getGroupAllocation = (group, callback)->
     group.fetchBundle (err, bundle)=>
       if err or not bundle or bundle.allocation is 0
-        return callback new KodingError "This group doesn't allow you to purchase."
+        return callback { message: "This group doesn't allow you to purchase." }
       else
         callback null, bundle.allocation
 

  @chargeGroup = (group, p, data, callback)->
    {multiple, plan, quantity} = data
    p.subscribeGroup group, {multiple, plan, quantity}, (err, subscription)->
      if err then return callback new KodingError "Unable to buy item: #{err}"
      callback null, subscription

  # Charge user account
  @chargeUser = (account, plan, data, callback)->
    return callback new KodingError 'Unable charge, insufficient funds.'
    # TBI

  # List group's payments


  @makePayment = secure (client, data, callback)->
    @initialize client, data, (err, group, account, plan)=>
      if err then return callback { message: 'Unable to access payment backend, please try again later.' }

      data.quantity ?= 1  # Default quantity is 1
      data.multiple ?= no # Don't allow multiple subscriptions by default
