Created
July 2, 2016 03:06
-
-
Save farhan-syed/9b362e2446d61379faee84d62b72a46c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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