Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

98
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda