Firebase/Stripe getProducts 返回一个空列表

发布于 2025-01-13 05:24:34 字数 2064 浏览 3 评论 0原文

我在 Stripe 上创建了一些产品,可以使用以下命令进行检索:

curl https://api.stripe.com/v1/products   -u sk_test_...:   -G 

I've Installed stripe/[email  ;受保护]中Firebase https://firebase.google.com/products/extensions/stripe -firestore-stripe- payments 并使用相同的秘密测试密钥对其进行配置

在我的网站中,我使用相应的Web sdk https://github.com/stripe/stripe- firebase-extensions/tree/master/firestore-stripe-web-sdk 并有类似的东西

  const firebaseApp = initializeApp(firebaseConfig);
  const analytics = getAnalytics(firebaseApp);
  const auth = getAuth(firebaseApp);

  onAuthStateChanged(auth, user => {
    if (user) {
      console.log('Logged in as '+user.email );
    } else {
      console.log('No user');
    }
  });
  
  var userCredential = await signInWithEmailAndPassword(auth, ..., ...)
  // Signed in 
  const user = userCredential.user;
    
  const payments = getStripePayments(firebaseApp, {
  productsCollection: "products",
  customersCollection: "customers",
  });
  console.log('#Payments ' + JSON.stringify(payments));

  const products = await getProducts(payments);
  console.log('#Products2 ' + products.length);

  const session = await createCheckoutSession(payments, {price: <a_hardcoded_priceId>,});
  window.location.assign(session.url);

createCheckoutSession 似乎工作正常,我确实看到Firebase 是一个 customers 集合,在我的客户内部,我看到一个 checkout_sessions 集合。

但返回的产品列表是空的。
知道可能出了什么问题吗? 所有产品都有 type=service (如果 https://stripe. com/docs/upgrades#2018-02-05 仍然相关),但不确定如何更改它。

我可以尝试的建议吗?
我可以提供更多信息吗?

I've created some products on Stripe which I can retrieve using

curl https://api.stripe.com/v1/products   -u sk_test_...:   -G 

I've installed stripe/[email protected] in Firebase https://firebase.google.com/products/extensions/stripe-firestore-stripe-payments and configured it using the same secret test key

In my website, I use the corresponding web sdk https://github.com/stripe/stripe-firebase-extensions/tree/master/firestore-stripe-web-sdk and have something like

  const firebaseApp = initializeApp(firebaseConfig);
  const analytics = getAnalytics(firebaseApp);
  const auth = getAuth(firebaseApp);

  onAuthStateChanged(auth, user => {
    if (user) {
      console.log('Logged in as '+user.email );
    } else {
      console.log('No user');
    }
  });
  
  var userCredential = await signInWithEmailAndPassword(auth, ..., ...)
  // Signed in 
  const user = userCredential.user;
    
  const payments = getStripePayments(firebaseApp, {
  productsCollection: "products",
  customersCollection: "customers",
  });
  console.log('#Payments ' + JSON.stringify(payments));

  const products = await getProducts(payments);
  console.log('#Products2 ' + products.length);

  const session = await createCheckoutSession(payments, {price: <a_hardcoded_priceId>,});
  window.location.assign(session.url);

The createCheckoutSession seems to work fine, and I do see in Firebase a customers collection and inside my customer, I see a checkout_sessions collection.

But the returned list of products is empty.
Any idea what might be wrong?
All products have type=service (which might be the root cause if https://stripe.com/docs/upgrades#2018-02-05 is still relevant) but not sure how I can change this.

Suggestions I could try?
Additional info I could provide?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文