调用 stripe 的 api 来更新客户的订阅时,出现错误。当用户在我的网站上执行操作时,他们可以免费获得数月的订阅。为了给用户免费几个月,我正在尝试更新trial_end参数以延长免费试用期。我得到的错误是:Invalid trial_end must be one of now
new_end_dt = datetime.now() + timedelta(days=30)
new_end_ts = new_end_dt.replace(tzinfo=timezone.utc).timestamp()
stripe.Subscription.modify(
self.stripe_subscription_id,
trial_end=new_end_ts,
trial_from_plan=False,
)
Run Code Online (Sandbox Code Playgroud)