#aooa1009
1 messages · Page 1 of 1 (latest)
Hi there
Hi!
Customer IDs are unique per-Customer object.
They will not change once created.
But we also don't prevent duplicates from being created.
Okay
I'm kind of stuck here
So it mostly depends on how you are creating Customers right now
could you spare some time to hear my case
Assuming you are a developer then yep that's what we are here for.
Yep
So, I followed a tutorial and set up 4 plans of monthly subscriptions
https://www.youtube.com/watch?v=_ieKBxM1lwI&pp=ygUhbXVsdGlwbGUgcHJvZHVjdCBvbiBzdHJpcGUgbmV4dGpz
This one above.
And now I wanted to add another product, called Credits
It successfully worked
Now I want to add Credits to my product
Credits are not recurring, they're bought by the user when they run out of credits or just want to buy more
its a one-time buy
they enter in how many credits they want
and then I followed the same step as in the above video
except, with a few changes, new StripePriceId, changing mode from subscription to payment, etc
but now, when I click "Buy Credits"
it takes me to
To the subscription plan management page
Hmmm
its a package pricing model
It sounds to me like your code is redirecting to Customer Portal on your "buy credits" button
What does that code look like?
yep
one moment
how can i share the code easily
its too long for discord
one moment
I don't want your whole code please
Just the relevant part for your "buy credits" button
And you can put that in 3 backticks like this
cool
one min
I'm beat as to what's wrong
let me guide you through it quickly
Screenshots of code are really hard for us to work with. In the future copy the relevant part into text and put it in backticks.
the buy credits button is here
it calls this action
at Line 37, the stripeSession is made
So yeah
In your manageSubscriptionActionCredits function you are creating a Customer Portal Session
at line 14, I used the old code, from where I get the user's current Monthly Subscription plan - as the cost of one credit is determined based on what plan they're currently on, their stripeCustomerId and if they're currently subscribed
It sounds like you want to be sending them to Checkout instead, no?
yeah
where they buy this - the credits!, not options to cancel or see billing info of their ongoing subscription
Right
So that is the code you need to fix
You want to send them to Checkout, not the Customer Portal
here, in line 37, im making a checkout session
see
what am i doing wrong ;-;
Any additional details I can give you, please lmk
I can't debug your code for you
What you want to do is add logs throughout your code to understand what is happening
So like why is it hitting your code that is creating a customer portal session
That is what you want to figure out
When does it go to customer portal session
In your manageSubscription_ActionCredits function
Where you return the Portal Session URL
mhm
oh
okk
another question!
where can I find everything in the stripeSession object
if (isSubscribed && stripeCustomerId && isCurrentPlan) { const stripeSession = await stripe.billingPortal.sessions.create({ customer: stripeCustomerId, return_url: billingUrl, }); return { url: stripeSession.url }; }
What does this code do, I'm confused a little
once I commented it, it worked