我正在将订阅结算日期更改为自定义日期。我用“StripeSubscriptionUpdateOptions”方法尝试过。但是当我将“BillingCycleAnchor”与我的日期一起传递时,它给出了错误。
错误:“更新现有订阅时,billing_cycle_anchor 必须未设置、‘现在’或‘未更改”
之后使用“BillingCycleAnchorNow = now”属性修改代码。它将我的订阅日期更改为 30 天后的日期。 (我在 01/04/2024 尝试过,它将计费日期更改为 01/05/2024)。如何使用自定义日期更改日期? 这是我尝试过的;
public int newSPayment()
{
int issuccess = 0;
var service = new
StripeSubscriptionService(ConfigurationManager.AppSettings["StripeApiSecretKey"]);
DateTime newNextBillingDate = DateTime.UtcNow.AddDays(5);
var subscriptionId = "sub_1OwGLfCKifPDqZIAQib3UnBL";
var cusID = "cus_PjzMQRteo1FhAQ";
var updateOptions = new StripeSubscriptionUpdateOptions
{
BillingCycleAnchor = newNextBillingDate,
BillingCycleAnchorUnchanged = true,
BillingCycleAnchorNow = true,
};
var updatedSubscription = service.Update(cusID,subscriptionId, updateOptions);
}
请帮我解决这个问题。
在订阅级别执行此操作的唯一方法是使用
trial_end
参数。这将在该日期之前开始试用,然后重置计费周期(不要忘记使用 proration_behavior=none
禁用按比例分配)。
安排将来重置的官方解决方案是使用订阅计划: