#Mopey-CustomerPortal
1 messages ยท Page 1 of 1 (latest)
Hi there, you can control this via the portal configuration prices list https://stripe.com/docs/api/customer_portal/configurations/create?lang=php#create_portal_configuration-features-subscription_update-products-prices
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
The idea is to create two configurations
- config1: exclude c)
- config2: exclude a) and b)
and use these two config conditionally, so for customers who have subscribed a) and b), you should use config1 in the prices list, and for customer who have subscribed c), use config2.
Thanks Jack, thank you that's what I have now but if the user already has a subscription for (a) and (c) both of these options will show in the portal regardless or not of whether they are included in the configuration.
for example, my configuration is...
'subscription_update' => [ 'enabled' => true, 'default_allowed_updates' => ["price", "quantity", "promotion_code"], 'products' => [ [ 'product' => 'prod_MFFLEZqIx2hhqB', 'prices' => [ 'price_0LWkrHXH0ZWDS10rKCB8mgjH' ] ], // virtual ],
but the portal shows my subscription for this price but also another I already have and I can update from this price to the other.
So what's the expected behaviour you want to implement for a customer who has purchased a) and c)?
(a) can move to (b) or (b) can move to (a). (a) or (b) can not move to (c).
(c) can not move to (a) or (b).
user can purchase (a or b) + optionally (c)
hope that makes sense ๐
so for a user with (a) and (c) they should be able to switch (a) to (b) or cancel (c). There should be no option to update c to anything else or (a) to (c)
Then you should create another config to cover the use case for customer who purchased both a) and c)
How would that be configured? I have tried this
'products' => [ [ 'product' => 'prod_MFFLEZqIx2hhqB', 'prices' => [ 'price_0LWkrHXH0ZWDS10rKCB8mgjH' ] ], // virtual [ 'product' => 'prod_KFtsjBwIoV2Gv4', 'prices' => [ 'price_0KPP1xXH0ZWDS10rzrlfYvFu' ] ], // starter],
and it still allows switching between these two plans
It seems if a user has purchased two prices they are always able to switch between them regardless of configuration
or you can disable subscription_update by specifying an empty array (https://stripe.com/docs/api/customer_portal/configuration#portal_configuration_object-features-subscription_update)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
disabling subscription update prevents users moving (a) to (b)
There does not seem to be any way to prevent users updating (a) to (c) if they have already purchased both. This is not desirable as the user can then have two subscriptions for a or 2 for c
Is that a bug? I would have thought if you did not include a price in the configuration array it would never be an option to change to it.
Hey, taking over here. Just catching up
Thanks so much
My guess is this isn't possible with a single portal configuration. You'd probably need to create multiple portal configurations to map to the upgrade/downgrade paths you want
And then according to the subscription(s) the user has, pass in the relevant config when creating the session
Yes that's what I thought too but it always includes purchased prices in the options to change even if you don't specify them in the config
If a user has purchased a and c, it will always give the option to switch between them regardless of config
Can you share some example objects? price_xxx IDs that map to a,b,c and some how the bpc_xxx objects you've tried and what the outcome has been
Sure I have purchased,
- price_0KPP1xXH0ZWDS10rzrlfYvFu which maps to prod_KFtsjBwIoV2Gv4... (a)
- price_0LWkrHXH0ZWDS10rKCB8mgjH which maps to prod_MFFLEZqIx2hhqB... (c)
my config is...
'subscription_update' => [ 'enabled' => true, 'default_allowed_updates' => ["price", "quantity", "promotion_code"], 'products' => [ [ 'product' => 'prod_MFFLEZqIx2hhqB', 'prices' => [ 'price_0LWkrHXH0ZWDS10rKCB8mgjH' ] ], // virtual ],],
When I view this portal I can update (a) to (c)
There should really be a way to group products so you can only move between prices in a certain group imo
bpc_0LWye1XH0ZWDS10rokfO32OS is the id of that example config
Ok, and use that config with which cus_xxx results in what?
using it with cus_M3sZjBjoswWYDZ allows moving between price_0KPP1xXH0ZWDS10rzrlfYvFu and price_0LWkrHXH0ZWDS10rKCB8mgjH
but price_0KPP1xXH0ZWDS10rzrlfYvFu isn't in the list of allowed updates
Which subscription are you updating? That customer has 2 active and one is to price_0KPP1xXH0ZWDS10rzrlfYvFu: https://dashboard.stripe.com/test/subscriptions/sub_0LWolfXH0ZWDS10rchME2jNJ
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
My assumption is that's why its included
right, exactly. If the user has 2 active they can switch between them regardless of config
but they should not be able to
Yeah, seems like a limitation currently with no way around it
hmm, What Iwould have expected in the config would be a way to pass each prod_id and then a list of available prices that can be switched to for that product. Or a way at the product level to group products. If you're able to pass on suggestions ๐
I'm not sure what I'm going to do in the meantime though. I will need to ponder. Thanks for your time though
Do all your customers have multiple active subscriptions?
No, (c) is effectively an addon. Users can have a or b but optionally c too
Users would normally model that as an additional item on the same subscription
I guess that wouldn't really resolve your issue
yeah, I don't think I'm going to be able to use customer portal unfortunately
Can you share your ideal scenario succinctly for me? I'll forward to the portal team
The ideal scenario would be a way to group products so that it's only possible to move between prices in each group.
Thanks, will relay!