frandiox / vue-use-stripe

Thin Vue 3 wrapper for Stripe.js
34 stars 10 forks source link

Type error when adding a card with options #2

Closed csbszb closed 3 years ago

csbszb commented 3 years ago

Hey @frandiox,

Thanks for this wrapper, it's very helpful!

I had an issue when I wanted to add a card element with custom options following your example:

const {
      stripe,
      elements: [cardElement],
    } = useStripe({
      key: process.env.VUE_APP_STRIPE_PUBLIC_KEY || '',
      elements: [{ type: 'card', options: {} }],
    })

The issue was that the ElementType type's options? attribute is the union of the different options, changing the AND to OR it works fine.

frandiox commented 3 years ago

@csbszb Glad you found it helpful! I've fixed that issue in 0.0.2. The new 0.1.0 supports Vue 2 and 3 at the same time but has 1 extra dependency (vue-demi). If you don't need Vue 2 you can stay in 0.0.2 and save 300 bytes 😛