In working on my Chrome Extensions Mercari Seller Pro I’ve been trying to integrate Stripe Subscriptions. Their docs have been great, as well as all their testing resources.

I first started just using Stripe Checkout on the client side so that a user could subscribe. This was setup in minutes. I built all my UI around this, and things seem to be working.

But I realized, using this, I would not be able to resubscribe customers who had unsubscribed. That is only available using the server side Stripe Checkout. Some tutorials out there were talking about going serverless using webtask.io. Unfortunately they are no longer accepting new accounts. I’m not sure if that is because Auth0 are shutting it down, or if they are just at capacity. Either way, it wasn’t an option.

I next looked into using Zapier to automate some things. I got some automation setup so that when a user subscribed, it could update a record in Google Firebase. I hit a bug though where my Zap said it worked, but nothing got updated in Firebase. I emailed support, and they were great, they got right back to me stating it was a bug on their side, and they were looking into it. So I had to look for another solution. Also Zapier only updates every 5 minutes, which wouldn’t be great for my checkout flow.

I went back to some of the Firebase examples, and they have a way to call functions from HTTP requests. This was exactly what I needed. I wrote a few basic functions to subscribe to Stripe, unsubscribe, and resubscribe. Everything seems to be working great!

I can now have it so when a user subscribes to Stripe, a webhook is fired off, which hits my firebase function. This can then insert data into my database about the user. Same thing with unsubscribe/resubscribe. Stripes webhooks fire off, and update things on firebase.