@@ -33,14 +33,13 @@ npm i vue-stripe-js @stripe/stripe-js
33
33
``` vue
34
34
<script setup lang="ts">
35
35
import { onBeforeMount, ref } from "vue"
36
- import { loadStripe } from "@stripe/stripe-js"
37
- import type { Stripe } from "@stripe/stripe-js"
36
+ import { loadStripe, type Stripe } from "@stripe/stripe-js"
38
37
39
- const publishableKey = ref('')
38
+ const publishableKey = '' // use your publishable key
40
39
const stripe = ref<Stripe | null>(null)
41
40
42
41
onBeforeMount(async() => {
43
- stripe.value = await loadStripe(publishableKey.value )
42
+ stripe.value = await loadStripe(publishableKey)
44
43
})
45
44
</script>
46
45
```
@@ -91,7 +90,7 @@ import type {
91
90
StripePaymentElementOptions,
92
91
} from "@stripe/stripe-js"
93
92
94
- const stripeKey = ref( "pk_test_f3duw0VsAEM2TJFMtWQ90QAT")
93
+ const stripeKey = "pk_test_f3duw0VsAEM2TJFMtWQ90QAT" // use your publishable key
95
94
const stripeOptions = ref({
96
95
// https://stripe.com/docs/js/initializing#init_stripe_js-options
97
96
})
@@ -115,7 +114,7 @@ const elementsComponent = ref()
115
114
const paymentComponent = ref()
116
115
117
116
onBeforeMount(() => {
118
- loadStripe(stripeKey.value ).then(() => {
117
+ loadStripe(stripeKey).then(() => {
119
118
stripeLoaded.value = true
120
119
121
120
// Good place to call your backend to create PaymentIntent
0 commit comments