 
     validateParams requiredParams, data, (err)->
       canChangePlan client, data.planTitle, callback
+
+
+  @logOrder = secure (client, raw, callback)->
+    requiredParams = [
+      "planTitle", "planAmount", "binNumber", "lastFour", "cardName"
+    ]
+
+    validateParams requiredParams, raw, (err)->
+      return callback err  if err
+
+      {planTitle, planAmount, binNumber, lastFour, cardName} = raw
+
+      data = {
+        "$type"               : "$create_order"
+        "$currency_code"      : "USD"
+        "$amount"             : planAmount*1000000
+        "$payment_methods"    : [
+          "$payment_type"     : "$credit_card"
+          "$payment_gateway"  : "$stripe"
+          "$card_bin"         : binNumber
+          "$card_last4"       : lastFour
+        ]
+        "$billing_address"    :
+          "$name"             : cardName
+        "$items"              : [
+          "$item_id"          : planTitle
+          "$price"            : planAmount*1000000
+        ]
+      }
+
+      logToSiftScience client, "create_order", data, callback
 
 
   validateParams = (requiredParams, data, callback)->

          (signature Object, Function)
        canChangePlan     :
          (signature Object, Function)


  { get, post } = require "./socialapi/requests"

  @subscribe = secure (client, data, callback)->
    requiredParams = [

    JReferral.fetchEarnedSpace client, callback


  fetchUserInfo = (client, callback)->
    {sessionToken, connection : {delegate}} = client
    delegate.fetchUser (err, user)->
      return callback err  if err

      {username, email} = user

      callback null, {username, email, sessionToken}

  logTransaction = (client, raw, callback)->
    {planTitle, planAmount, binNumber, lastFour, cardName, status} = raw

    return callback null  if planTitle is "free"

    data = {
      "$type"               : "$transaction"
      "$transaction_status" : "$success"
      "$currency_code"      : "USD"
      "$amount"             : planAmount*1000000
      "$payment_method"     :
        "$payment_type"     : "$credit_card"
        "$payment_gateway"  : "$stripe"
        "$card_bin"         : binNumber
        "$card_last4"       : lastFour
      "$billing_address"    :
        "$name"             : cardName
    }

    logToSiftScience client, "transaction", data, callback

  logToSiftScience = (client, event, data, callback)->
    siftScience = require('yield-siftscience') KONFIG.siftScience

    fetchUserInfo client, (err, {username, email, sessionToken})->
      return callback err   if err

      data["$user_id"]    = username
      data["$user_email"] = email
      data["$session_id"] = sessionToken

      siftScience.event[event] data, callback
