6
13 Comments

Firebase + Stripe Subscription Integration Help Needed

Hey, Indiehackers!

I'm working on a simple app (it's actually a bookmarklet) that has Firebase Auth and plans on using Stripe for subscription payment.

I've got the Firebase authentication working great, but I'm a little bewildered on where to start with integrating a monthly subscription in the app.

Obviously, I'll need to create a Stripe account and set up a product, but does anyone have any insight as to how I can dynamically go out and check if someone is still active on their subscription while initializing the bookmarklet?

I've looked into Firestripe but I wasn't sure if that's the best way to go about it. It seemed very manual for this simple application. I don't want to mess up stuff when it comes to money.

Also, I found the subscriptions api. Would I just query this information when the app starts? How do I link a stripe account to a firebase authentication account?

Thanks for the input and feedback, I appreaciate it!

  1. 1

    Hey Jordan,
    What was your solution to this? I am trying to implement a subscription payment method using stripe, firebase/firestore, and React

    1. 1

      You can also use my own ExtensionPay which lets you take one-time and subscription payments in browser extensions without running your own server backend. Saves people weeks of tedious work.

    2. 1

      Hey Raul,

      It took me two weeks to figure it out! The short answer is, I used https://webtask.io to host my back-end code and post requests for making a new customer, and adding and removing subscriptions. I just add the customer id and subscription id to the Firebase db to verify payment.

      That way I really only had to write client code and the little bit of server code on Webtask was simple.

      If you want to know more feel free to email me.

      1. 1

        Thanks, I just sent you an email.

    1. 1

      How is that working for you? Have you set up webhooks to manage subscription billing?

  2. 1

    I am using Stripe and Firebase as well, but i am not dealing with subscriptions for now.

    The idea is that when you define the subscription, it should be automatically renewed by Stripe and you will be receiving notifications via webhooks.

    Now, the easist way to link your users and payments, is the email, since, as you can see in the link below, that in order to create a customer (after the plan creation) you have to use the email:

    customer = stripe.Customer.create(
      email='jenny.rosen@example.com',
    )
    

    Now, what do you specifically mean by 'where to start' ?

    Docs are here: https://stripe.com/docs/subscriptions/quickstart

    Hope this helps.

    1. 2

      Hey Bruno, Do you have an example of how to do exactly what you're doing with Stripe & Firebase? No subscriptions. Just a one time payment in Stripe that creates a new user in my site.

      1. 1

        If you are not in a super-rush, i can try to craft a small example on the paper in the next days. It's the next task i need to take care of for my personal project, so i will definitely have. My only concern to help you is time.

        1. 1

          No rush at all. I'll take any direction I can get!

          Right now I'm just turning my wheels trying to figure out how to integrate Stripe Checkout with Firebase Auth for a smooth on-boarding process.

          I appreciate you even answering.

          1. 1

            No worries, i will be working on that, so providing you an example is not going to be a problem ;-)

            1. 1

              Thanks a lot Bruno!

    2. 2

      Yep, Bruno is right

      1. you need to create a stripe Customer, which will return a customer_id. You need to associate your user with their stripe_customer_id in Firebase.

      2. Create a Plan in the stripe dashboard https://stripe.com/docs/api#plans

      3. Then you can subscribe the user via their stripe_customer_id to a plan (via the plan name).

      I'll be jamming on some stripe stuff today at some point if you need some help could always remotely pair with you on it