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?
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);
}