text: const functions = require("firebase-functions");
  const express = require("express");
  const cors = require("cors");
  const config = require("config");
  const stripe = require("stripe")(
    "sk_test_51HPvWVI6jSqpe99bJc3z6zuquu8jDjbnXC4dqKE3Ozvn5q2ttdg46SyRKDzHi7T3YNOUy2FXjQZSxEkCjJd4c8NM00wOtnQ4Sl"
  );
  // const stripe = require("stripe")(config.get("stripeSecret"));
  
  // API
  
  // - App config
  const app = express();
  
  // - Middlewares
  app.use(cors({ origin: "*" }));
  app.use(express.json());
  
  // - API routes
  app.get("/", (request, response) => response.status(200).send("hello world"));
  
  app.post("/payments/create", async (request, response) => {
    const total = request.query.total;
  
    console.log("Payment Request Received BOOM!!! for this amount >>> ", total);
  
    const paymentIntent = await stripe.paymentIntents.create({
      amount: total, // subunits of the currency
      currency: "usd",
    });
  
    // OK - Created
    response.status(201).send({
      clientSecret: paymentIntent.client_secret,
    });
  });
  
  // - Listen command
  exports.api = functions.https.onRequest(app);
  
  // Example endpoint
  // DEV
  // http://localhost:5001/clone-e97a0/us-central1/api
  