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

digitalagua's avatar

Cashier and Stripe

I am in the process of adding subscriptions with Laravel Cashier and Stripe to my website. I know Cashier handles some basic webhooks for cancelling subscriptions.

Cashier automatically handles subscription cancellation on failed charges, but if you have additional Stripe webhook events you would like to handle, simply extend the Webhook controller.

This is the first time I have added Cashier and Stripe to a site and I am wondering what isn't handled out of the box that I should be thinking of. Any webhooks that I need to handle or any gotchas. If you have implemented a Cashier Stripe solution to your site, it would be great to get your thoughts on the topic. Especially anything you didn't think about that you discovered you needed after launch.

0 likes
3 replies
mikefolsom's avatar

Laravel\Cashier\Http\Controllers\WebhookController only provides a concrete implementation for canceling a subscription. But its handleWebhook method will attempt to delegate to any custom methods you provide by converting the Stripe payload type to "studly" case:

    public function handleWebhook(Request $request)
    {
        $payload = json_decode($request->getContent(), true);

        if (! $this->isInTestingEnvironment() && ! $this->eventExistsOnStripe($payload['id'])) {
            return;
        }

        $method = 'handle'.studly_case(str_replace('.', '_', $payload['type']));

        if (method_exists($this, $method)) {
            return $this->{$method}($payload);
        } else {
            return $this->missingMethod();
        }
    }
mikoo's avatar

I modified my Billable trait to have the Stripe functionality I want.

Please or to participate in this conversation.