// written for firebase v8 -->
db.collection("users")
.doc(user?.id)
.collection("orders")
.doc(paymentIntent.id)
.set({
basket: basket,
amount: paymentIntent.amount,
created: paymentIntent.created,
});
----> // How to write this same code for firebase v9?
CodePudding user response:
The equivalent in v9 would be:
const paymentRef = doc(db, "users", user?.id, "orders", paymentIntent.id);
setDoc(paymentRef, {
basket: basket,
amount: paymentIntent.amount,
created: paymentIntent.created,
});