How to sell a product as a subscription?
|
|
The subscriptions module included in your store allows you to perform recurring billing for a particular product. If you sell a membership or any other product that
requires scheduled payment then this module can help you to automate these payments.
With the subscriptions module you can specify the products that are
subscriptions based and configure a recurring billing plan for each of them. In this case the customer's account will automatically be charged according to the
subscriptions plan that you provided. A script can be ran manually or automatically to perform these automatic billings.
When using this module, you need to make sure that the variables '$store_cc' and '$store_cvv2' located in your config file config.php are set to the value 'true'.
|
|
|
Enabling & configuring the subscriptions module
|
Enabling the subscriptions module is done in 2 steps, you first need to update the credit card variables '$store_cc' and '$store_cvv2' in your config.php file and then enable that module in the 'modules' page.
First step: edit your store config.php file located in the store root directory and then assign the value 'true' to both variables '$store_cc' and '$store_cvv2'.
Second step: Go to the 'modules' page by selecting the 'modules' option from the 'OTHER SETTINGS' menu section:
|
|
|
|
then select the Subscriptions module checkbox and click on the [save] button at the bottom of the page.
|
|
|
Once enabled, a link ‘Subscription’ will appear on the ‘PRODUCT’ menu section. On the module page, the subscriptions module will provide a configure link :
|
|
|
|
Click on the configure link, the following interface will display:
|
|
|
The first field is a key that you provide to prevent unauthorized run of the subscription script. This script is the file <root_dir>/admin/pay_subscriptions.php.
You could run that script manually via browser or using a cron job (see bottom of this page for more information).
Assuming that your store web address is www.mydomain.com, the URL for the manual run from browser would be:
http://www.mydomain.com/admin/pay_subscriptions.php
If you had input the key '123' in that field then that URL becomes:
http://www.mydomain.com/admin/pay_subscriptions.php?key=123
The second field let you request that an email confirmation be sent to your ‘orders’ department every time the subscriptions script is ran.
|
|
|
Enabling subscriptions for a specific product
|
In order to make a product be subscription based. You need to provide a recurring billing plan for that product. In order to make that configuration, go in the product edit
page and click on the ‘subscriptions’ link located in the ‘In this section’ top menu section:
|
|
|
The following interface will display:
|
|
|
|
To define a subscription plan for that product, specify the fields accordingly:
PAY PERIOD:
Specify the frequency of the charge to be applied. To provide a custom number of days, select the option by period' option and then provide the number of days in the field below.
PERIOD FEE: Specify the amount to be charged to a customer who will 'subscribe' to this product.
COST OF ONE DAY (optional): This is how much it will cost for just 1 day.
DAYS SAME PERIOD
(optional): This is an additional specification if needed on what exactly is the number of days included in the option provided in the first field 'PAY PERIOD’ (e.g. monthly considered as 31 days or just 30 days or maybe something completely different such as 20).
Note:
Although, the fields 'COST OF ONE DAY' and 'DAYS SAME PERIOD' are optional, we recommend you to use them as they will let your customer sign up at any time in the middle of any billing period. On their first bill, they will only be charged for the number of days since sign-up date.
|
|
After you have provided the plan settings, click on the [Apply] button, the subscription interface will redisplay and add the [Pay dates] button to the interface:
|
|
|
|
Click the [Pay dates] button, the following calendar interface will display:
|
|
|
|
On this calendar you can leave the default selected pay dates or select custom dates. If you make any change to the calendar, be sure to click on the [Update] button before
closing that window.
|
|
|
Customers ‘buying’ a subscription
|
Once the product subscription setup is complete the customer will be able to buy that subscriptions based product just as any other product of your store. The product look
will have 1 additional information displayed and that is the monthly recurring charge. If you provided a base price for the product then it will also be displayed as the
setup price. Here is an example of how these would be displayed:
|
|
|
|
|
Managing subscriptions
|
Managing the subscriptions made to your products is easy, you can list them, disable or delete any of the subscriptions. To display the management interface, first click on
the ‘Subscriptions’ link located in your ’PRODUCTS’ menu section:
|
|
|
|
The following interface will display:
|
|
|
|
Click on the [Search] button, all subscriptions will be displayed using the interface below:
|
|
|
|
|
Running the subscriptions charging script
|
The subscriptions billing script can be ran manually or automatically.
|
|
To run the script manually you can either do it by clicking on the ‘charge’ link on the subscriptions management interface or by running the script for everyone all at the
same time using the script name. To run the script using its name you can do it either from the command line or directly from your browser.
Assuming that your store URL is www.mydomain.com, then you can run the script manually using one of those command line:
/usr/bin/curl --get http://www.domain.com/admin/pay_subscription.php?key=secret_key
or /usr/bin/wget -q -O- http://www.domain.com/admin/pay_subscription.php?key=secret_key or /ustr/bin/fetch -o- http://www.domain.com/admin/pay_subscription.php?key=secret_key
It all depends on your preferred web retriever network utility (curl, wget, fetch)
|
|
To run the script from you browser, just type in the following URL:
|
http://www.domain.com/admin/pay_subscription.php?key=secret_key
|
|
To run it automatically from a cron job, you would just use the script call above and configure your cron schedule according to your pay period.
|
|