简体   繁体   English

取消订阅后无法在 php 中的条带网关中再次订阅

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

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没有这样的订阅:sub_EMYom4xxxxx

seems subscription id doesn't match after unsubscribe.取消订阅后,订阅 ID 似乎不匹配。 Please suggest any solution.请提出任何解决方案。 Thanks in advance.提前致谢。

You can't reactivate a subscription after explicitly canceling it.明确取消订阅后,您无法重新激活订阅。 If you mark it for cancelation you have a window to "un-cancel" before the cancelation date hits.如果您将其标记为取消,您将在取消日期到来之前有一个“取消取消”窗口。

In this case you are canceling immediately so you'd need to create a new subscription entirely.在这种情况下,您将立即取消订阅,因此您需要完全创建一个新订阅。 See https://stripe.com/docs/billing/subscriptions/canceling-pausing#pausing-a-subscription请参阅https://stripe.com/docs/billing/subscriptions/canceling-pausing#pausing-a-subscription

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM