Skip to content

· 15 min read · Nadeera Silva

Payments

Firebase Stripe Extension Shutdown: Move to Cloud Functions

Firebase Extensions shut down on 31 Mar 2027. Replace the Run Payments with Stripe extension with your own Cloud Functions and keep the same Firestore data.

Two hands moving a white contactless card reader with a glowing teal screen from a worn wooden tray into a new grey box lined with teal tissue on a sunlit counter, a symbol of moving Stripe payments off the Firebase extension.

If your app takes Stripe payments through the Firebase Stripe extension ("Run Payments with Stripe", firestore-stripe-payments), it is now running on borrowed time. Firebase Extensions shuts down on 31 March 2027, the extension's own repository has been archived, and its functions are pinned to a Node.js runtime that Google has already decommissioned. In this post I replace it with your own Cloud Functions that keep the exact same Firestore layout, so your web and Flutter apps keep working with almost no client changes.

Quick answer

Firebase Extensions shuts down on 31 March 2027. Installed extensions keep running, but after that date you can't update, reconfigure or uninstall them, and the Stripe extension's functions run on Node.js 20, which Cloud Functions decommissioned on 30 October 2026. To migrate, deploy three 2nd gen functions of your own (a Firestore trigger on customers/{uid}/checkout_sessions, a signed Stripe webhook that writes subscriptions and the stripeRole claim, and a portal link callable), point a new Stripe webhook endpoint at them, verify, then uninstall the extension.

What this means for your app or business

If customers pay or subscribe in your app through this extension, nothing switches off on a single day, and that is what makes it risky. The extension keeps working until something needs to change or Google disables the old runtime. After 31 March 2027 you can't even change the Stripe key or webhook secret it uses, and no one is fixing bugs in it: the maintainer archived the code in June 2026.

The failure modes are expensive and quiet:

  • Checkout stops opening. The "Subscribe" button waits forever because no function writes the payment link back.
  • Renewals and cancellations stop syncing. Paying customers lose premium access, or people who cancelled keep it.
  • You can't rotate a leaked key. A compromised Stripe key would stay in place until you migrate anyway.

For a typical app that uses web Checkout and subscriptions, I'd estimate 1 to 3 days of development and testing, plus a short, planned switch-over. It takes longer if you also use the mobile payment sheet, invoices or custom collection names. If your app earns money through this extension and nobody on the team knows Cloud Functions, get help now, while the extension still runs and you can export its settings, not after something breaks.

What happens to the Firebase Stripe extension after the shutdown?

Here is what the primary sources say, as of today:

QuestionAnswer (25 Nov 2026)Source
Shutdown date31 March 2027 for all Firebase ExtensionsFirebase deprecation FAQ
Do installed instances keep running?Yes, "indefinitely", as normal Cloud FunctionsFirebase deprecation FAQ
Can you update, reconfigure or uninstall after that?No, not from the console or the CLIFirebase deprecation FAQ
Latest version and maintainer0.3.12, published by Invertase; repo archived, "not actively maintained" since June 2026extensions.dev, GitHub
Official replacement (function kit)None: "No publisher authored function kit replacement"extensions.dev
Runtime of its functionsnodejs20 (decommissioned 30 Oct 2026; such workloads "may be disabled")extension.yaml, Cloud Run functions runtime support

The deprecation FAQ also warns that most extensions use the 1st gen Functions SDK and "may stop running or be disabled" once their runtimes are decommissioned. The runtime support page lists Node.js 20 as decommissioned on 30 October 2026, which means no new deployments on it. Version 0.3.12 declares nodejs20 for every function. My reading is that reinstalling or reconfiguring it, which redeploys those functions, is already off the table. I haven't tested that against a live project.

What the extension deploys, and the replacement

The extension deploys these functions as ext-<instance-id>-<name> (by default ext-firestore-stripe-payments-...). This is the mapping I used:

