firebase-subscription-payments
firebase-subscription-payments copied to clipboard
Customer Portal: Doesn't work with Firebase 9
I'm trying to trigger the customer portal with the new Firebase 9, but it doesn't work. This is the code:
import { initializeApp } from "firebase/app";
import { getApp } from "@firebase/app";
import { getFunctions, httpsCallable } from "firebase/functions";
const firebaseApp = initializeApp({
apiKey: "AIzxxxxxxxxxxxxxxxxxxxxxvc",
authDomain: "xxxxxxxxxxxx",
projectId: "bloxxxxxxxxxxxxxxxxd76",
....
});
const app = getApp();
const functions = getFunctions(firebaseApp);
export async function goToBillingPortal() {
const functionRef = httpsCallable(functions, 'ext-firestore-stripe-subscriptions-createPortalLink');
const { data } = await functionRef({ returnUrl: window.location.origin });
window.location.assign(data.url);
}
Errors:
Access to fetch at 'https://us-central1-xxxxxxxxxx-6ed76.cloudfunctions.net/ext-firestore-stripe-subscriptions-createPortalLink' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.
service.ts:206 POST https://us-central1-xxxxxxxxx-6ed76.cloudfunctions.net/ext-firestore-stripe-subscriptions-createPortalLink net::ERR_FAILED
Uncaught (in promise) FirebaseError: internal
I have the same issue, I hope they update the docs soon to work with V9
Hi! I'm a beginner at all of firebase and js. However, the following changes in app.js will work.
ext-firestore-stripe-subscriptions-createPortalLink ->ext-firestore-stripe-payments-createPortalLink
It makes some ssl errors, but it will show customer portal.
Hi! I'm a beginner at all of firebase and js. However, the following changes in app.js will work.
ext-firestore-stripe-subscriptions-createPortalLink ->ext-firestore-stripe-payments-createPortalLink
It makes some ssl errors, but it will show customer portal.
Can you post your code for billing I am having same issues still not solved using firebase v9