Portal Home > Knowledgebase > Articles Database > SWREG Recurring Billing Scripts


SWREG Recurring Billing Scripts




Posted by Raiak, 05-12-2002, 11:30 PM
Just noticed this was posted in the wrong board. Sorry * After locating this service, i've become to realise that if i want to offer my services ( when they launch ) vertually world wide, this is the best company to pick. As their Free to join, competive rates and transparent to users. So i decided to create some scripts ( PHP and MySQL ) to automate billing and recurring billing. I'll be distributing the main swreg gateway script free of charge on these forums, for all to use. However im not yet decided on the Main Billing and Recurring Billing scripts yet. I'll see how my work goes. ( Please feel free to leave your feedback ) Here's whats done so far. The scripts are made up of 3 elements. The main swreg gateway script. This sends an order to the swreg server, and retreaves the responce, then acts acordingly ( accepted, declined etc ) Billing System This stores all the users information in a database ( MySQL currently ) on the x of each much, dependant on when the user signed up, the script rebill's the user. Forming a recurring billing system. If the card is then declined, the account is place in a seperate mode, where the card is tried again after 24 hours. This process will repeat x times, before the account is placed as suspended. The system will also send out e-mails to the system operator and the user. The recurring and rebilling scripts are executed through Cron Jobs. Affiliate Scheme Theirs also a built in Affiliate scheme, which keeps track of which users signed up from who. You set up how these affiliates are rewarded, and the system does the rest. At the end of each month, you get an e-mail sent, letting you know which affiliates are owed how much ( Time to go to the bank and get some check's written out ) You are also able to limited payouts to affiliates who reach X amount of money. I'm also going to work on a 4th script, which is an invoice script. Keeping track of all users invoices, payments etc. I've finished work on the swreg gateway script, just fixing minor and major bugs. And i've started work on the first 3 elements of the Billing System. I'll keep all users updated as i progrss. Hopefully i'll get the gateway finished. And all who wish's to use swreg can. without the hard work. btw : the billing scripts will be built around swreg, although i will be adapting for other services, such as ProPay, PayPal, Authorize.NET and hopefully WorldPay. Last edited by Raiak; 05-12-2002 at 11:42 PM.

Posted by chrisb, 05-13-2002, 04:48 AM
Thanks for the info, and for working on the scripts. Please let us know when you've completed them. I can't believe no one else has replied to your post. This is a good thing.

Posted by ASPCode.net, 05-13-2002, 05:12 AM
Like your attitude - sharing the code for free is really nice of you - and although I have participated in the earlier swreg discussions here, and really found it interesting ( currentlly with 2checkout.com ) I still havn't had the time to look into it more closely. Might do it now after getting a head start from you Raiak

Posted by Darth, 05-13-2002, 09:42 AM
Nice

Posted by Raiak, 05-13-2002, 01:09 PM
Thanx for the replys, i have only coded PHP/MySQL for about a year now. Although i will be making 100% sure the scripts are fully functional and working before they are released. I'll be setting up a web site l8r on, to example the scripts, and how they work, Not sure where ill host this. I'm finishing off the Major bugs at the moment. Its (Sods-Law) at the moments. I fix one minor bug, which leads to one new major bug. Hopefully ill have a working modal by this evening or early tommorow morning. (UK Time) Everyone should be able to use the script, no additional coding should be needed. Just pass some Form Post/Get variables to it and your away. I'm off now to finish off the bug coding. I'll get back to all l8r on.

Posted by Darth, 05-13-2002, 01:40 PM
Keep up the good work Raiak .

Posted by 5angle.com, 05-13-2002, 05:51 PM
i'm sure a lot of people are anxious to play with this

Posted by Darth, 05-13-2002, 08:18 PM
Yea im idling at this page lol

