小编Dev*_*ven的帖子

尝试更新现有订阅时无效的trial_end

调用 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)

python django stripe-payments

2
推荐指数
1
解决办法
1255
查看次数

标签 统计

django ×1

python ×1

stripe-payments ×1