Reactjs 错误:未处理的拒绝(TypeError):无法读取属性';id';未定义的

Reactjs 错误:未处理的拒绝(TypeError):无法读取属性';id';未定义的,reactjs,google-cloud-firestore,stripe-payments,Reactjs,Google Cloud Firestore,Stripe Payments,我一直在尝试将stripe添加到一个应用程序中,目前我正试图获得MVP。每当我输入测试信用卡并单击“发送”时,我就会被发送到一个带有以下错误代码的屏幕 Error: Unhandled Rejection (TypeError): Cannot read property 'id' of undefined db.collection("users") .doc(user?.uid) .collection("orders") .doc(pa

我一直在尝试将stripe添加到一个应用程序中,目前我正试图获得MVP。每当我输入测试信用卡并单击“发送”时,我就会被发送到一个带有以下错误代码的屏幕

Error: Unhandled Rejection (TypeError): Cannot read property 'id' of undefined

db.collection("users")
  .doc(user?.uid)
  .collection("orders")
  .doc(paymentIntent.id)
  .set({
    basket: basket,
    amount: paymentIntent.amount,
    created: paymentIntent.created,
  });

这里的错误很明显。看起来您的
paymentIntent
未定义的

似乎
paymentIntent
是空的