Posted by Raiak, 05-13-2002, 10:35 PM
Ok, the Element 1, the gateway scripts are finished. Im just doing a little admin script, to save ppl ****ing around with the database. I've took the script a little further than i was going to, i've included HTML Template Support, so users can change the look to match and fit their web site. I've added add the required fields for use with the Billing scripts, when i get them started. So hopefully it will just be a case of Plug'n'Play! with minor database changes The scripts report to swreg, and report back without the user ever going to their site, ( Well, thats how it looks to your users ) It reports all errors, like ( card declined ) ( expiry date incorrect ) etc. Hopefully, the admin script will only take a few hours to code. All it will be used for is checking new orders, updating products. So it should be done in no time. Then all can get their hands on it

Posted by Darth, 05-13-2002, 10:48 PM
Blimey your quick heh

Posted by Raiak, 05-13-2002, 10:51 PM
When i start on a project, i don't stop! Virtually dont stop. 1 Break to eat, 1 Break to work ( Well. even i have to earn cash ) and 1 break to sleep'n'wash ) Apart from that, its code-code-code. I must admit, i prefer coding games, than dynamic scripts, but if others can make use of it, ill do it

Posted by Raiak, 05-13-2002, 11:05 PM
I know i've just posted, but i thought i would just add - I've gone a little two far. I've added both the recurring billing and the gateway together. I know i said i was going to do this as 2 different elements of the suite, but after all, web hosting does need to be rebilled. So i've joined them together. I need some ppl to help test it. Only ask if you have a server, PHP, MySQL and access to cron jobs ( to execute the rebill script ) Im coding these scripts on Win XP, so i'll need a Unix based system testers.

Posted by Darth, 05-13-2002, 11:36 PM
Ill be a lab rat heh

Posted by Starhost, 05-14-2002, 09:00 AM
Cron Jobs aren't nesecary I programmed my own Bill script. And I did the recurring billing without any cron job. Just by specifing the Query better. I don't know if I'll make it open Source because I really programmed it layzy and it isn't PHP > 4.1.0 COmpactible yet, because of the way they want you to handle the variables. Though I would be glad to help you develop when you need some advice on how I did it.

Posted by Raiak, 05-15-2002, 08:01 AM
It is best to use Cron Jobs, so then the scripts are executed on time. If you don't, then you yourself will have to manually execute the script, or wait for a user to visit your site before the scripts run. Since these scripts will have both Recurring Billing, and Declined Card Rebilling ( The card is tried again, 24 hours later if it is returned as declined ) then it is best to make sure the scripts are run on time. Sorry ppl for not being around the for the last day, i was working nights last night, and did not finish work till 6am this morning. Anyway im up now, and rearing to go. Im still working on the Rebill script. The main order scripts are now compleatly finished, however i've decided to hold off issueing to TAR/ZIP file, as web hosting does require Rebilling. So i'm now woking flat out on the 2 Rebill scripts, One monthly ( Recurring ) and one 24 hour script ( for declined cards ) BBL.

Posted by cahostnet, 05-15-2002, 03:05 PM
Great idea and good luck with it. I'm interesting so keep us posted. Why are you rebilling declined cards? Just wondering.

Posted by Raiak, 05-15-2002, 10:06 PM
Its called Declined Card Automated Rebilling (DCAR) - And its used by merchant account providers to rebill a card 24 hours after it is declined. The card could have been declined for various reasons, broken session with the bank, not enough funds in the bank ( maybe the user don't get paid for another 2 days ) etc. With DCAR, the card is retried again, every 24 hours for 3 days. Then the account is placed as susspended. I know a lot of Gateway Providers, such as Worldpay, Authorize etc, do not use DCAR, so if your card is declined for any reason, you need to setup a new agreement with them. This get's really fustration for people like myself, who gets paid every 4 weeks, so one month i get paid at the beginning, another i may get paid at the end. Hence, the card may be declined from one service from time to time. Not because the cards stolen, because theirs no funds in my bank ( Debit cards mostly ) Last edited by Raiak; 05-15-2002 at 10:14 PM.

Posted by Darth, 05-15-2002, 10:15 PM
cool

Posted by Raiak, 06-18-2002, 12:25 PM
Ok, its been two long i know. But i have been working virtually none stop on the scripts for the last 2 days, and compleatly recoded the main core from scratch. Why, as you proberly aware, im mostly coding these scripts for my use. To work how i want them two, so i've recoded the core to act the way my hosting will work. I belive this new kind of way will be of intrest to other users as well, so here it is. Users log onto the web site, and see you have a package that suites them. So, they signup an account: - This intails entering their personally details, name, address etc. Along with their Credit Card Information (SSL IS HIGHLY REQUIRED) This user is then sent an e-mail, to verify their e-mail address, and ask them to activate their account, by following the link. Once their account is active, they can purchase your goods (servers in my case) They add what they want, say like a 100mb server with SSL, This is added to their Product List. They then goto the Purchase screen, which displays a invoice, and issues a button to make payment. Great, They've paid for the service ( Whooo ) Ahh, 2 weeks later the user wants another 50mb. But theirs still 14 days till there card is billed for the 100mb, what do we do! Simple, they go to your page, find the 50mb, add it to their product list, then go to the purchase screen. The scripts know they purchased 100mb 2 weeks ago, and that their is 14 days till their card is billed, so they bill the user for the price of 50mb - 14 days. EXAMPLE ( 50mb = 2.99 for 4 weeks ) User is billed 50mb - 14 days. 4 weeks = 28 days. 2.99 divided into 28 = 0.11. 0.11 x 14 = 1.54 So their card is billed 1.54 ( for the 14 days thats left. When their card is due to be billed again, they are billed the previous 100mb + 2.99 (28 days) for the 50mb. And so forth, for any service you offer. You can even setup one time setup fees, say for SSL Installation ( 4.99 setup + 0.00/mo ) etc. Setup fees are paid in full, regardless of how many days are left in their billing period. It also works in reverse. Say a user no longer wants the 50Mb, they remove it from their product listings. At the start of the next billing period, they are billed for 100mb only. ( Users keep the 50mb of space till the end of the period, none refundable. Unless you do this manually ) ------------------------ As you can see, this is a great way to run a hosting business. Users are only billed once a month, unless they purchase something during a billing period. In which case, they are billed for the remainder of the period only, then billed in full on the date of their recurring payment. Users can happerly purchase upgrades from you, knowing they are only paying for what their using. Per Day Billing FEEDBACK. p.s : Does anyone have the Zend Encoder. I could like to encode these scripts before i issue them. Unforchinetly, i dont have almost $3000 sitting in my pocket at the moment. So i need someone to encode them for me.

Posted by Mat Sumpter, 06-18-2002, 12:54 PM
I don't think many people here have it But I do know someone that does have a license for his company, I'll ask him if its ok for him to encode a set of files for outside his company, there could be licensing issues...

Posted by chrisb, 06-18-2002, 04:57 PM
Thanks again for all your hard work and willingness to share. Sounds like a great script that will help prevent fraud in sign-ups. I don't know Zend, but can't you just encrypt it with Blowfish or something?

Posted by Raiak, 06-18-2002, 05:11 PM
You could, but Blowfish can de deencrypted, where as Zend is next to impossible to decrypt ( Not impossable, just the next best thing ) Zend is also coded directly into PHP, thanks to the shared effets of the PHP team and Zend Software. No need to worry on external librarys, other than the optimizer which helps run the scripts faster.

Posted by chrisb, 06-18-2002, 05:20 PM
but then, will you script still work on sites that don't have the Zend optimizer with PHP?

Posted by Raiak, 06-18-2002, 05:39 PM
Around 95% of sites running PHP have the optimizer installed, as it installs as default with PHP on Redhat, Mandrake, Debian as well as other Linux os. FreeBSD etc. The other 95% of sites who are at a disavatage, as they would lose users though not having up to date software anyway. Im not 100% sure about WinServers, as I HATE windows.

Posted by JohnBB, 11-11-2002, 01:49 PM
Hi! Is this script actually out? If so, where to get it?

Posted by rlynch, 11-12-2002, 06:52 PM
any updates on this?

Posted by ruyledesigns, 11-12-2002, 11:16 PM
Agreed, this sounds great.JungleServers.Com

Posted by JohnBB, 11-28-2002, 11:49 PM
SWREG has now introduced automated scripts for recurring billing -- it says so on their main page at http://SWREG.org .



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Liquidweb down? (Views: 634)

Language: