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

stueynet's avatar

Handling automatic subscription payments

I have watched the series here on stripe and I am currently using cashier, however it seems to leave out a key component which is handling the payment of a subscription payment. Cashier only provides a single method for when you cancel a subscription:

handleCustomerSubscriptionDeleted

However, every month, year etc... when a payment is made on an active subscription what is the best way to handle that? The stripe event that is fired is charge.succeeded with the charge. This relates to an invoice, which in turn relates to a customer and subscription.

Just wondering if anyone has a nice method you use to handle the charge.succeeded webhook and use it to update a user or send an email, or record it in your own billing system?

0 likes
1 reply
stueynet's avatar
stueynet
OP
Best Answer
Level 5

Ok got it:

 public function handleInvoicePaymentSucceeded($payload)
    {
        $user = $this->getUserByStripeId($payload['data']['object']['customer']);
        $subscription_id = $payload['data']['object']['subscription'];
        if ($user) {
            // Do all the things
        }

        return new Response('Webhook Handled', 200);
    }

Please or to participate in this conversation.