after unsubscribe can't able to subscribe again in stripe gateway in php

Viewed 450

Here is my unsubscribe function

    public function cancelSubscription($ssid)
     {
    try {
        \Stripe\Stripe::setApiKey(SSK);

        $subscription = \Stripe\Subscription::retrieve($ssid);
        if ($subscription['status'] == 'canceled') {
            return $subscription['status'];
        }
        $subscription->cancel();
        return $subscription;

    } catch (Exception $e) {
        echo '<pre>';
        print_r($e->getMessage());
        echo '</pre>';
        die('error!- customer');
    }
}

Its working fine but when I am trying to upgrade my plan or trying to subscribe again I am getting an error.

No such subscription:sub_EMYom4xxxxx

seems subscription id doesn't match after unsubscribe. Please suggest any solution. Thanks in advance.

1 Answers
Related