           cssClass  : "modal-clean-green hidden"
           callback  : =>
             modal.destroy()
-            @makePayment type, plan, willCharge, ->
+            @makePayment type, plan, amount, ->
               cb()
 
     if needBilling
       modal.buttons.Billing.show()
     else
       modal.buttons.Yes.show()
+
+  paymentWarning: do->
+
+    formatMoney = (amount)-> (amount / 100).toFixed 2
+
+    (balance, amount)->
+      content = ""
+
+      chargeAmount = Math.max amount - balance, 0
+
+      if amount is 0
+        content += "<p>You are already subscribed for an extra VM.</p>"
+      else if balance > 0
+        content += "<p>You have $#{formatMoney balance} credited to your account.</p>"
+
+      if chargeAmount > 0
+        content += "<p>You will be charged for $#{formatMoney chargeAmount}</p>"
+      else
+        content += "<p>You won't be charged for this</p>"
+
+      content
 
   confirmPayment:(type, plan, callback=->)->
     group = KD.getSingleton("groupsController").getCurrentGroup()

    else
      KD.remote.api.JRecurlyPlan.getUserAccount cb

  createPaymentConfirmationModal: (type, group, plan, content, needBilling, willCharge, cb)->
    modal           = new KDModalView
      title         : "Confirm VM Creation"
      content       : "<div class='modalformline'>#{content}</div>"

      planCode : plan.code
    , (err, status)=>
      if not err and status
        @createPaymentConfirmationModal type, group, plan, no, 0, 0, callback
      else
        @getBillingInfo type, group, (err, account)=>
          needBilling = err or not account or not account.cardNumber

          @getBalance type, group, (err, balance)=>
            if err
              balance = 0
            @createPaymentConfirmationModal type, group, plan, needBilling, balance, plan.feeMonthly, callback

  makePayment: (type, plan, amount, callback)->
    vmController = KD.getSingleton('vmController')
    group        = KD.getSingleton("groupsController").getCurrentGroup()

    if amount is 0
      vmController.createGroupVM type, plan.code
    else
      if type is 'group'
