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

mikebronner's avatar

Cashier - How Can I Prompt User For Credit Card Info Before Trial Ends

I am in the process of migrating my users from Authorize.net to Stripe and am setting up their subscriptions using a larval seed class that reads their previous subscription information and creates new subscriptions based on that data.

So my thinking is to set them up with trial periods until their next billing cycle comes due, then ask them for their billing information.

Is there a way to have them enter their credit card information prior to their next billing cycle at a time of their choosing without billing them right away?

Thanks! :)

0 likes
4 replies
StormShadow's avatar
Level 51

Hi @mikebronner

You could perhaps send out an email with a link to a credit card form where they can enter their cc details, add/or set up a filter on any of your routes that require a subscription which steers them to that form.

Then if you are using Cashier and you mentioned said you are setting your users up to have stripe customer ids, you can simply do

Auth::user()->updateCard($stripe_token);

Jeff has a number of vids here about how to get the Stripe token.

Cheers!

1 like
mikebronner's avatar

Yea, I was checking out all the lessons Jeff made on Cashier :) I guess what I'm unclear on is at what point it will charge them if they enter their credit card information earlier. But that's probably less of a Cashier question, than a Stripe question.

StormShadow's avatar

Perhaps this helps:

The subscription method will automatically create the Stripe subscription, as well as update your database with Stripe customer ID and other relevant billing information. If your plan has a trial configured in Stripe, the trial end date will also automatically be set on the user record.

If your plan has a trial period that is not configured in Stripe, you must set the trial end date manually after subscribing:

$user->trial_ends_at = Carbon::now()->addDays(14);

$user->save();

to answer your question, all updateCard() does is send the cc to Stripe to associate it with the Stripe customer and make it the default card, it doesn't immediately charge it.

mikebronner's avatar

@StormShadow Thanks for throwing ideas out there. I figured it out :)

So what I needed to do was modify the billing form to not bill dollar amount or anything, like so:

<script>
    $(document).ready(function () {
        $('#updateBillingButton').on('click', function () {
            $('#stripe_form').attr('action', '/users/{{ Auth::user()->id }}/update-credit-card');
            handler.open({
                name: '<form name here>',
                email: '{{ Auth::user()->email }}',
                panelLabel: 'Update Credit Card'
            });
        });
    });
</script>

And add a new route to accept the form data, with he resulting update controller doing the following:

    public function update($userId)
    {
        $user = User::find($userId);
        $user->updateCard(Input::get('stripe_token'));
        $user->save();

        return redirect()->route('dashboard');
    }

Thanks for your pointers :)

Please or to participate in this conversation.