Stripe API | Nova Framework | Tutorials

David Carr

Stripe API resume a cancelled subscription

When a Stripe subscription is canceled for the end of the period it can be resumed before the cancellation is complete.

I’m using Nova Framework not setup with Nova? please read Getting Stripe API setup with Nova Framework

A subscription that has passed its cancel window or has been canceled immediately cannot be resumed. To resume a subscription the process is to retrieve the subscription by its id then assign the plan id of the original plan and save.  

First get the customers information, if you don’t have this method please read Stripe API get customer information

From the $customer the subscription can be retrieved. In this case, the plan_id comes from a database, adding the same plan id resumes the subscription.

From here it's a good idea to update any information you are storing such as the end dates and status.

$customer = $this->getCustomer();

if ($customer != null) {

    if (isset($customer->subscriptions->data[0])) {
        $subscription_id = $customer->subscriptions->data[0]->id;

        $stripe = $customer->subscriptions->retrieve($subscription_id);
        $stripe->plan = Auth::user()->plan_id;
        $result = $stripe->save();

        $user = User::find(Auth::id());
        $user->current_period_end = date('Y-m-d H:i:s', $result->current_period_end);
        if ($result->canceled_at) {
            $user->canceled_at = date('Y-m-d H:i:s', $result->canceled_at);
        $user->cancel_at_period_end = ($result->cancel_at_period_end) ? 'true' : 'false';

        $user->status = $result->status;



Domains are often purchased from multiple providers, keeping track of where a domain is and its DNS settings can be tricky. Domain Mapper solves this by listing all your domains in one place. View your DNS settings and receive reminders to renew your domains. Try it today.

Support my work by donating with PayPal.

Subscribe to my newsletter

Subscribe and get my books and product announcements.

© 2009 - 2021 DC Blog. All code MIT license. All rights reserved.