Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ajck's avatar
Level 1

Cashier Stripe subscription error - customer has no attached payment source (L5.4)

I'm using Stripe Checkout on the frontend and collecting user's card details then using Cashier on the backend to subscribe the user to a pre-defined Stripe plan. I get the error

(1/1) InvalidRequest This customer has no attached payment source

and checking the Stripe Dashboard shows the user (Stripe customer) does not have any card details associated even though I pass the token through to the subscription call as per docs etc.

Front end code:

<form action="{{url('subscribe')}}" method="POST" id="stripeform1" class="nodisplay">
{!! csrf_field() !!}
<input type="hidden" name="plan" value="individual">
    <script
        src="https://checkout.stripe.com/checkout.js" class="stripe-button"
        data-key="my_stripe_test_key"
        data-image="https://myapp.co/public/images/stripeicon.png"
        data-name="MyApp"
        data-zip-code="true"
        data-locale="auto"
        data-email="[email protected]"
        data-description="Subscription for Individual Plan"
        data-currency="gbp"
        data-amount="999"
        data-label="Subscribe!">
    </script>
</form>

and back end code:

\Stripe\Stripe::setApiKey(env('STRIPE_SECRET'));

// Create customer that we can then create a subscription or one-off charges for:
$customer = \Stripe\Customer::create(['email' => $request->input['stripeEmail'], 'source'  => $request->input['stripeToken']]);

// Attach user (as Stripe customer) to existing subscription plan defined in Stripe:
if($request->input('plan') == 'individual') $planID = env('STRIPE_INDIVIDUAL_PLAN_ID');
else if($request->input('plan') == 'business') $planID = env('STRIPE_BUSINESS_PLAN_ID');
$subscription = \Stripe\Subscription::create(['customer' => $customer->id, 'items' => [['plan' => $planID]]]);

Not sure where I am going wrong, other than thinking Stripe's way of doing subscriptions changed recently (now under 'Billing') and wondering if the Cashier's Stripe API calls are out of date? (I'm on Laravel 5.4)

Thanks for any suggestions.

0 likes
1 reply
ajck's avatar
Level 1

Fixed! Stripe customer create was using input as an array $request->input['stripeEmail.... rather than a function $request->input('stripeEmail....

Please or to participate in this conversation.