#Serquand
1 messages · Page 1 of 1 (latest)
Hi there, can you describe the problem or share some screenshots?
Ok, so I will share my code in a first time
<template>
<div>
<stripe-element-payment
ref="paymentRef"
:pk="pk"
:elements-options="elementsOptions"
:confirm-params="confirmParams"
/>
<button @click="pay">Pay Now</button>
</div>
</template>
<script>
import { StripeElementPayment } from '@vue-stripe/vue-stripe';
export default {
components: {
StripeElementPayment,
},
props: {
clientSecret: {
type: String,
required: true
}
},
data () {
return {
pk: "pk_test_51LaAHZAZxKtqwNR7XnOs0oOYheHdcM9ObheTPluzIcXIdj9C7LsAzcV8XFYihYgcrMlY5Yoh0bfL5hqsnu0Bu3wW005JiCSHKe",
elementsOptions: {},
confirmParams: {
return_url: 'http://localhost:8080/success', // success url
},
};
},
mounted () {
this.generatePaymentIntent();
},
methods: {
pay () {
this.$refs.paymentRef.submit();
},
generatePaymentIntent() {
this.elementsOptions.clientSecret = this.$props.clientSecret;
}
},
};
</script>
And I've got those errors
What errors?
There's only one error and it's about undefined type error
Yes but a lot of different warning and I can't understand all of those..
And I can't understand what's wrong..
Did you pass a clientSecret to your custom component?
No but in the documentation I can't found it so I thought it was not important...
https://docs.vuestripe.com/vue-stripe/stripe-elements/payment
I check this documentation..
Easy to implement custom payment elements by Stripe.
And here is the code used
It's important, without a client_secret, the PaymentElement won't be rendered.
So the name of the props is just client_secret ?
And why the docs doesn't talk about it ?
Vue-stripe is a community library, not officially supported by Stripe.
https://stripe.com/docs/js/element/payment_element I'd suggest you to use the official JS reference to learn more about PaymentElement
Yeah but I only found about React and Next... But not Vue...
Vue is not officially supported I'm afraid.
Oh.. Do you know how can I could do so ?
Do you know others wrappers or something ?
Not as I know of. These are the official libraries that Stripe provides https://stripe.com/docs/libraries#client-side-and-ui-libraries