I'm using the CIM, storing a future billing date in our database, then I setup a cron job to bill someone when that date is smaller then current date..
I store customerprofileID and customerbillingID that is created by the CIM, then i just post a customertransaction for amounts every month..
easy to figure out a month after they signed up using:
function renewDate($start_date = FALSE) {
if ($start_date) {
$now = $start_date; // Use supplied start date.
} else {
$now = time(); // Use current time.
}
// Get the current month (as integer).
$current_month = date('n', $now);
// If the we're in Dec (12), set current month to Jan (1), add 1 to year.
if ($current_month == 12) {
$next_month = 1;
$plus_one_month = mktime(0, 0, 0, 1, date('d', $now), date('Y', $now) + 1);
}
// Otherwise, add a month to the next month and calculate the date.
else {
$next_month = $current_month + 1;
$plus_one_month = mktime(0, 0, 0, date('m', $now) + 1, date('d', $now), date('Y', $now));
}
$i = 1;
// Go back a day at a time until we get the last day next month.
while (date('n', $plus_one_month) != $next_month) {
$plus_one_month = mktime(0, 0, 0, date('m', $now) + 1, date('d', $now) - $i, date('Y', $now));
$i++;
}
return $plus_one_month;
}
If you need more code or details on how I do all this let me know.