I was experimenting with Stripe JS and got in some issues with this error. Following is my Route View & JS File. When i submit the post, it gives me the following error, MethodNotAllowedHttpException
Route
> Route::get('buy', function () {
> return view('buy'); });
JS File
$( document ).ready(function(){ var StripeBilling = { init: function(){ this.form = $('.billing-form'); this.submitButton = this.form.find('input[type=submit]'); var stripeKey = $('meta[name="secret-key"]').attr('content'); Stripe.setPublishableKey(stripeKey); this.bindEvents(); }, bindEvents: function () { this.form.on('submit', $.proxy(this.sendToken, this)); }, sendToken: function (event) { this.submitButton.val('One Moment'); Stripe.createToken(this.form, $.proxy(this.stripeResponseHandler, this)); event.preventDefault(); }, stripeResponseHandler: function(status, response){ console.log(status, response); } }; StripeBilling.init(); })
Default View
@section('content') <div class="row"> <h1>Buy for $1</h1> {!! Form::open(['id' => '#billing-form']) !!} <div class="form-row"> <label> <span>Card Number:</span> <input type="text" data-stripe="number"> </label> </div> <div class="form-row"> <label> <span>CVC:</span> <input type="text" data-stripe="cvc"> </label> </div> <div class="form-row"> <label> <span>Expiration:</span> {!! Form::selectMonth(null , null, ['data-stripe' => 'exp-month']) !!} {!! Form::selectYear(null, date('Y'),date('Y') + 10, null, ['data-stripe' => 'exp-year'] ) !!} </label> </div> <div> {!! Form::submit('submit') !!} </div> {!! Form::close() !!} </div> @stop @section('footer') <script src="http://ift.tt/1HheyD3"></script> <script src="http://ift.tt/KXmU7y"></script> <script src="/js/billing.js"></script> @stop
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire