Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save farhan-syed/9b362e2446d61379faee84d62b72a46c to your computer and use it in GitHub Desktop.
Save farhan-syed/9b362e2446d61379faee84d62b72a46c to your computer and use it in GitHub Desktop.
stripe.tokens.create(
{ customer: req.params.stripe_customer_cccount},
{ stripe_account: req.params.seller_stripe_account }, // id of the connected account
function(err, token) {
// callback
if (err) {
console.log(error.message);
res.error(error.message);
}
else{
stripe.charges.create({
amount: req.params.price,
currency: 'usd',
source: token.id,
application_fee: application_fee,
description: 'Charge for ' + req.params.charge_description,
}, {stripe_account: req.params.seller_stripe_account},
function(err, charge) {
if (err) {
//charge failed
}
else{
//success
}
}
);
}
//end callback for token
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment