Will your billing code survive launch day?

Build a rock solid Stripe integration
from day one.

Writing a Stripe integration is intimidating. There are lots of moving pieces and no one place to see a complete implementation. Endless questions cycle through your mind:

"How do I make charges?"

"What about subscriptions?"

"What is PCI-DSS and why do I care?"

"Should I be using webhooks?"

"What happens if the Stripe API has an outage?"

"Am I doing this right?"

Payment integrations suck.

When I started working with payment integrations a few years ago I noticed a trend: they broke a lot. There's a ton of edge cases and error conditions to think about.

Every integration I came across had big problems, ranging from how they dealt with API errors to not sending email receipts all the time to being horribly insecure.

Every single one was incredibly difficult to debug because the original developer only thought about the happy path.

They ignored the possibility that things not in their control may break. Tracing through millions of lines of logs, reading inscrutible error codes, and slogging through slapped together spaghetti code was my life. Every payment bug meant lost revenue when people couldn't pay. Every one meant lost time because I wasn't working on features that customers actually wanted.

A clean, concise course to guide you through

You don't have to deal with this. You don't have to put your teammates (or future you) through the pain of debugging a shoddy payments integration.

Mastering Modern Payments: Using Stripe with Rails distills the experience of building and debugging dozens of payment integrations into one concise, comprehensive guide. By the end you'll have a bullet proof system you can be proud of.

What's in it?

  • Dealing with security including PCI-DSS
  • How and why to use stripe.js and checkout.js
  • How to build custom payment forms
  • How to set up Rails to keep an audit trail for you
  • How to handle subscription billing
  • How to create marketplaces with Connect and Transfers
  • How to process payments using background workers
  • How to email your customers effectively
  • How to test your Stripe integration
  • And much, much more

MMP is packed with advice and examples
from first chapter to last

Basic Integration Guides you through the most basic Stripe billing system possible and prepares your app for the rest of the book.

Security and PCI Compliance guides you through the murky waters of the Payment Card Industry Data Security Standards and how they apply to Stripe. It also talks about security scanners and code analysis tools you can use to validate your code isn't susceptible to things like cross-site-scripting attacks and SQL injections.

Custom Payment Forms shows you how to get away from Stripe Checkout and build your own payment forms, your way, with your own framework.

State and History teaches you why and how you should build your application with explicit state machines. It also walks through why keeping audit logs of the changes to your models is so very important, and how you can get them with just one line of code.

Handling Webhooks describes how to handle Stripe's webhook events to alert you of errors, perform vital upkeep within your application, and send receipts to customers.

Background Workers describes how to communicate with Stripe asynchronously. The Internet is a wild, wacky place, and your application needs to be able to recover from any number of errors, both internal and external.

Subscriptions walks through your options for building recurring billing into your application, along with advice about emailing your customers and integrating analytics services.

Connect and Marketplaces adds onto the basic integration again, this time allowing your app to sell things on your users' behalf with Stripe Connect and send them payments with Transfers.

What People are Saying

Christian Genco PortraitChristian Genco

Creator of dbinbox and textbooks please

Mastering Modern Payments was like a pool of cool refreshing water after I'd been traveling in the desert of obscurity for weeks. Unlike the API docs, or most blog posts I found on the topic, Pete thought this through three steps ahead of solving the problems I'd be having a few weeks or months after deployment. This will end up saving me an immeasurable amount of time and money.

Joel Hooks PortraitJoel Hooks

Co-founder of Egghead.io

I'm fairly new to Rails and setting up billing had me flustered for weeks. I was stuck, spinning my wheels, not knowing what was the best route to take. Pete's book is a guiding light of common sense and practical application. Now I can setup billing with confidence, and more importantly, ship my product.

Matt Vanderpol PortraitMatt Vanderpol

Founder of QAtab.com

Mastering Modern Payments is a fantastic resource for integrating Stripe billing with your Rails app. Pete does a great job of pulling together existing resources and blending them with his own experience to provide a clear, valuable guide for billing with Stripe.

Will Barker PortraitWill Barker

Web developer at Kindleman AU

I completely re-wrote my checkout using MMP's ideas. It's all looking much neater and more bullet proof now. The book gave me a lot of confidence my app wasn’t cowboy coded.

A Letter from a Happy Customer

Though I was somewhat familiar with Stripe, and wrote a not-insubstantial online store that has processed hundreds of thousands of dollars in charges in the last couple of years, I was never happy with the code I wrote. It felt fragile, and I had no real clue how to do things I wanted to, like moving it into a worker.

I bought the book yesterday, and chewed through it pretty quickly, and it gave me the confidence to do some serious refactoring of my code. Today, I’ve made sweeping changes based on your work, including moving things to a state machine and using a worker to take care of the stripe calls. This is a significant win for me, and I did it in a fraction of the time that it would’ve taken me otherwise. So: thanks. Your book paid for itself about five times over already.

Anyway, thanks again. You made my week much more satisfying than I’d expected it to be. :D

— Tim S.

MMP has helped 2133 people just like you confidently earn millions of dollars by getting their Stripe integration set up in hours, not days.

The Packages

MMP comes in two different packages. The Basic Package is your complete guide to building your Stripe integration correctly the first time. The Complete Package comes with a bonus: a complete example Rails application. This is the application that sold tens of thousands of dollars worth of the first edition of Mastering Modern Payments and illustrates all of the concepts in the book.

Basic Package


  • 11 chapters and 146 code samples
  • Web reader with discussion forum
  • 136 page PDF
  • ePub for reading on tablets

Complete Package


  • 11 chapters and 146 code samples
  • Web reader with discussion forum
  • 136 page PDF
  • ePub for reading on tablets
  • BONUS: Complete application example

Frequently Asked Questions

Which package should I buy?

That depends on your budget. I strongly suggest the Complete Package because the code is very helpful for understanding the book. That said, the Basic Package has a ton of value all by itself.

Can I upgrade later on?

Absolutely! Just reply to your confirmation email that you'd like to upgrade and I'll set it up for you.

Will I get updates?

Stripe and Rails both move fast. As they do, I send out periodic updates to the book and the sample application.

Can I pay with PayPal?

Not currently, no.

What versions does the book cover?

The book is current as of June 2016. This includes:

  • Ruby 2.3.1
  • Rails 4.2.6
  • Stripe Ruby API 1.43.1

I have another questions!

You can email me at hi@petekeen.net or tweet to @modernpayments.

What if I get nothing out of this?

I consider Mastering Modern Payments a historical artifact. It describes versions of Stripe and Rails that were current in 2016. If you choose to purchase it you do so with the understanding that there are absolutely no refunds and I provide no support for the code samples or anything else in the book.

Meet the author

Pete Keen Portrait I'm Pete Keen. I've been a professional software developer for a decade, building payment systems and other software for companies large and small. I write a blog at petekeen.net with articles on topics ranging from Ruby and Rails to Perl and robotics and scattered book reviews.

Get your free sample

Put your email address in to receive a five part email course all about Stripe and Rails, including the first three chapters of MMP.

No spam. Unsubscribe at any time.

John WilsonJohn Wilson

Front-end at Envy Labs

Mastering Modern Payments is helping me out so much right now. I'm already farther along than with any other resource.