Skip to content

Commit

Permalink
Fix Use built-in components METHOD PAY (#13)
Browse files Browse the repository at this point in the history
Co-authored-by: caiosalchesttes <[email protected]>
  • Loading branch information
caioSalchesttes and caiosalchesttes authored Oct 6, 2022
1 parent d8207e4 commit 92bb1c9
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ export default defineComponent({
})
})
const = pay () => {
// Get stripe element
const cardElement = card.stripeElement
// Access instance methods, e.g. createToken()
elms.instance.createToken(cardElement).then((result: object) => {
// Handle result.error or result.token
console.log(result)
})
},
return {
stripeKey,
stripeLoaded,
Expand All @@ -112,21 +123,9 @@ export default defineComponent({
cardOptions,
card,
elms,
pay
}
},
methods: {
pay() {
// Get stripe element
const cardElement = this.card.stripeElement
// Access instance methods, e.g. createToken()
this.elms.instance.createToken(cardElement).then((result: object) => {
// Handle result.error or result.token
console.log(result)
})
},
},
})
</script>
Expand Down

0 comments on commit 92bb1c9

Please sign in to comment.