Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to access the cardElement? #129

Open
Ale-RJP opened this issue May 27, 2020 · 1 comment
Open

Is there a way to access the cardElement? #129

Ale-RJP opened this issue May 27, 2020 · 1 comment

Comments

@Ale-RJP
Copy link

Ale-RJP commented May 27, 2020

I'm trying to confirm the card payment, to be able to do it, I need to provide the cardElement inside the payment method (https://stripe.com/docs/js/payment_intents/confirm_card_payment)

Is there a way to get it? Currently i'm able to mount a stripe element on top of the v-stripe-card component, it works but the component looses its visual attributes.

I hope you can help me, or maybe point me to a solution.

@ghost
Copy link

ghost commented Jul 7, 2020

If you assign a ref attribute to the v-stripe-card element, you should be able to access the cardElement from there:

<template>
  <v-stripe-card
    ref="stripeElement"
    v-model="token"
    :api-key="process.env.VUE_APP_STRIPE_API_KEY"
  />
</template>

<script>
  export default {
    data: () => ({
      token: null
    }),
    methods: {
      payment: () => {
        this.$refs.stripeElement.card // This is the cardElement
        // Confirm the card payment ...
      }
    }
  }
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant