检索结束日期为某一天的所有订阅 Stripe
Retrieve all subscriptions Stripe with an end date of certain day
尝试提取结束日期等于特定日期(不包括小时、分钟或秒)的所有订阅
因此,如果我有两个订阅的结束日期是今天,那么 2021 年 3 月 15 日,我想加入以下订阅
-3/15/2021 4:27:13 下午
-3/15/2021 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:00AM 和 11:59 PM 之间做一个 CurrentPeriodEnd 但它必须是一个 equals inside 才能传递参数
非常感谢任何帮助。谢谢!
进一步查看 Current Period End 后,它实际上是
AnyOf
所以我的新代码行是
CurrentPeriodEnd = new DateRangeOptions() { GreaterThanOrEqual = DateTime.Today, LessThan = DateTime.Today.AddDays(1)},
正如the docs所说:
The value can be a string with an integer Unix timestamp, or it can be a dictionary with the following options...
为此,您可以使用该选项字典来提供 gte
和 lte
来限定您要查找的日期,借用 example from the library repository:
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
);
您需要在代码中对返回的结果应用任何进一步的过滤。
尝试提取结束日期等于特定日期(不包括小时、分钟或秒)的所有订阅
因此,如果我有两个订阅的结束日期是今天,那么 2021 年 3 月 15 日,我想加入以下订阅 -3/15/2021 4:27:13 下午 -3/15/2021 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:00AM 和 11:59 PM 之间做一个 CurrentPeriodEnd 但它必须是一个 equals inside 才能传递参数
非常感谢任何帮助。谢谢!
进一步查看 Current Period End 后,它实际上是
AnyOf
所以我的新代码行是
CurrentPeriodEnd = new DateRangeOptions() { GreaterThanOrEqual = DateTime.Today, LessThan = DateTime.Today.AddDays(1)},
正如the docs所说:
The value can be a string with an integer Unix timestamp, or it can be a dictionary with the following options...
为此,您可以使用该选项字典来提供 gte
和 lte
来限定您要查找的日期,借用 example from the library repository:
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
);
您需要在代码中对返回的结果应用任何进一步的过滤。