Designing and building an eBook delivery system
When I first looked into writing Five Simple Steps to Designing for the Web, I looked at a bunch of options for delivering the PDF over email. I thought about building something myself or hosting it with various web applications used for delivering digital products. The first option just wasn’t an option at all in the end - I’m no programmer. The second option, although perfectly viable, saw the potential profit of the book undermined by a monthly, or per unit, charge. I made the decision, quite some time ago now, to commission the software to be built by the super-talented Steven Teerlinck, using the Code Igniter PHP Framework.
This isn’t a particularly complex bit of software, but Steven’s done a fantastic job in simplifying it to a number of core user and system flows:
The Requirements
So, I wanted to sell a PDF. Ideally, I wanted the following functionality:
- Have a discount coupon, so people could redeem them for, say, £3 off
- A discount period. For example, over the Christmas period.
- Multiple licenses. From single user, to ten.
- The delivery of the PDF itself.
The user flow
The user flow through the system is this:
- User selects book, and fills in license details - they enter a code here if they have one.
- The user is directed to Paypal where they part with their hard-earned cash
- Upon a successful transaction, the user is redirected to a ‘thanks very much’ page.
- The user receives an email from Five Simple Steps whereby they can download their PDF for up to 72 hours.
The system flow
The system does this:
- Upon receiving an ‘order’, the system checks to see if the Paypal purchase is valid.
- The system to generate a unique code for that sale
- This all sits in a queue that is set up on a CRON to send every 10 minutes
- The code is emailed, along with a handy link, so the user can download the book
- Upon clicking, the code is checked against the user, license, and to see if they sale is valid
- The code triggers a PDF stamper to dynamically stamp the PDF on every page
A large majority of initial sales will come from the money-off coupon that has been running on the site for a while. The coupon system works thusly:
- I can create one-off coupons, or bulk import from a comma separated file
- The coupons are queued up and processed every 10 minutes by a CRON job
- A user is sent an email with a unique coupon code.
- The user clicks a link which directs them to the purchase page and populates the coupon field.
That’s probably about it. The system is small, trim and effective for my needs. As time goes on, I’m hoping to add further functionality to support shipping physical books in addition to (possibly) more titles. We’ll see. Being involved in building a bespoke bit of software for the delivery of the book has been very interesting over the past six months or so. Not only has it shown what a flexible framework Code Igniter is, but also how important it is, as a (soon-to-be) publisher, to be in-touch with your distribution software and process.
Tags that this post has been filed under.