php - Stripe Api error: Must provide source or customer
one text
Solution:
Most likely you just need to add event.preventDefault()
immediately inside $form.submit
. What's probably happening now without that is the form is submitting before the async Stripe token function returns and adds the hidden input, so then on your backend $request->input('stripeToken')
is null.
$form.submit(function(event) {
event.preventDefault();
$('#charge-error').addClass('hidden');
...
Source