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

Mick79's avatar

Stripe docs on laravel.com

I've implemented stripe several times on non-caravel setups. I believe I know the system and how it works pretty well.

However I've just been spending some time on the laravel.com docs reading about teh cashier integration and I feel pretty let down.

The documentation is written in a really confusing way. First off it tells you how to install all the required dependencies and get your models set up - fair enough.

But then it's straight into creating subscriptions. Is it just me or do the docs completely bypass a whole chunk of the process; taking card details, creating a customer etc.

I'm hoping there is something on Laracasts that is better.

0 likes
7 replies
aurawindsurfing's avatar

Hi,

I know exactly what you are saying. I hate to say that but I did the same mistake and did not read the documentation.

TL;TR Cashier is only for subscriptions, use Stripe SDK instead.

Introduction Laravel Cashier provides an expressive, fluent interface to Stripe's and Braintree's subscription billing services. It handles almost all of the boilerplate subscription billing code you are dreading writing. In addition to basic subscription management, Cashier can handle coupons, swapping subscription, subscription "quantities", cancellation grace periods, and even generate invoice PDFs.

If you're only performing "one-off" charges and do not offer subscriptions, you should not use Cashier. Instead, use the Stripe and Braintree SDKs directly.

Hope it helps!

martinbean's avatar

Cashier is only for subscriptions

Not true. I run a video on demand site that allows renting of videos, which are individual charges.

You can use Stripe to do one-off charges, or charge with an invoice.

aurawindsurfing's avatar

@martinbean I did not even touch Cashier due to this description:

If you would like to make a "one off" charge against a subscribed customer's credit card

So my understanding was that first I would have to create some subscription for that customer and only the do a once-off which in my eyes was different to simply create a customer and adding a card to his token.

But I'm probably wrong here.

Chris1904's avatar

Yes, you are wrong. There is a charge() method in the billable model, pretty straight forward and easy to use.

Check out my little snippet, it should explain a lot:

try {
    $hasPurchasedBefore = $this->user->stripe_id;

    if (! $hasPurchasedBefore) {
        $customer = $this->user->createAsStripeCustomer(request('stripeToken')['token']['id'], [
            'email' => request('stripeData')['email']
        ]);
    } else {
        $customer = $this->user->asStripeCustomer();

        $this->user->updateCard(request('stripeToken')['token']['id']);
    }
} catch (\Exception $e) {
    return response()->json(['status' => $e->getMessage()], 422);
}

$this->user is simply a user model.

martinbean's avatar

@aurawindsurfing You can make a charge just using a token; the customer doesn’t need to have a subscription.

So you would use Stripe’s JavaScript library to create a token from the user’s card details, and then have a controller make a charge using that token.

Please or to participate in this conversation.