Extension functionTriggerReplacementNote
createCheckoutSessionFirestore create on customers/{uid}/checkout_sessions/{id}stripeCreateCheckout (onDocumentCreated)Same input and output fields
handleWebhookEventsHTTPS request from StripestripeWebhook (onRequest)New Stripe endpoint and signing secret
createPortalLinkCallablestripeCreatePortalLink (onCall)Clients change the function name
createCustomerAuth user created (only if "Sync" was on)None neededCustomer is created on first checkout
onUserDeletedAuth user deleted (only if auto delete was on)stripeOnUserDeleted (onUserDeleted)2nd gen Auth triggers are in Preview
onCustomerDataDeletedFirestore delete of customers/{uid}Optional onDocumentDeletedCall the same helper

The data layout stays the same: customers/{uid} holds stripeId, checkout_sessions docs receive url or error.message, subscriptions/{id} and payments/{id} hold the synced state, products/{id}/prices/{id} mirrors your catalogue, and the stripeRole custom claim comes from the firebaseRole metadata on the Stripe product.

Flow diagram: the app writes a checkout_sessions doc, the checkout function creates a Stripe Checkout Session and writes the url back, Stripe sends a signed event to the webhook function, which writes subscriptions and sets the stripeRole claim
The replacement keeps every Firestore path the extension used.

Stripe Firebase functions: the replacement code

This is a standard 2nd gen codebase. functions/package.json needs "engines": { "node": "24" } and the three packages:

cd functions
npm install firebase-functions@7.4.0 firebase-admin@14.5.1 stripe@23.2.0
npm install -D typescript
firebase functions:secrets:set STRIPE_API_KEY        # same restricted key the extension used
firebase functions:secrets:set STRIPE_WEBHOOK_SECRET # set after step 3 of the cutover

src/index.ts wires the triggers and secrets. Use the region your extension was installed in, so client code that names a region keeps working.

import { initializeApp } from "firebase-admin/app";
import { getFirestore } from "firebase-admin/firestore";
import { getAuth } from "firebase-admin/auth";
import { defineSecret } from "firebase-functions/params";
import { onDocumentCreated } from "firebase-functions/v2/firestore";
import { onRequest, onCall, HttpsError } from "firebase-functions/v2/https";
import { setGlobalOptions } from "firebase-functions/v2";
import { onUserDeleted } from "firebase-functions/v2/identity";
import Stripe from "stripe";
import { handleCheckoutDoc, makeWebhookHandler, portalLink, deleteStripeCustomerForUser, Deps } from "./stripe-sync";

initializeApp();
setGlobalOptions({ region: "us-central1" }); // use the region your extension used
const STRIPE_API_KEY = defineSecret("STRIPE_API_KEY");
const STRIPE_WEBHOOK_SECRET = defineSecret("STRIPE_WEBHOOK_SECRET");

let stripe: Stripe | undefined;
const deps = (): Deps => {
  // Local only: point the SDK at stripe-mock when running in the emulator.
  const mock = process.env.FUNCTIONS_EMULATOR === "true" && process.env.STRIPE_MOCK_PORT;
  stripe ??= new Stripe(STRIPE_API_KEY.value(),
    mock ? { host: "localhost", port: Number(mock), protocol: "http" } : undefined);
  return { db: getFirestore(), auth: getAuth(), stripe };
};

export const stripeCreateCheckout = onDocumentCreated(
  { document: "customers/{uid}/checkout_sessions/{id}", secrets: [STRIPE_API_KEY] },
  async (event) => {
    const snap = event.data;
    if (!snap) return;
    await handleCheckoutDoc(deps(), event.params.uid, event.params.id, snap.data(), snap.ref);
  },
);

export const stripeWebhook = onRequest(
  { secrets: [STRIPE_API_KEY, STRIPE_WEBHOOK_SECRET] },
  makeWebhookHandler(deps, () => STRIPE_WEBHOOK_SECRET.value()) as any,
);

export const stripeCreatePortalLink = onCall({ secrets: [STRIPE_API_KEY] }, async (req) => {
  if (!req.auth) throw new HttpsError("unauthenticated", "Sign in first");
  const returnUrl = String(req.data?.returnUrl ?? "");
  if (!returnUrl) throw new HttpsError("invalid-argument", "returnUrl is required");
  return portalLink(deps(), req.auth.uid, returnUrl);
});

