Level 1
"alert($('#stripeToken').value);" shows "undefined".
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have this form for a payment with Stripe. When the "Pay" is clicked the stripe modal don't appears, user is redirected to "http://proj.test/chargeStripe" and shows : "{ "status": "Must provide source or customer."}".
Form for payment with stripe:
<form action="{{ route('payment.chargeStripe') }}" method="post" id="paymentForm">
{{csrf_field()}}
<div id="credit_card_section">
<span>Please click in "Pay" to pay.</span>
<input type="hidden" name="stripeToken" id="stripeToken"/>
<input type="submit" href="" id="payment" class="btn btn-primary" value="Pay"/>
</div>
</form>
JS:
$(function () {
alert("test");
let stripe = StripeCheckout.configure({
key: "{{config('services.stripe.key')}}",
image: "",
locale: "auto",
token: (token) => {
document.querySelector('#stripeToken').value = token.id;
}
});
});
Please or to participate in this conversation.