#brad_01495
1 messages · Page 1 of 1 (latest)
Only thing the portal gives me is the ability to update payment info.
Hello there
Hello!
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.
Cool cool. Glad to have that confirmed.
You created a Portal Session for a Customer with a Subscription?
But you aren't seeing the Subscription within the Customer Portal?
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:
Can you provide your Portal Session ID that you created? You should be able to find it in your logs at. https://dashboard.stripe.com/test/logs
Should look like bps_xxxx
bps_1Nf6fQHUEMXMwifT65aWRNHt
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
Is that a problem? My site is currently not live and I'm having a really hard time managing all of these keys
Yes it is specifically against card network regualations to test in live mode: https://stripe.com/docs/testing#use-test-cards
You should only be using your test keys until you are ready to go live
Okay so would that be the problem it seems?
Cause my card was still charged regardless
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
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" ??
Hi there 👋 apologies for the delay while taking over from my teammate. Yes, passing the customer parameter with the ID of an existing Customer object is how you create a Checkout Session for a specific Customer:
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-customer