// Only if your extension had "Automatically delete Stripe customer objects" on.
// 2nd gen Auth triggers are in Preview (Firebase docs, Nov 2026).
export const stripeOnUserDeleted = onUserDeleted({ secrets: [STRIPE_API_KEY] }, async (event) => {
  await deleteStripeCustomerForUser(deps(), event.data.uid);
});

The Firebase Stripe webhook

The webhook verifies the signature against req.rawBody. A parsed and re-serialised body fails verification, which is the same trap I covered in Stripe webhook signature verification failed in Next.js. Next, it records event.id in stripe_events, so a delivery that has already been processed returns 200 straight away. It also re-reads the subscription from Stripe instead of trusting the event payload, so events that arrive out of order still end in the correct state. If processing throws, it returns 500 and Stripe retries for up to three days.

import type Stripe from "stripe";
import { Timestamp, FieldValue } from "firebase-admin/firestore";
// ... Deps, CUSTOMERS, PRODUCTS, ts() and dash() helpers as in the full file

// Finds customers/{uid} for a Stripe customer. Falls back to metadata.firebaseUID,
// which both the extension and this code set when they create a customer.
async function uidForCustomer({ db, stripe }: Deps, customerId: string) {
  const snap = await db.collection(CUSTOMERS).where("stripeId", "==", customerId).get();
  if (snap.size === 1) return { id: snap.docs[0].id, ref: snap.docs[0].ref };
  const customer = await stripe.customers.retrieve(customerId);
  const uid = !customer.deleted ? customer.metadata?.firebaseUID : undefined;
  if (!uid) throw new Error(`No unique Firebase user for ${customerId}`);
  return { id: uid, ref: db.collection(CUSTOMERS).doc(uid) };
}

// Writes customers/{uid}/subscriptions/{id} and the stripeRole claim.
export async function syncSubscription({ db, auth, stripe }: Deps, subId: string, customerId: string) {
  const userDoc = await uidForCustomer({ db, auth, stripe }, customerId);
  const sub = await stripe.subscriptions.retrieve(subId, {
    expand: ["default_payment_method", "items.data.price.product"],
  });
  const item = sub.items.data[0];
  const product = item.price.product as Stripe.Product;
  const role = product.metadata?.firebaseRole ?? null;
  const prod = (id: string) => db.collection(PRODUCTS).doc(id);
  await userDoc.ref.collection("subscriptions").doc(sub.id).set({
    metadata: sub.metadata, role, status: sub.status,
    stripeLink: dash(sub.livemode, `subscriptions/${sub.id}`),
    product: prod(product.id),
    price: prod(product.id).collection("prices").doc(item.price.id),
    prices: sub.items.data.map((i) =>
      prod((i.price.product as Stripe.Product).id).collection("prices").doc(i.price.id)),
    quantity: item.quantity ?? null,
    items: JSON.parse(JSON.stringify(sub.items.data)),
    cancel_at_period_end: sub.cancel_at_period_end,
    cancel_at: ts(sub.cancel_at), canceled_at: ts(sub.canceled_at),
    // Since API 2025-03-31.basil the billing period lives on the item.
    current_period_start: ts((item as any).current_period_start ?? (sub as any).current_period_start),
    current_period_end: ts((item as any).current_period_end ?? (sub as any).current_period_end),
    created: ts(sub.created), ended_at: ts(sub.ended_at),
    trial_start: ts(sub.trial_start), trial_end: ts(sub.trial_end),
  });
  if (role) {
    const uid = userDoc.id;
    const { customClaims } = await auth.getUser(uid);
    const active = ["trialing", "active"].includes(sub.status);
    await auth.setCustomUserClaims(uid, { ...customClaims, stripeRole: active ? role : null });
  }
  return { uid: userDoc.id, status: sub.status, role };
}

// syncOneTimePayment, syncProduct and syncPrice are in the full file.

