score:1
You could try using the listLineItems
method instead, and expand the product object inside data.price.product
(according to the guide for expanding nested objects in lists).
const lineItems = await stripe.checkout.sessions.listLineItems(id, {expand: ['data.price.product']})
As you are currently retrieving the Session object with the expanded line_items
data, this data won't include the product's name, images, description, etc. It looks like the problem is caused by these API calls, as opposed to something in your Firebase function or Firestore.
We can see that the product data from list_items.data.price.product
is shown as expandable, which confirms it needs to be expanded. It also seems that there is no price_data
field (but instead only price
) nor product_data
(but instead product
) within the responses. These specific fields are apparently available only when creating Sessions.
You would end up with something like:
await admin.firestore().collection("customer").doc(String(dataObject.customer_email)).collection("order").doc().set({
//...
orderItems: lineItems.data[0].price //includes product details from nested expand
});
Since line items data
is an array containing each item, you would need to build the array to save in Firestore as your use case requires. Let me know if this was helpful.
Source: stackoverflow.com
Related Query
- React js backend how to get the price_data info from stripe.checkout.session.line_items and push the data into firestore
- How to get the response data from backend to React in React-dropzone-uploader
- How to get data from the backend that needs authorization using React
- How to get the data from React Context Consumer outside the render
- How can I get the right data from database with react
- How do I get the new updated data from react hooks or useEffect?
- How to get the data from Redux store using class components in React
- how to get the data from child component in stepper in react material ui?
- How do I pass additional data from the client-side Stripe Checkout to the server with Fetch
- How to fetch data from server using JavaScript? (adding backend to React app for the first time)
- how to get the data from a component within a form in react
- Error when trying to get info from current session user. "Too many re-renders. React limits the number of renders to prevent an infinite loop."
- Using the proxy setting for React to get data from a Featherjs backend
- How to get the data from firebase realtime database in react js?
- How do I get the data from an API call, in a different file, in React
- How to get data from backend express server to frontend react app and vice versa
- How can I update react app that gets it's data from the node mongo backend using redux
- How to get the data from dropdown component in React and update state?
- How to get data from the route url to put inside the callback function in React router?
- How can I get a variable from the path in react router?
- How can I get data from a local file into my React app?
- How to get form data from input fields in React
- How can I get the image url from IPFS info in React.js?
- react-query: how to get the data from useQuery in onSuccess callback?
- Draft.js. How to get all entities data from the ContentState
- How do I access data returned from an axios get to display on a web page using react js?
- How can I cache data that I already requested and access it from the store using React and Redux Toolkit
- How to get the response data from promise in React?
- How to pass data from React Form -> Flask Backend -> React Component (does it have something to do with CORS)?
- How to get the data from excel in JSON format in ReactJS?
More Query from same tag
- React 17 Use Conditional Switch in Function Return
- Close material-ui popper when on clickAway
- Filtering and already filtered state
- Compute the parents state based on the data of the child components: ReactJS
- Issue passing props to great-grandchild components using ReactLayout in Meteor
- Using this.props or this.state directly vs setting const
- Remove items from the database on leaving or closing the page from a React Component
- Calling another action after one is completed in React
- Override eslint settings in non-ejected create-react-app?
- firebase add user information while creating user (react.js)
- Each child in a list should have a unique "key" prop. Even though i am giving a key and its a unique one
- why is useEffect rendering unexpected values?
- Find path of object property, recursively
- Fetch data using React HOC(Higher Order Component), Redux and pass props
- scroll to bottom doesn't work in componentDidMount react
- React scroll event doesn't stop firing
- React: can't change input with onChange
- How to use css clip-path in React JSX
- Grunt, Jasmine, Phantom, React Unit Testing: React throws on ReactElementValidator
- List all items in an array in ReactJS
- Material-UI DataGrid Linear Progress Bar in Column Cells
- how to handle login redirect to dashboard in reactjs
- AntD Table Columns do not render leading or trailing whitespace in their values
- React change content based on item selected in Dropdown
- React hooks: Parent component not updating when dispatch is called in a child component
- I have problem to add new object to store React redux
- how to test Routes in react using jest and react testing library
- I am trying to confirm the user through the token but its showing an error
- React app : old version kept in cache until I inspect it
- React + Webpack HMR is refreshing the page (not hot loading)