I would like to integrate stripe to charge a user a one-time 20$ payment after successfully completing a form in my Vue3 application. I’ve integrated vue-stripe-js and have been able to obtain a token from stripe using the card
element in that package, but have been unable to handle submitting the charge to stripe.
Here’s the request so far:
const pay = () => {
const cardElement = card.value.stripeElement
elms.value.instance.createToken(cardElement).then((result) => {
if (result.token) {
// what should I do with the token to submit a charge for $20 and see it in my stripe dashboard?
console.log(result.token)
}
})
}
The ideal solution would show me what to do with the token to submit a payment and validate that the other fields in the form have been inputted before the payment is completed. Here’s a stackblitz that approximates the problem, thanks so much for sharing your knowledge.