Tuesday 10 October 2017

Access variable from outside callback

I am trying to access outside a call back using the code below:stripe.tokens.create({ card: { "number": '4242424242424242', // This card info is test info still need to import actual card info "exp_month": 12, "exp_year": 2018, "cvc": '123' } }, function(err, token) { if(!err){ var stripeToken = token; } else { console.log(err); } }); console.log(stripeToken); I am having trouble getting the value of that final stripeTokenI need it for the rest of my code to work. Somehow I either need this to run client side and return a token to my req.body or have it run server side and deal with the issues that come with it.

Submitted October 10, 2017 at 09:21PM by jsdfkljdsafdsu980p

No comments:

Post a Comment