#Ninja man
1 messages · Page 1 of 1 (latest)
Hi there
Hmm this doesn't sound right. You should be able to manage multiple Subscriptions from the Customer Portal if I remember correctly
The product i subscibed to before is totally gone from the portal once i start another one
It just says: CURRENT PLAN
and shows the new subscripion
Let's pause for a second
Are you trying to create a new Subscription from the Customer Portal?
Because that's not possible
You can only manage current Subscriptions
So what it sounds like is you are updating a current Subscription if you are doing this in the Customer Portal
No.
I have created 2 products with a subscription.
I subscribe to the first product and then i see it in the customer portal.
Then i start a subscription for the other product, and now that is the only product i se in the customer pportal
Okay can you give me an example Customer and a screenshot from the Customer Portal for what you are seeing?
Great and can you give me the Customer ID associated with that Portal Session?
Very weird thing, in the "customers" section, it has 2 customers with the same email 🤔 So that would explain why this is happening. But how can this even be possible? I use the same email when i started to subcribe to both products?
How are you creating the Subscriptions?
By a payment link
Yeah that's why
Payment Links have no Customer association
They are meant for one-to-many
So there is no authentication up front for return Customers
If you want to maintain a Customer here then you would use a Checkout Session
And pass the Customer ID to the Checkout Session for a return customer
Ahhhhh okay, so how can i test this from the dashboard?
Well you could just manually create a Customer in the Dashboard and then create two Subscriptions for that Customer via the Dashboard if you just want to test the Customer Portal
You need to write a little bit of code to test it through Checkout
So this is what i have in my project, or do i need to add something more for it to be able for the return customer thing?
Ah okay so you pass a Customer ID to the Customer param: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-customer
So basically, look at the Customer ID that was created from the initial time that you completed the Checkout Sesssion
And pass that ID to the second Session you create
Then the new Subscription will be created for that same Customer
hmmmm alright but this sounds like i need to store something on my side in a database 🤔 I would just want this to work without having to work with storing users data
Yeah that's correct... you wold need an authentication flow when a customer visits your site to match them to a Customer ID. Which yes, requires a database.
Otherwise there is no way to know whether it is a new or returning customer
ahhh damnit lol.. Well in this case i could just build out my own portal if i need to have auth and all that..
I mean sure you could. But that would be a ton more work than using the Customer Portal
But i mean like if i need to build out a auth flow, have database, have server, implement that on the frontend etc, that is what will take long time. Then when thats done i would just use stripe API to do al of those things which wouldnt be so hard i suppose
Yeah we don't support an auth flow ourselves, unfortunately. So there isn't really another path here if you want to allow for Subscription management with multiple Subs.
Alright yeah, i mean 1 easy way would be: Before you subscribe, you create an account with https://magic.link/ and store the account ID in mongo DB atlas. Now when you start the subscription you check if the user has any custmer ID in mongo DB, and if so, pass it to the checkout session.
This would take me like 1-2 hours to do and i use Next JS so i will have all this logic in the server.
Yep that would be a good flow
Also if i do that, would it be an easy way to get what products the customer is subscriped to from stripe api? As i would save the customer ID in mongo
Nope i don't think so? I can use a simple fetch request
Yep that works fine overall. It is possible that your Customer would drop off before hitting your Success URL, so we recommend Webhooks to catch those times. But you can fetch your server and then retrieve the Session and expand the line_items (https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-line_items) to see what Products the customer purchased.
Ahhh i meant: I want to get all products the customer is subscribed to, to show what products the customer have already subscribed to in the web shop
Oh okay then you would list Subs by Customer: https://stripe.com/docs/api/subscriptions/list#list_subscriptions-customer
And the Subscription object will contain items which will include the Products/Prices: https://stripe.com/docs/api/subscriptions/object#subscription_object-items
Ahh cool so what would be the endpoint? I cant find it
Ah nice, so:
-u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \
-d limit=3```
Would be good to have a node js exampel lol