/**
 * Require stripe module instance with platform account's secret API key
 */
var stripe = require("stripe")("sk_test_OBXX3FRuomYskOfEP62qbgMz"); 


/**
 * Takes token created from a debit card (client side) to create a 'customer' object associated with the Stripe platform account.
 * Returns a Stripe customer ID that should be saved to the associated user so it can later be retreived and charged to a different user's Stripe Connect account.
 */
exports.createPlatformCustomer = function(stripeToken, callback) {
  stripe.customers.create({
    source: stripeToken 
  }, function(err, customer) {
    // callback(err, customer)
    if (err) {
      console.log('Error:', err)
    } else {
      console.log('New customer!')
      callback(customer);  
    }
  });
};

/**
 * Takes customer ID associated with a user profile (the paying account) and the Stripe Connect account access token of the receiving account.
 * Returns a one-time use token for creating the actual charge.
 */
var createTokenFromCustomerId = function(customerId, stripeConnectAccessToken, callback) {
  stripe.tokens.create({ 
    customer: customerId, 
  }, stripeConnectAccessToken, // user's access token from the Stripe Connect flow
    function(err, token) {
      if (err){
        console.log('Error:', err)
      } else {
        console.log('Token created!');
        console.log(token);
        callback(token);
      }
  });
};


@@ -779,129 +779,147 @@
 %0A * 
-Takes customer ID associated with a user profile (the paying account) and the Stripe Connect account access token
+Subordinate function: see use in chargeCustomerToAccount%0A * Takes stripe customer ID of accoung being charged and stripe Connect ID
  of the 
 rece
@@ -918,14 +918,13 @@
 the 
-receiv
+charg
 ing 
@@ -922,33 +922,32 @@
 charging account
-.
 %0A * Returns a on
@@ -1407,24 +1407,24 @@
 ack(token);%0A
-
       %7D%0A  %7D)
@@ -1413,24 +1413,813 @@
 ken);%0A      %7D%0A  %7D);%0A%7D;%0A%0A
+/**%0A * Takes stripe customer ID of accoung being charged, stripe Connect ID and stripe Connect access token of the charging account and amount being charged (in cents!).%0A * Transfers amount param from customer ID account to stripe Connect ID account.%0A */%0Aexports.chargeCustomerToAccount = function(customerId, stripeConnectAccountId, stripeConnectAccessToken, amount) %7B%0A  %0A  createTokenFromCustomerId(customerId, stripeConnectAccessToken, function(token) %7B%0A    stripe.charges.create(%7B%0A      amount: amount,%0A      currency: 'usd',%0A      source: token%0A    %7D, %7B stripe_account: stripeConnectAccountId %7D, %0A    function(err, charge) %7B%0A      if (err) %7B%0A        console.log('Error:', err);%0A      %7D else %7B%0A        console.log('Charged!');%0A        console.log(charge);%0A      %7D%0A    %7D);%0A  %0A  %7D);%0A%7D;%0A%0A

Add stripe helper function for creating transfer between users