Jump to content

Automatic Monthly Billing


dlf1987

Recommended Posts

Hi, I'm working on a site where i want to be able to charge my customers credit card monthly. Its always the same monthly fee (unless they change the service type) i just cant figure out the best way to make something in php that automatically charges them monthly... i could manually run the script every morning or something, i just cant figure out the best way to set something like this up.

 

i use: PHP / MYSQL

Link to comment
https://forums.phpfreaks.com/topic/121287-automatic-monthly-billing/
Share on other sites

Right now, the only way i see doing this, is when the initial charge is made, that a 2nd entry is made in mysql with a due date of 1 month later. Then i could make a page that pulls unpaid entrys for certain dates. Anyone else have any other ideas?

 

example:

___________________________________

MYSQL

 

order#  -  cost  -  paydate  -  Payments

 

12300  -    $5    -  7-15-08  -  Paid

12300  -    $5    -  8-15-08  - 

12301  -    $10  -  7-16-08  -  Paid

12301  -    $10  -  8-16-08  -

___________________________________

Due Payments Page:

 

12300  -  $5  -  8-15-08

12301  -  $10 -  8-16-08

___________________________________

 

 

Little illustration :P

Im not good with php but couldn't you write something like a count up function that looks at the date they last paid and then after lets say 30days notices that there subscription has ended and then charges them again by getting the current date? So say i pay for a sub at the begining of the month then 30days later the function kicks in does a count of how many members need to re-pay and then inserts the current date into the db? Of cause the function would have to be run from a cron file say at midnight or somthing its probably the way i would look into things

@xoligy

then why are you on this forum?

 

@dlf1987

cron jobs are easy. run crontab -e via terminal and set it up as needed. example:

 

* * * * * php public_html/admin/cron/surveys.php

 

This is a crontab I have that executes a script every minute upon every hour, upon every day, upon every month, each day of the week.

 

It's very easy to learn, check this link out. http://www.adminschoice.com/docs/crontab.htm

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.