Hey :)
I am currently working on a subscriptions feature on my project and I am following the laracasts payments series
https://laracasts.com/series/how-to-accept-payments-with-stripe
I am using:
laravel 5.2
vue 2.0.1
I am recieving the above error when I am trying to load my stripe checkout form, when I remove all references to email t debug the issue, I get a different error:
Uncaught ReferenceError: StripeCheckout is not defined
CheckoutForm.vue
<option v-for="plan in plans" :value="plan.id">
{{ plan.name }} — ${{ plan.price /100 }}
</option>
Subscribe
{{ status }}
export default {
props:['plans'],
data(){
return {
stripeEmail: '',
stripeToken: '',
plan: 1,
status: false
};
},
created() {
this.stripe = stripeCheckout.configure({
key: configs.stripeKey,
image: "{!! URL::to('/img/icons/passport.128.png') !!}",
locale: 'auto',
panelLabel: "Subscribe For",
token: (token) => {
this.stripeToken = token.id;
this.stripe = token.email;
this.$http.post('/subscriptions', this.$data)
.then(
response => alert('complete! Thanks for your payment'),
response => this.status = response.body.status
)
}
});
},
methods: {
subscribe(){
let plan = this.findPlanById(this.plan);
this.stripe.open({
name: 'Site Passport',
description: 'plan.name',
currency: 'eur',
amount: plan.price
});
},
findPlanById(id){
return this.plans.find(plan => plan.id == id);
}
}
}
snippet from my subscribe.blade.php
var configs = {
csrfToken: "{{ csrf_token() }}",
stripeKey: "{{ config('services.stripe.secret') }}"
}
<checkout-form :plans="{{ $plans }}"></checkout-form>
package.json
{
"private": true,
"devDependencies": {
"gulp": "^3.8.8",
"gulp-bower": "0.0.10",
"laravel-elixir-vue": "^0.1.8",
"laravel-elixir-vueify": "^1.0.6",
"vue": "^2.0.1",
"vue-resource": "^1.0.3"
},
"dependencies": {
"laravel-elixir": "^3.0.0",
"bootstrap-sass": "^3.0.0"
},
"browser": {
"vue": "vue/dist/vue.common.js"
}
}
app.js
require('./bootstrap');
import Vue from 'vue/dist/vue.common.js'
import CheckoutForm from './components/CheckoutForm.vue'
Vue.component('CheckoutForm',CheckoutForm)
new Vue({
el: '#app'
});
Has anyone come across this Also anyone have any good tips for debugging vue, errors are quiet vague
Thanks :)