views:

20

answers:

2

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.

A: 

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.

Rahul
+1  A: 

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.

Faisal Feroz