[英]Stripe, Cancel subscription with PHP
I am trying to cancel a stripe subscription using PHP at the end of the current period but cannot find any examples of the version I use nor in the documentation.我试图在当前期间结束时使用 PHP 取消条带订阅,但在文档中也找不到我使用的版本的任何示例。
My code is as follows我的代码如下
$stripe->subscriptions->cancel(
$subscription_id,
[
'invoice_now' => true,
'cancel_at_period_end' => true
]
);
However, this doesn't work and I cannot find how to set the subscription to end at the end of the period.但是,这不起作用,我找不到如何将订阅设置为在订阅期结束时结束。
You can't pass the cancel_at_period_end
parameter when calling the subscription cancel endpoint.调用订阅取消端点时不能传递cancel_at_period_end
参数。 Instead the subscription will be cancelled immediately .相反,订阅将立即取消。
Instead you should call the subscription update endpoint and pass the associated parameters:相反,您应该调用订阅更新端点并传递相关参数:
$stripe->subscriptions->update(
$subscription_id,
[
'cancel_at_period_end' => true
]
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.