           planCode: data.planCode
 
       # Assign a (new) PIN.
-      token.pin = pin
+      token.pin   = pin.toString()
+      token.tries = 0
 
       # Send email
       token.save =>

    JRecurlyToken.one
      username: delegate.profile.nickname
      planCode: data.planCode
      pin     : data.pin
    , (err, token)->
      if err or not token
        callback no
      else
        callback yes

  @createToken = secure (client, data, callback)->
    {delegate} = client.connection

    schema        :
      username    : String
      planCode    : String
      pin         : String
      tries       : Number
      createdAt   :
        type      : Date
        default   : -> new Date
