Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

94
Views
Firebase v9 Admin Webhook with Stripe

I have this Firebase v8 syntax to push the Stripe checkout items into Firestore and I would like to migrate it to Firebase v9 please

import * as admin from "firebase-admin";

const serviceAccount = require("../../../permissions.json");
const app = !admin.apps.length ? admin.initializeApp({
   credential: admin.credential.cert(serviceAccount) }) : admin.app();


const pushIntoStore = async (session) => {
   return app.firestore()
.collection("users")
.doc(session.metadata.email)
.collection("orders")
.doc(session.id).set({ 
  amount: session.amount_total / 100,
  amount_shipping: session.total_details.amount_shipping / 100,
  images: JSON.parse(session.metadata.images),
  timestamp: admin.firestore.FieldValue.serverTimestamp()
})
.then( () => {
console.log(`SUCCESS: Order ${session.id} has been added to the DB`)
});
};
 

all of it please. I have the session and the data so don't worry about that. I just need all Firebase code refactored, plus the timestamp part also please, thanks! :) the above code basically creates a collection users then inserts a new document with a custom id which is - session.metadata.email -> then further on for each custom id it creates another collection called orders in which it sets document with another custom id which is session.id - and inside the document sets the data object. Thanks again!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The document, I shared in the comment, is for Firebase Web SDK upgradation from version 8 to version 9.

For the Firebase Admin SDK, as you are using javascript, the latest available version is Firebase Admin SDK v10 as mentioned in the release notes and I would suggest you look at the Firebase Admin SDK version 10.

The main feature for the latest version 10 is that support for Node.js 10 is discontinued and the SDK has adopted a modular API pattern. So make sure to update Node.js version to 12 or higher and then upgrade the Firebase Admin SDK to version 10. To know more about the releases and what is new with each updated SDK version you can go through this document.

To get a detailed description of the steps to upgrade you can go through this Firebase documentation.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!