matfish2 / vue-stripe

Vue.js 2 Stripe checkout component
https://www.npmjs.com/package/vue-stripe
MIT License
58 stars 18 forks source link

Where to set up the product objet #6

Closed catlabs closed 7 years ago

catlabs commented 7 years ago

Hi,

I m brand new to both stripe and vuejs so my question might be very basic but I don't understand where am I supposed to set up the product json object, neither the options.

I have generated the basic js of laravel 5.3 and I thought I should specify this like so:

import { StripeCheckout } from 'vue-stripe';

Vue.component('stripe-checkout', StripeCheckout);

const app = new Vue({
    el: '#app',
    data: {
        product: {
            name: 'Moby Dick',
            description: 'I love whales',
            amount: 100000 // 100$ in cents
        },
        options: {
            zipCode:true
        }
    }
});

Can you tell me what I m doing wrong?

Thanks in advance!

matfish2 commented 7 years ago

Did you set the view layer? You need to declare the component in your HTML:

<stripe-checkout stripe-key="your-stripe-key" :product="product" :options="options"></stripe-checkout>
catlabs commented 7 years ago

Allright it works with :product instead of product.

Thanks!