dlf1987 Posted August 25, 2008 Share Posted August 25, 2008 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 Quote Link to comment Share on other sites More sharing options...
joquius Posted August 25, 2008 Share Posted August 25, 2008 I've got a feeling you might want to install some merchant tools software.. Quote Link to comment Share on other sites More sharing options...
dlf1987 Posted August 25, 2008 Author Share Posted August 25, 2008 Nah, i already have everything setup admin side, including the first payment, just need to figure out some way of making the payments charged monthly. :/ Ive already tried a few different services, and none allow the customization that i need. Quote Link to comment Share on other sites More sharing options...
dlf1987 Posted August 25, 2008 Author Share Posted August 25, 2008 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 Quote Link to comment Share on other sites More sharing options...
xoligy Posted August 25, 2008 Share Posted August 25, 2008 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 Quote Link to comment Share on other sites More sharing options...
dlf1987 Posted August 25, 2008 Author Share Posted August 25, 2008 Good idea, thanks now i just need to learn how to setup cron Quote Link to comment Share on other sites More sharing options...
Jabop Posted August 25, 2008 Share Posted August 25, 2008 @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 Quote Link to comment Share on other sites More sharing options...
dlf1987 Posted August 25, 2008 Author Share Posted August 25, 2008 Thanks Jabop. another question, what if someones subscription started on Jan 31st, exactly 30 days(1 month) from Jan 31st would be March 2nd, so how would i add 30 days to Jan 31st in PHP, so that i can save that date in mysql as the next payment due date Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.