// Process one verified event. Safe to run twice: state is re-read from Stripe.
export async function processEvent(deps: Deps, event: Stripe.Event) {
  const marker = deps.db.collection("stripe_events").doc(event.id);
  const seen = await marker.get();
  if (seen.exists && seen.data()?.status === "done") return "duplicate";
  await marker.set({ type: event.type, status: "processing", startedAt: FieldValue.serverTimestamp() });
  switch (event.type) {
    case "checkout.session.completed":
    case "checkout.session.async_payment_succeeded": {
      const s = event.data.object;
      if (s.mode === "subscription") await syncSubscription(deps, s.subscription as string, s.customer as string);
      else if (s.mode === "payment") await syncOneTimePayment(deps, s);
      break;
    }
    case "customer.subscription.created":
    case "customer.subscription.updated":
    case "customer.subscription.deleted": {
      const sub = event.data.object;
      await syncSubscription(deps, sub.id, sub.customer as string);
      break;
    }
    case "payment_intent.processing":
    case "payment_intent.succeeded":
    case "payment_intent.canceled":
    case "payment_intent.payment_failed": {
      const pi = event.data.object; // mobile payment sheet payments
      if (!pi.customer) break;
      const userDoc = await uidForCustomer(deps, pi.customer as string);
      await userDoc.ref.collection("payments").doc(pi.id).set(JSON.parse(JSON.stringify(pi)), { merge: true });
      break;
    }
    case "product.created": case "product.updated":
      await syncProduct(deps, event.data.object); break;
    case "price.created": case "price.updated":
      await syncPrice(deps, event.data.object); break;
    case "product.deleted":
      await deps.db.collection(PRODUCTS).doc(event.data.object.id).delete(); break;
    case "price.deleted": {
      const pr = event.data.object;
      await deps.db.collection(PRODUCTS).doc(pr.product as string).collection("prices").doc(pr.id).delete();
      break;
    }
    default:
      await marker.set({ status: "ignored" }, { merge: true });
      return "ignored";
  }
  await marker.set({ status: "done", processedAt: FieldValue.serverTimestamp() }, { merge: true });
  return "processed";
}

// Express-style handler used by onRequest. Stripe needs the raw bytes for the signature.
export function makeWebhookHandler(getDeps: () => Deps, getSecret: () => string) {
  return async (req: { rawBody: Buffer; headers: Record<string, any> }, res: any) => {
    const deps = getDeps();
    let event: Stripe.Event;
    try {
      event = deps.stripe.webhooks.constructEvent(
        req.rawBody, req.headers["stripe-signature"], getSecret());
    } catch (err: any) {
      res.status(400).send(`Webhook signature verification failed: ${err.message}`);
      return;
    }
    try {
      const result = await processEvent(deps, event);
      res.status(200).json({ received: true, result });
    } catch (err: any) {
      console.error("stripe webhook failed", event.id, event.type, err);
      res.status(500).json({ error: "processing failed, Stripe will retry" }); // retried for up to 3 days
    }
  };
}

The checkout trigger

The trigger reads the same fields your app already writes (price, success_url, cancel_url, mode, and so on) and skips documents that already have a url, sessionId or error. That protects you during the overlap with the extension. The idempotency key uses its own fn- prefix, so it never clashes with the extension's key for the same document.

// customers/{uid} keeps { email, stripeId, stripeLink } like the extension did.
export async function getOrCreateCustomer({ db, auth, stripe }: Deps, uid: string) {
  const ref = db.collection(CUSTOMERS).doc(uid);
  const existing = (await ref.get()).data();
  if (existing?.stripeId) return existing.stripeId as string;
  const { email, phoneNumber } = await auth.getUser(uid);
  const customer = await stripe.customers.create(
    { email, phone: phoneNumber, metadata: { firebaseUID: uid } },
    { idempotencyKey: `customer-${uid}` },
  );
  await ref.set(
    { email: customer.email, stripeId: customer.id,
      stripeLink: dash(customer.livemode, `customers/${customer.id}`) },
    { merge: true },
  );
  return customer.id;
}

