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
Share on other sites

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.

Link to comment
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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

@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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.