I love this cover, by the way.
My new book, Take My Money: Accepting Payments on the Web, is available today. If you have a Rails application that touches money, this book will help you. I hope that this book will help you build your payment application with less stress and fewer mistakes.
Here’s why I wrote it: My favorite books and blog posts to write are the ones that I wish I had been able to read when I was starting a new project.
A few years ago, I started working on a legacy rescue project. For the first time I was responsible for significant payment and financial management logic. The application already had API communication with a gateway, so I thought the hard part was already done.
I quickly found out that the API was the easy part. I had to manage inventory, validate data, handle refunds, prepare reports, and all the other things that stand between “taking a payment” and “running a business”. I had to make sure that a database failure after the credit card purchase didn’t cause a user to get charged without the payment registering in our system. Or that a payment gateway failure didn’t cause a user to get our service for free.
I looked for information on good practices in this area and found relatively little. So I fell back on general principles of software development. And I did some things right, and I made some mistakes.
And eventually, I wrote the things I did right, and I wrote down the mistakes, and how to avoid them. The resulting book, as I’ve mentioned, is called Take My Money: Accepting Payments on the Web, and it goes on sale in beta today, from the Pragmatic Press.
The topics in this book cover the literal core of business logic: taking payments, providing a good or service in return, managing money, reporting finances. Not only do these topics tend to involve the most complicated logic in the system, but people tend to react more strongly to bugs involving money then to, say, the search algorithm.
I’m really happy with how the book is turning out. It’s about payment gateways, sure, but also about data modeling and application design.
Table of Contents
Here’s the current table of contents, subject to change.
- Not Taking Payments on the Web (yet): Setting up the system, talking about data modeling and handling money as data.
- Take The Money: Interacting with Stripe and accepting our first payment.
- Client-Side Payment Authentication: Using stripe.js to prevent credit card information from ever touching your server.
- PayPal: ‘Nuff said.
- Failure is Totally an Option: How to react to data failures, gateway failures, database failures. How to structure your app to handle them.
- Subscriptions: Handling recurring payments
- The Administration Experience: Dave Thomas was gracious enough to let me interview him about the Pragmatic store. He told me that two-thirds of the Pragmatic Store code was administrative. Here we start to learn why.
- Administration Roles: Setting up authentication and then using authentication to do things only Admins should do, like refunds.
- Administration and Data Security: How do you maintain data integrity and still let administrators make changes. Some tips.
- Reporting: (Forthcoming)
- Making Payments and Paying Taxes (Forthcoming)
- Going to Production (Forthcoming)