// Runs when an app creates customers/{uid}/checkout_sessions/{id}.
export async function handleCheckoutDoc(
  deps: Deps, uid: string, docId: string, data: Record<string, any>, ref: DocumentReference,
) {
  // Already handled (the extension, or an earlier retry of this function).
  if (data.sessionId || data.url || data.paymentIntentClientSecret || data.error) return "skipped";
  const { client = "web", mode = "subscription", price, line_items, quantity = 1,
    success_url, cancel_url, metadata = {}, trial_period_days,
    allow_promotion_codes = false, promotion_code, client_reference_id,
    amount, currency } = data;
  try {
    const customer = await getOrCreateCustomer(deps, uid);
    const idem = { idempotencyKey: `fn-checkout-${docId}` };
    if (client === "web") {
      const params: Stripe.Checkout.SessionCreateParams = {
        customer, mode, success_url, cancel_url,
        line_items: line_items ?? [{ price, quantity }],
        client_reference_id: client_reference_id ?? uid,
        ...(promotion_code ? { discounts: [{ promotion_code }] } : { allow_promotion_codes }),
      };
      if (mode === "subscription") {
        params.subscription_data = { metadata, ...(trial_period_days && { trial_period_days }) };
      } else if (mode === "payment") {
        params.payment_intent_data = { metadata };
      }
      const session = await deps.stripe.checkout.sessions.create(params, idem);
      await ref.set({ client, mode, sessionId: session.id, url: session.url,
        created: Timestamp.now() }, { merge: true });
      return "created";
    }
    // client === "mobile" (payment sheet) is in the full file: PaymentIntent, subscription with
    // latest_invoice.confirmation_secret, or SetupIntent, plus an ephemeral key.
    throw new Error(`client ${client} is not supported`);
  } catch (err: any) {
    await ref.set({ error: { message: err.message } }, { merge: true });
    return "error";
  }
}

// Finds customers/{uid} for a Stripe customer. Falls back to metadata.firebaseUID,
// which both the extension and this code set when they create a customer.

Clients only change the portal call. On the web, call httpsCallable(functions, "stripeCreatePortalLink") instead of ext-firestore-stripe-payments-createPortalLink. In Flutter, call FirebaseFunctions.instance.httpsCallable("stripeCreatePortalLink"). The result still has data.url. After a purchase, refresh the ID token (getIdToken(true)) before reading stripeRole.

How to switch over without double-processing

  1. Export the configuration and note the extension's region, collection names and webhook event list (Stripe Workbench, Webhooks).
  2. Deploy the webhook and portal functions only: firebase deploy --only functions:stripeWebhook,functions:stripeCreatePortalLink.
  3. Add a second endpoint in Stripe with the new function URL and the same events (product, price, checkout.session.completed, customer.subscription., payment_intent.). Put its whsec_ value in STRIPE_WEBHOOK_SECRET and redeploy. For a while both endpoints receive every event. That's safe, because both write the same documents from Stripe's current state.
  4. Verify in test mode (next section), then check stripe_events and a real subscription document in production.
  5. Disable, don't delete, the old endpoint in Stripe. You can re-enable it if something goes wrong.
  6. In a quiet hour, deploy `stripeCreateCheckout`, run one test checkout, then uninstall the extension with firebase ext:uninstall firestore-stripe-payments. Firebase recommends this overlap-first order because a gap between triggers loses events permanently.
  7. Ship the client update for the portal function name.

How do I verify the fix?

For local tests, run the emulators and the Stripe CLI (1.55.15 has these flags):

printf 'STRIPE_API_KEY=sk_test_...\nSTRIPE_WEBHOOK_SECRET=whsec_from_print_secret\n' > functions/.secret.local
stripe listen --print-secret
firebase emulators:start --only functions,firestore,auth
stripe listen --events checkout.session.completed,customer.subscription.updated \
  --forward-to http://127.0.0.1:5001/YOUR_PROJECT/us-central1/stripeWebhook
stripe trigger customer.subscription.updated

stripe trigger creates a brand-new Stripe customer that has no customers/{uid} document, so expect a 500 with "No unique Firebase user". That still proves the signature path works. For a full run, create a checkout document from your app against the emulator and pay with the 4242 test card.

On the box, I unit-tested the handlers (18 tests) with stripe.webhooks.generateTestHeaderString and mocked Firestore: a valid event, a duplicate delivery, a wrong secret, a re-serialised body, a cancellation clearing stripeRole while other claims stay, and a failure followed by a successful retry. I also ran the deployed functions in the Firebase emulators against stripe-mock 0.206.0. The trigger wrote the Checkout URL back, the signed webhook wrote the subscription, the redelivery was skipped, and a wrong secret got a 400. I didn't test against a live Stripe account.

