Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save farhan-syed/54e56a3db3c1e234254ae3538c734ebd to your computer and use it in GitHub Desktop.
Save farhan-syed/54e56a3db3c1e234254ae3538c734ebd 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(error, token) {
if (error) {
console.log(error.message);
res.error(error.message);
}
else{
stripe.charges.create({
amount:req.params.price,
currency: "usd",
source: token,
description: 'Charge for ' + req.params.charge_description,
application_fee: application_fee
}, function(error, charge){
if (error) {
console.log(error.message);
res.error(error.message);
}
else{
console.log(charge.status);
res.success(charge);
}
});
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment