PHP-SecureArea is a PHP subscription manager and this page explains the concepts and set up with PayPal.
Subscriptions are intended for recurring payments. That is, you enter a time period which defines the rebilling date. If recurring payments have been set, then it will re-bill on a regular basis unless the user cancels or the payment fails. If recurring payments have not been set, then one payment is made and the user is not re billed.
PayPal has a number of documents which describes subscription - a couple of those documents are listed here:
A PayPal subscription can consist of none, 1 or 2 trial periods, followed by a regular billing cycle. Trial periods operate when the subscription is controlled by PayPal. Manually created users do not have the concept of trial periods.
Subscriptions may be defined for a fixed number of installments. So you could have, for example, a $10.00 subscription for 12 months, after which the subscription will be automatically cancelled.
This membership management system implemets all the following PayPal features.Regular billing cycle
Required Field. Enter your regular subscription rate. Billing cycles can be entered as a number of days, weeks, months, or years.Recurring basis
Select 'Yes' if you would like your subscribers to be billed on a recurring basis. This means that after the regular billing cycle that you previously entered is complete, your customers' subscriptions will be automatically renewed unless a customer manually cancels his subscription. If you select 'No', your customers' subscriptions and payments will end after the first cycle is completed.Recurring times (installments)
Enter in the number of installments for payments at your regular rates. This means that once a customer has made the specified number of payments at your regular rate, his subscription will be completed. If left empty your customers' subscriptions will continue unless it is cancelled manually or by payment failure.Re attempt on failure
Click the 'Yes' radio button if you would like PayPal to automatically reattempts failed payments. Payments will be re attempted three days after the failure date. After a second failure, PayPal will try once more five days later. A third failure will lead to an automatic cancellation of the subscription.
If you select 'No', failed payments will result in the automatic cancellation of the subscription.Allowable values for payment time periods
Day = 24 hours. Acceptable values 1 - 90
Week = 7 days. Acceptable values 1 - 52
Month = 1 calendar month (same day of the month). Acceptable values 1 - 24
Year = 1 calendar year (same day of the year) Acceptable values 1 - 5
These are optional and the entries are the same as described above for the normal installments. Entering 0.00 as the cost will give free subscription for the trial period.
The transaction type for subscriptions may be:
The subscriber has signed up for the service.
Sends an email saying they have signed up. A subscription payment will also be actioned at the same time and it is this that does the processing to create and enable the user.subscr_cancel
Sends an email saying that it has cancelled. The user is removed from the system and the user will not be able to log into the secure area. The current system will remove the user from the secure area as soon as the customer cancels the subscription.subscr_failed
Sends an email saying that it has failed, and removes this user from the secure area.subscr_payment
A subscriber has paid for the service.
Sends an email saying that payment has been made, updates the database.subscr_eot
A subscriber has reached the end of the subscription term.
Sends an email saying subscription has completed and removes this user from the secure area.subscr_modify
A subscriber profile has been modified.
Not used in this application but would mean that the subscription details have been modified.
When the customer first signs up, an IPN 'subscr_signup' is sent. You will also get a 'subscr_payment'. The 'subscr_signup' is the start of the subscription process.
If the customer cancels a subscription, you may get a 'subscr_eot' at the end of the current term. Some PayPal accounts do not send the 'subscr_eot' for a cancellation, so the application removes the person from the secure area as soon as they cancel.
The only time that you receive 'subscr_eot' is when the customer is unable to pay for the subscription or the subscription period has ended.
If your subscription is not recurring, the end of term will be sent when the Subscription is completed. If your subscription is recurring and it is manually cancelled, the end of term will be sent at the end of the current term. If your subscription is recurring and it automatically cancelled due to payment failure, credit card expired or original funding source removed, the end of term will be sent immediately.
The most common use is to create a secure membership area and allow users to subscribe to it at different values. So for example you might create a 'product item' called GoldAccess which costs $250 every 3 months and another 'product area 'called SilverAccess which costs $100 every 1 month. To do this, first define the folder by creating a secure area name. Then create the first product with:Regular billing Cost : 250
This defines $250 every 3 months until cancelled
Then create a second product with :Regular billing Cost : 100
This defines $100 every 1 months until cancelled.
Another typical use is to provide access to an area for a defined number of months. To do this, first define the folder by creating a secure area name. Then create the product with:Regular billing Cost : 10
This defines $10 each month for 12 months.
If you want to give access to an area for one period only then use something like the following:Regular billing Cost : 10
This defines $10 for one 1 month only.
For most users, the secure areas only contain one folder. That is, a user purchases a subscription and gains access to one folder. However, you can add multiple folders to one secure area just by adding the folder.
Some users require a situation where they have two secure areas each with a single folder, but they have the requirement for a customer to subscribe to both folders at a reduced payment. So customers could subscribe to subfolder1 or subfolder2 but also have the ability to subscribe to subfolder1 and subfolder2 at a reduced subscription.
This can be done but requires some careful setup of the folders and some manual modifications to the htaccess files.
First create a main folder secure area which will have a product item called 'mainfolder'. This will be the subscription at a reduced rate.
Then create sub folders to this main folder called subfolder1 and subfolder2.
For subfolder1 and subfolder2 create separate secure areas one with a product item subfolder1 and one with a product item subfolder2.
This will give the required file structure and you have three separate secure areas.mainfolder - htaccess file
The htpasswd folder will contain 3 password files.
At the moment the htaccess files will only allow access to the required folder, so subscribing to mainfolder will only allow access to mainfolder but not allow access to the sub folders.
To allow subscribers of main folder to have access to the sub folders, open the htaccess file in the root of main folder and copy the line that looks something like :AuthUserFile /home/web43/public_html/securearea/htpasswd/.htpasswd_1
and paste it into the htaccess file for subfolder1 and subfolder2 underneath the existing AuthUserFile line.
This means that anyone can access subfolder1 if they are in the password list for main folder. Similarly anyone can access subfolder2 if they are in the password list for main folder. Now, if you subscribe to the main folder, you have access to subfolder1 and subfolder2.