如何处理每月订阅的不同天数?

发布于 2024-09-19 04:57:31 字数 204 浏览 7 评论 0原文

我正在开发一个 PHP 订阅网站,我想知道某些月份中的不同天数如何影响订阅?

例如,用户在 1 月 31 日注册按月订阅。

2 月有 28 天,所以我假设订阅会在 28 日处理。

我的问题是下个月会发生什么。订阅是在 28 日发生还是返回到首次创建时的 31 日?

感谢任何帮助,我不需要任何代码,我只想知道所使用的逻辑。谢谢。

I'm working on a PHP subscription site and I'm wondering how the different number of days in certain months affect subscriptions?

For example a user signs up the 31 of January for a monthly subscription.

In February there are 28 days so I assume the subscription gets processed the 28th.

My question is what happens the next month. Does the subscription occur the 28th or return to the 31st as when it was first created?

Any help is appreciated, I don't need any code I'd just like to know the logic used. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

还如梦归 2024-09-26 04:57:31

我认为最好在月底处理订阅。在我们公司,我们在月底开始处理订阅,我们计划在月底进行批处理,并处理所有订阅。

这些的处理/计费方式完全不同。根据我们的政策,新订阅按比例计费,即,如果用户在当月 5 日之后注册,则根据该月的天数向用户计费。取消流程与此相同,但如果在当月 15 日之前取消,则按比例分配。

I think it is best that subscriptions be processed on the end of the month. In our company we start processing the subscriptions on the end of the month, we have a batch process scheduled for the end of the month and it processes all the subscriptions.

How these are processed/billed is totally different. According to our policy the new subscriptions are pro-rated i.e., the user is billed according to the number of days that were in the month if the user signed up after 5th of the month. Same is the process of cancellation but it gets prorated if the cancellation is done before 15th of the month.

各自安好 2024-09-26 04:57:31

假设每月订阅量为 X,此人在第 Y 天订阅,并且该特定月份有 Z 天。

我只需向 X*(ZY/Z) 收取该月的费用,并将计费日期设置为此后每月的第一天/最后一天。

Lets say the monthly subscription is X, the person subscribes on the Yth day and there are Z days in that particular month.

I would simply charge the guy X*(Z-Y/Z) for that month and bring the billing date to the first/last day of every month after that.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文