0

What i'm trying to do is use the Firebase Stripe extension inside of my web app but I don't know how to go about doing so. Am I supposed to setup Stripe in my app separately? Or use the Firebase SDKs? I'm using the Nextjs framework. I already have Firebase setup but don't know where to go from here.

Down Below is my Firebase.js file setup

/ Import the functions you need from the SDKs you need
import { initializeApp, getApps, getApp } from "firebase/app";
// TODO: Add SDKs for Firebase products that you want to use
import { getApp } from "@firebase/app";
import { getStripePayments } from "@stripe/firestore-stripe-payments";
// https://firebase.google.com/docs/web/setup#available-libraries

// Your web app's Firebase configuration
const firebaseConfig = {
  apiKey: "XXXXXXXXXXXXXXX",
  authDomain: "XXXXXXXXXXXXXXXX",
  projectId: "XXXXXXXXXXX",
  storageBucket: "XXXXXXXXXXX",
  messagingSenderId: "XXXXXXXXX",
  appId: "XXXXXXXXXXXXXXXXXXXXXXXX"
};

const app = getApp();
const payments = getStripePayments(app, {
  productsCollection: "products",
  customersCollection: "customers",
});

// Initialize Firebase
const app = initializeApp(firebaseConfig);

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Diandre402
  • 64
  • 4

1 Answers1

0

Your code right now only uses that web SDK to list payments.

To start accepting payments, you need to use the helper functions that create a Stripe CheckoutSession for you, the Start a subscription checkout session section of this page.

hmunoz
  • 2,791
  • 5
  • 11