Firebase/Stripe getProducts 返回一个空列表
我在 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论