So I looked into Cashier's StripeGateway file, which has this function :
public function cancel($atPeriodEnd = true)
{
$customer = $this->getStripeCustomer();
if ($customer->subscription) {
if ($atPeriodEnd) {
$this->billable->setSubscriptionEndDate(
Carbon::createFromTimestamp($this->getSubscriptionEndTimestamp($customer))
);
}
$customer->cancelSubscription(['at_period_end' => $atPeriodEnd]);
}
if ($atPeriodEnd) {
$this->billable->setStripeIsActive(false)->saveBillableInstance();
} else {
$this->billable->setSubscriptionEndDate(Carbon::now());
$this->billable->deactivateStripe()->saveBillableInstance();
}
}
Now it appears that when the account is canceled, two functions run - cancelSubscription and deactivateStripe. I didn't find a documented way to run something on account expire, so I figured I might have to extend these methods and run it myself, but I'm a bit lost on how to do it.