How to prevent the next forced migration

  • Keep payment logic in your own codebase, with tests, not in a managed add-on.
  • Pin and review your Stripe API version, and read Stripe's changelog before you bump the SDK.
  • Store the Stripe key and webhook secret in Secret Manager through defineSecret, and rotate them on a schedule.
  • Watch the Cloud Functions runtime schedule. Node.js 22 is deprecated on 30 April 2027, and Node.js 24 is supported until 2028.
  • Alert on webhook failures in Stripe Workbench and on error fields in checkout_sessions.
  • If you sell digital content inside a native app, remember that Apple and Google require in-app purchase for it. The extension's own docs say so too. See my Flutter in-app purchases with Firebase and RevenueCat guide.

Frequently asked questions

When does the Firebase Stripe extension stop working?

Firebase Extensions shuts down on 31 March 2027. Installed instances keep running as normal Cloud Functions, but you can no longer update, reconfigure or uninstall them from the Firebase console or CLI after that date.

Are Firebase Extensions deprecated?

Yes. Firebase announced the deprecation on 20 July 2026 and recommends moving to function kits or to your own 2nd gen Cloud Functions. The Run Payments with Stripe extension has no official function kit replacement.

Will my installed Run Payments with Stripe extension keep processing payments?

For now, yes. Its functions declare the Node.js 20 runtime, which Cloud Functions decommissioned on 30 October 2026, and Google says workloads on a decommissioned runtime may be disabled, so plan the migration rather than waiting.

Who maintains the Stripe Firebase extension now?

Invertase publishes version 0.3.12 on extensions.dev, after Stripe transferred it in October 2023. The GitHub repository was archived in June 2026 and says it receives no further updates, bug fixes or support.

How do I replace the Firebase Stripe webhook?

Deploy your own onRequest function that verifies the Stripe-Signature header against the raw request body, add it as a new endpoint in Stripe with its own signing secret, verify it, then disable the old endpoint.

Do my Flutter or web apps need changes after the migration?

Very few if you keep the same Firestore paths. Checkout documents, subscriptions and the stripeRole claim work as before; only the customer portal callable gets a new function name.

Can I keep using Stripe with Firebase without the extension?

Yes. Stripe works with Cloud Functions directly through the stripe npm package, and Firestore triggers, HTTPS functions and callables cover everything the extension did.

Sources

  1. Firebase Extensions Deprecation FAQ (Firebase documentation, 2026-11-18)
  2. Migrate Firebase Extensions to function kits (Firebase documentation, 2026-11-18)
  3. Firebase release notes (20 Jul and 30 Sep 2026 entries) (Firebase, 2026-09-30)
  4. Run Payments with Stripe (firestore-stripe-payments) 0.3.12 (Firebase Extensions Hub)
  5. invertase/stripe-firebase-extensions README (status update, June 2026) (GitHub, Invertase, 2026-06-18)
  6. firestore-stripe-payments extension.yaml (GitHub, Invertase)
  7. firestore-stripe-payments POSTINSTALL (webhook events, stripeRole) (GitHub, Invertase)
  8. firebase/extensions repository (deprecation notice) (GitHub, Firebase)
  9. Cloud Run functions runtime support (Google Cloud, 2026-11-24)
  10. Firebase Authentication triggers (2nd gen, Preview) (Firebase documentation, 2026-11-18)
  11. Cloud Firestore triggers (Firebase documentation)
  12. Configure your environment: secret parameters (Firebase documentation)
  13. Control access with custom claims (Firebase documentation)
  14. Manage webhook endpoints (signatures, retries, duplicate events) (Stripe documentation)
  15. Basil 2025-03-31: subscription item billing periods (Stripe changelog, 2025-03-31)
  16. Basil 2025-03-31: invoice payments and confirmation_secret (Stripe changelog, 2025-03-31)
  17. Stripe CLI: listen and trigger (Stripe documentation)
  18. stripe-mock (GitHub, Stripe)
SharePost on XLinkedIn

Comments

Share a question or note about this article.

Loading comments…