条纹表单未提交

时间:2014-11-23 03:05:26

标签: laravel laravel-4 stripe-payments

我的条纹表单未提交。当我按提交时,它转到页面无法显示。我替换了路由代码以解决回声"测试&#34 ;;并且post请求显示echo。任何帮助,将不胜感激。此代码来自教程http://www.sitepoint.com/selling-downloads-stripe-laravel/

路线

Route::get('/buy/{id}', function($id)
{
$download = Download::find($id);    
return View::make('buy', array('download' => $download));
});

Route::post('/buy/{id}', function($id)
{
Stripe::setApiKey(Config::get('laravel-stripe::stripe.sk_test_aaaaaaaaaaaaaaaaaaaaaaaa'));

$download = Download::find($id);
$token = Input::get('stripeToken');
// Charge the card
try {
    $charge = Stripe_Charge::create(array(
        "amount" => $download->price,
        "currency" => "gbp",
        "card" => $token,
        "description" => 'Order: ' . $download->name)
    );
    // If we get this far, we've charged the user successfully
    Session::put('purchased_download_id', $download->id);
    return Redirect::to('confirmed');

} catch(Stripe_CardError $e) {
    // Payment failed
    return Redirect::to('buy/'.$id)->with('message', 'Your payment has failed.');       
}
});

查看

@extends('layouts.default')

@section('content')

<h1>Your Order</h1>

<h2>{{ $download->name }}</h2>

<p>£{{ ($download->price/100) }}</p>

<form action="" method="POST" id="payment-form" role="form">

<input type="hidden" name="did" value="{{ $download->id }}" />

<div class="payment-errors alert alert-danger" style="display:none;"></div>

<div class="form-group">
<label>
  <span>Card Number</span>
  <input type="text" size="20" data-stripe="number" class="form-control input-lg" />
</label>
</div>

<div class="form-group">
<label>
  <span>CVC</span>
  <input type="text" size="4" data-stripe="cvc" class="form-control input-lg" />
</label>
</div>

<div class="form-group">  
<label>
  <span>Expires</span>      
</label>
<div class="row">
  <div class="col-lg-1 col-md-1 col-sm-2 col-xs-3">
    <input type="text" size="2" data-stripe="exp-month" class="input-lg" placeholder="MM" />
  </div>  
  <div class="col-lg-1 col-md-1 col-sm-2 col-xs-3">
    <input type="text" size="4" data-stripe="exp-year" class="input-lg" placeholder="YYYY" />
  </div>
</div>
</div>

<div class="form-group">
<button type="submit" class="btn btn-primary btn-lg">Submit Payment</button>
</div>
</form>

@stop

0 个答案:

没有答案