检索结束日期为某一天的所有订阅Stripe



尝试拉入结束日期等于某个日期的所有订阅,不包括小时、分钟或秒

因此,如果我有两个截止日期在今天的订阅,那么2021年3月15日,我想获得以下订阅-2021年3月15日下午4:27:13-2021年3月15日下午5:27:13

var options = new SubscriptionListOptions
{
CurrentPeriodEnd = DateTime.Now,
};
var service = new SubscriptionService();
StripeList<Subscription> subscriptions = service.List(options);
foreach (Subscription sub in subscriptions)
{
string customerId = sub.CustomerId;
}

这就是我到目前为止所拥有的。我想在今天凌晨12:00到晚上11:59之间做一个CurrentPeriodEnd,但它必须是内部相等的才能传递参数

非常感谢您的帮助。谢谢

在进一步查看当前期间结束后,它实际上是任意<日期时间?,DateRangeOptions>

所以我的新代码行是

CurrentPeriodEnd = new DateRangeOptions() { GreaterThanOrEqual = DateTime.Today, LessThan = DateTime.Today.AddDays(1)},

正如文档所说:

该值可以是具有整数Unix时间戳的字符串,也可以是具有以下选项的字典。。。

为此,您可以使用选项字典提供gtelte来绑定您要查找的日期,从库存储库中借用一个示例:

var CurrentPeriodEndOptions = new DateRangeOptions
{
LessThanOrEqual = DateTime.Parse("2021-03-16T00:00:00.0000000Z"),
GreaterThanOrEqual = DateTime.Parse("2021-03-15T00:00:00.0000000Z"),
},
var options = new SubscriptionListOptions
{
CurrentPeriodEnd = CurrentPeriodEndOptions,
};
var service = new SubscriptionService();
StripeList<Subscription> subscriptions = service.List(
options
);

您需要在代码中对返回的结果应用任何进一步的筛选。

最新更新