       resolve()
 
 
+validateTokenOptions = (tokenOptions) ->
+
+  validators =
+    number: Stripe.card.validateCardNumber
+    cvc: Stripe.card.validateCVC
+    exp_month: (value) -> value
+    exp_year: (value) -> value
+    email: validator.isEmail
+
+  errors = Object.keys(validators).reduce (final, key) ->
+    fn = validators[key]
+    value = tokenOptions[key]
+    final[key] = not fn(value)
+
+    return final
+  , {}
+
+  return if Object.keys(errors).length then errors else null
+
+
 createStripeToken = ({ dispatch, evaluate }) -> (options) ->
 
   tokenOptions =

    exp_month : options.cardMonth
    exp_year  : options.cardYear
    name      : options.cardName

  return new Promise (resolve, reject) ->
    loadStripeClient({ dispatch, evaluate })().then ->
      Stripe.card.createToken tokenOptions, (status, response) ->
        if err = response.error
          dispatch actionTypes.CREATE_STRIPE_TOKEN_FAIL, { err }

kd = require 'kd'
validator = require 'validator'
appendHeadElement = require 'app/util/appendHeadElement'
constants = require './constants'
actionTypes = require './actiontypes'
