January 26th, 2009
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.
Nice post, Mark! Really enjoy seeing the process behind publishing your own book, as well as how you designed and built a solution to accommodate your needs.
Would you ever consider packaging this and selling it as a subscription based ecommerce tool? I think something as simple as this would catch on very easily, especially with such a focused workflow and UI.
Cool! It’d be cool if (presumably somebody who didn’t presumably agree to the terms of a developer stipulating that the software couldn’t be freely released) would freely release something like this under the GPL. Hey, I guess I’m asking for a lot there, so maybe I’ll try to build my own with Django. Have sorta given up on PHP though.
Mate, I’ll second Mark Otto’s comment above: I — and I bet a lot of people — would willingly pay to use a system like this, so if you’re considering opening it up, I think it’s a viable option.
@ Christopher: Free would be nice, but given the investment that has undoubtedly gone into this, this — if it happened — would probably need to be a paid-for thing.
Before reading the comments before mine, I wondered if this would be available as a subscription tool / one-off purchase.
I’d be interested.
@Mark Otto @Elliot @Christopher @David Thanks for your comments guys. So, what would be your preference — a stand alone, or hosted solution? It’s not something I’d thought of (being so head down in this book), but, given the lack of something similar in the market, now you’ve got me thinking…
You could offer a hosted option, where usage is paid for with a percentage of the PDF sales.
Not sure how straightforward that’d be to set-up, but I think it’s a good way forward.
interesting article Mark. Do you know what tool was used to stamp the PDFs?
You also mention a physical book, is there a planned date for this or are you going to see how the PDF sales go first? Personally, I always like to get my hands on the real thing and escape the monitor :)
I think Campaign Monitor has proven that a subscription model works when sending out blasts, but I could see the benefits of both.
If you go with hosted, everyone signs up for an account and you get the bill for sending out emails blasts, hosting files, etc. Takes a lot of problems out of the users’ hands, but at a significant cost I imagine.
If you go with a stand alone, the barrier to entry is much larger. People have to install it, set up servers, etc. Do authors, publishers, and small business owners who would be interested in this have the ability to do that? Maybe, maybe not.
My answer I guess would have to be a hosted solution with a subscription model. Easiest way to get involved with it, low barrier to entry, easier to setup and use for wide variety of customers, and I imagine can scale very well.
You should consider talking to the guys behind Campaign Monitor and WordPress for there opinions. Both have different experiences with this kind of stuff.
And that said, I’m excited! Looking forward to anything about the book or this sweet little app.
Speaking as someone whose done a fair amount of poking around for WordPress plugins that do this kind of thing (there aren’t any good ones), I’d be most interested in using a standalone product.
Not sure I can guarantee enough flow to pay a subscription for a service, but over time, I can probably make back the initial investment if it’s pay-once…
You have a very system-defined thinking. The one thing is that I can’t think out where I can use your knowledge
Hosted solution should be the right thing to do.
Though it might be easy to setup a stand-alone system, there’s a barrier in the name of Payment gateway. It’s pricey and tiresome.So, I would suggest a hosted solution.
Have u guys checked out http://www.e-junkie.com/ ?
How different is Mark’s system different from it?
Glad to see Code Igniter getting some exposure on your blog Mark, I personally love it.
Really nice post mark. Your articles are always very interesting and helpful. BTW i am really looking forward reading your book.
@simon r jones
We used a bunch of PHP scripts available here: http://www.setasign.de/products/pdf-php-solutions/setapdf-stamper/
@Dilip P
I looked into using E-Junkie. it works just fine, although I find the actual app and interface a little difficult to use. E-Junkie certainly is a feature rich, mature application. I guess this application could be a little more bespoke and focussed — just designed to deliver licensed PDF files.
thanks
I’d be most interested in using a standalone product.
As a budding Code Igniter developer, it is really interesting to see the thought processes involved in the building of your mini-app.
It meant I paid a lot of attention to what was going on as I bought your book.
Thanks!
I’ve just bought the book but the embedded font isn’t working and so I get nothing :-(