온라인으로 Laravel 5.2와 스트라이프를 통합 할 수있는 온라인 도움말을 찾을 수 없습니다. 이 때문에 버전 :(어쨌든단발 StaraeJS로 Laravel을 사용하여 5.2
사이에 많은 중단 된이 프레임 워크를 배우고 도전하고있어, 여기에 양식이 완료되면 내가 입력을
$(function() {
var $form = $('#payment-form');
$form.submit(function(event) {
// Disable the submit button to prevent repeated clicks:
$form.find('.submit').prop('disabled', true);
// Request a token from Stripe:
Stripe.card.createToken($form, stripeResponseHandler);
// Prevent the form from being submitted:
return false;
});
});
function stripeResponseHandler(status, response) {
// Grab the form:
var $form = $('#payment-form');
var CSRF_TOKEN = $('meta[name="csrf-token"]').attr('content');
if (response.error) { // Problem!
// Show the errors on the form:
$form.find('.payment-errors').text(response.error.message);
$form.find('.submit').prop('disabled', false); // Re-enable submission
} else { // Token was created!
// Get the token ID:
var token = response.id;
console.log(token);
// Insert the token ID into the form so it gets submitted to the server:
$form.append($('<input type="hidden" name="stripeToken">').val(token));
// Submit the form:
$form.get(0).submit();
}
};
을 캡처
JS 파일과 함께 일하고 있어요 무엇 나는 여기
Route::any('/success', ['as' => 'success', 'uses' =>'[email protected]']);
은 내 컨트롤러 형태로
action=""
속성을 통해
{{ route('success') }}
에 대한 사용자.입니다 경로 당신이 내가 대신 점원의
StripeJS documentation을 사용하여 찾고 있어요
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Requests\CreateSongRequest;
use Illuminate\Foundation\Http\FormRequest;
use Billable;
use Input;
class ChargeController extends Controller
{
public function pay(Request $request){
if(Input::has('stripeToken')){
$token = Input::get('stripeToken');
$amount = 10;
// I cannot use this part even though it is in the stripe documentation
$customer = Stripe_Customer::create(array(
'card' => $token
));
$charge = Stripe_Charge::create(array(
'customer' => $customer->id,
'amount' => ($amount*100),
'currency' => 'usd',
'description' => "test"
));
echo 'success!';
}
}
}
작동하지 않습니다 볼 수있는 스트라이프 ...에서 제공하는 코드입니다. 현재,이 오류
Fatal error: Class 'App\Http\Controllers\Stripe_Customer' not found
찾고 있어요 그리고 설명서가 끝나는 곳이다. 어떤 도움이 필요합니까? 계산원을 사용하는 것을 선호하지만 "비 가입"기반의 사용에 대한 문서를 찾을 수 없으며 laravel 웹 사이트는별로 도움이되지 않습니다.
고객에게 Stripe_Customer 클래스가 있습니까? –
해당 오류가 컨트롤러를 찾고 있습니까? 해당 위치에 Stripe_Controller가 있습니까? –
@AchrafKhouadja 거기에 무엇을 넣을 지 알려주는 튜토리얼이 없기 때문에 클래스가 존재하지 않습니다. StripeJS 문서가 그곳에서 멈추는 것 –