#brad_01495

1 messages · Page 1 of 1 (latest)

upper cloakBOT
ebon elbow
#

Only thing the portal gives me is the ability to update payment info.

elder lotus
#

Hello there

ebon elbow
#

Hello!

elder lotus
#

So yeah you don't start Subscriptions via Customer Portal

#

Customer Portal is only for managing Subscriptions/PaymentMethods

#

Can you clarify:

it still just shows some basic info and doesn't tell me what products I'm subsribed to.

ebon elbow
#

Cool cool. Glad to have that confirmed.

elder lotus
#

You created a Portal Session for a Customer with a Subscription?

#

But you aren't seeing the Subscription within the Customer Portal?

ebon elbow
#

Yeah so you say "Customer Portal is only for managing Subscriptiuons/PaymentMethods" but no "Subscriptions" are shown, even though I just attempted to subscribe to something

#

Now I go back to portal:

elder lotus
#

Should look like bps_xxxx

ebon elbow
#

bps_1Nf6fQHUEMXMwifT65aWRNHt

elder lotus
#

Okay yeah so that Portal Session is for cus_OQXyvdY1XXkvlx which doesn't have any Subscriptions

#

So I think you are mixing up your Customer ID that you are creating the Portal Session for

#

Also looks like you are testing in live mode right now

#

Which you should not be doing -- you should test in test mode

ebon elbow
#

Is that a problem? My site is currently not live and I'm having a really hard time managing all of these keys

elder lotus
#

You should only be using your test keys until you are ready to go live

ebon elbow
#

Okay so would that be the problem it seems?

#

Cause my card was still charged regardless

elder lotus
#

No that's not the problem with why you don't see the Subscription in the Customer Portal

#

The reason for that is that you are using the wrong Customer ID in your Portal Session request

#

You need to make sure that you use the Customer ID associated with the Checkout Session

#

So that it is the same Customer that is actually subscribed

ebon elbow
#

Okay so I have this firebase function to call it:

if (!context.auth) {
console.error("Error: User is not authenticated.");
throw new functions.https.HttpsError('unauthenticated', 'You must be logged in to create a checkout session.');
}

const priceId = data.priceId;
const returnUrl = data.returnUrl;

try {
const session = await stripe.checkout.sessions.create({
mode: 'subscription',
line_items: [
{
price: priceId,
quantity: 1,
},
],
success_url: ${returnUrl}?status=success,
cancel_url: ${returnUrl}?status=cancelled,
});

  return {url: session.url};

} catch (error) {
console.error("Stripe Error:", error);
return {error: Stripe error: ${error.message}}; // This line sends the exact error from Stripe to the frontend
}

but how do I add in a specific user into this function?

#

I'm looking at other code and maybe am I supposed to add a "customer" ??

golden sparrow