Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pay () {
// createToken returns a Promise which resolves in a result object with
// either a token or an error key.
// See https://stripe.com/docs/api#tokens for the token object.
// See https://stripe.com/docs/api#errors for the error object.
// More general https://stripe.com/docs/stripe.js#stripe-create-token.
createToken().then(data => console.log(data.token))
}
}
pay() {
createToken().then(data => {
this.submitted = true;
console.log(data.token); //this is a token we would use for the stripeToken below
axios
.post(
'https://sdras-stripe.azurewebsites.net/api/charge?code=zWwbn6LLqMxuyvwbWpTFXdRxFd7a27KCRCEseL7zEqbM9ijAgj1c1w==',
{
stripeEmail: this.stripeEmail,
stripeToken: 'tok_visa', //testing token
stripeAmt: this.total
},
{
headers: {
'Content-Type': 'application/json'
}
}
)