对如何在我的网络应用程序中使用 Stripe 作为 Firebase 的扩展感到困惑

Confused about how to use Stripe as an extension with Firebase in my web app

我想做的是在我的网络应用程序中使用 Firebase Stripe 扩展,但我不知道该怎么做。我应该在我的应用程序中单独设置 Stripe 吗?或者使用 Firebase SDK?我正在使用 Nextjs 框架。我已经设置了 Firebase,但不知道从哪里开始。

下面是我的 Firebase.js 文件设置

/ 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);

您的代码现在仅使用该 Web SDK 来列出付款。

要开始接受付款,您需要使用为您创建 Stripe CheckoutSession 的辅助函数,this page开始订阅结帐会话 部分。