Leotheperegrine
Leotheperegrine

Reputation: 51

CreatePortalLink doesn't point to a dashboard but a payment url

I have a project which uses the Stripe payments extension with Firebase. The app runs with Next JS.

Once the user is subscribed, I need a tab for them to manage their subscription. The extension tells you to run their cloud function, createPortalLink. Here is my implementation of it: const functions = getFunctions(getApp()) const functionRef = httpsCallable(functions, "ext-firestore-stripe-payments-createPortalLink")

    const {data} = await functionRef({
        returnUrl: window.location.href + "/plans",
        locale: "auto",
    })
    
    // @ts-ignore
    window.location.assign(data.url)

When I run this, it just goes to a payment page and not a dashboard which could allow you to manage, and most importantly, delete subscriptions.

Is there something I need to change or does it just work like this in test mode?

Upvotes: 0

Views: 46

Answers (1)

orakaro
orakaro

Reputation: 1981

It depends on what exactly the method ext-firestore-stripe-payments-createPortalLink produced. Per its Doc it does look like to be a Customer Portal, but let's confirm to be sure.

You can take a look at your Stripe Dashboard's request log (https://dashboard.stripe.com/test/logs) to find out. A Customer Portal should be what you want, but in example, a Checkout Session will not.

Upvotes: 0

Related Questions