Created
June 30, 2015 20:45
-
-
Save chalettu/c81da35dced219065df7 to your computer and use it in GitHub Desktop.
Stripe coding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Users.findOne({"id":user_id}).exec(function(err, user) { | |
stripe.customers.create({ //this saves the user to the platform account | |
source: tokenID, | |
email: user.email, | |
description: "Example customer" | |
}, function (err, customer) { | |
user.stripe_cust=customer.id; | |
//this attempts to create a token associated to the connected account id | |
stripe.tokens.create( | |
{ customer: customer.id }, | |
"sk_test_RKPpizeOQMhpD6cbXBeXKBLA", // user's access token from the Stripe Connect flow | |
function(err, token) { | |
console.log(token); | |
stripe.customers.create({ | |
source: token.id, | |
email: user.email, | |
description: "Example customer" | |
}, function (err, customer2) { | |
console.log(err); | |
console.log(customer2); | |
}); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment