I have a website, and I would like to charge people to view the content. Basically, I'd like to give them a free trial for a certain number of days, and then require them to pay a modest fee to continue using it. Is there any application or prebuilt script out there that would allow me to do this?
Well, PayPal will certainly be the option for payment, but that's not my concern. My concern is how I can block people from accessing the site until they pay, and allowing free access for 60 days. Any approaches?
Well, PayPal will certainly be the option for payment, but that's not my concern. My concern is how I can block people from accessing the site until they pay, and allowing free access for 60 days. Any approaches?
I believe you have a web server to host your web-site? Usually when you configure a new URL domain, there will be a default homepage or index.html or whatever. The location of this file is usually part of the web server configuration.
This means say your URL is www.testme.com. Upon using browser enter the URL, by default the web server should throw out some web page. Then it is *this* web page that you do your access control.
For hosted web server I believe you got to check with them where is the default homepage or index.html or whatever stored and configured.
Again, thanks for the info, but that's not my concern. Yes, I'd do my access control from there. It's not a matter of the logistics, but the programming. This is going to be quite an extensive job to program a login, access, decide when the free period's up, and so on. Is there any software or prebuilt code out there that can let me do this without much work?
Generally for free trials you would require the user to "sign up". Usually I've seen a file included at the top of every page that validates the user's access and redirects to a login/payment page if the user/guest doesn't have proper access. The specifics for the programming depend on what you have currently and what you are comfortable with writing.
Well sure. The plan is to write that if I need to. I'm comfortable with writing all the scripts associated with this, but it will be terribly time-consuming. I was wondering if there were any prebuilt scripts that would lessen my workload.
I'd scour Paypal for PHP samples related to initiating the transaction and receiving payment completion notifications. On your end, you need to create something like a subscriptions table, with a unique invoice/subscription ID, the user ID, the date range it applies to, and the Paypal transaction ID and status (not submitted, pending, failed, canceled, complete, etc.).
So ... when someone checks out, you generate a subscription record with a subscription record with the appropriate date ranges, user ID, a "not submitted" Paypal status, and whatever other information you need to associate w/ the subscription. When you forward/redirect the user to the Paypal checkout, make sure you pass the subscription ID along. Using the libraries you found on Paypal, update the Paypal ID and status when paypal sends a transaction update. You can optionally notify the user at this point via email that their payment has been successfully processed and they may now access the protected content.
At this point, the user has subscription a record associated with the user record. At any point while the user is signed in (also while signing in), you can look for subscription records that contain the current date and have a PP status of "complete." So, if a subscription exists [that relates to the object/page being requested], allow execution to continue; else, require() or redirect to a "you are not subscribed" page.
If you're protecting various pages/sections/objects independently, you'll need a table that lists those sections and an intersect table between the subscriptions and the sections. So, as implied above, each subscription will have to be joined to an objects table to ensure that it applies to the requested object.
In terms of prepackaged apps that do this -- I'm not sure you'll find something that does JUST this. You'll more likely find scripts that deal with full-on account/user management. For those, I'd google things like, "PHP account management" and variations of that. However, as I've described it above, you're probably looking at a 20 to 40 hour project, including the Paypal integration.
Yeah, I was thinking something along those lines if I had to do it myself... and I'm sure it would be at least 40 hours considering security and testing, and the fact that I'm a slow programmer. :P That's what I was looking for a prebuilt solution.
Bookmarks