I have an issue upgrading firebase stripe extention sdk version 8 code that they have at the official source code to version 9.
Even though I managed to upgrade the one time purchase and the subscription purchase i just can't figure out how to upgrade the rediraction to the portal code..
The version 8 code that they provide is this:
`const functionRef = firebase
.app()
.functions('${param:LOCATION}')
.httpsCallable('${function:createPortalLink.name}');
const { data } = await functionRef({
returnUrl: window.location.origin,
locale: "auto", // Optional, defaults to "auto"
configuration: "bpc_1JSEAKHYgolSBA358VNoc2Hs", // Optional ID of a portal configuration: https://stripe.com/docs/api/customer_portal/configuration
});
window.location.assign(data.url);`
With some digging i came up with this code but it doesn't work
`import { getFunctions, httpsCallable } from "firebase/functions";
constructor(private initialize: InitializeService, private afApp: FirebaseApp) { }
functions = getFunctions(this.afApp, "europe-west1");
async customerPortal() {
const functionRef = httpsCallable(this.functions, 'ext-firestore-stripe-subscriptions- createPortalLink');
functionRef({
returnUrl: window.location.origin
}).then((result) => {
const data = result.data;
});`
The errors that i'm getting is either blocked by Cors or when i disable cors on my browser(not optimal by any means) is FirebaseError: permission-denied GET 403.
i get these errors even when i place as Stripe API key with restricted access at firebase extention config the stripe secret or stripe public key
Any thoughts??
Thank you in advance :)