#dunaroo_unexpected
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1349093855215226931
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
@next elbow, let me know if I can provide any further information. Appreciate your help!
Hello
There are some limitations around what subscriptions can be updated with the Customer Portal - https://docs.stripe.com/customer-management#customer-portal-limitations
Can you check the list and see if any of the listed limitation affects your subscription?
Yeah, will take a look right now. Hold please.
It looks like tiered pricing is not something someone can adjust in portals, however I'm able to demonstrate that is not true. Here's an example with the portal showing tiered quantity changes.
The issue is that I cannot create a custom configuration with this product alone. (You'll see it shows both the Beta and Non-Beta pricing. We need it to show just one for this configuration).
Can you share the product/price IDs as well as billing portal configuration ID?
For sure—is all that data safe to share in this chat?
I guess it's test data so no worries.
yup, IDs are safe to share
💁 What you can share safely
This is a public server. Anyone can see the messages posted here, so you need to be careful when sharing certain information.
🛑 Not safe to share
Do not share anything sensitive or privileged on Discord, including the following:
- 🛑 Secret API keys (most Stripe secret API keys start with
sk_,rk_, orek_) - 🛑 Secrets (examples include Stripe's client secrets, which contain
_secret_, and Stripe's webhook signing secrets, which start withwhsec_) - 🛑 Passwords, keys, or other login/authentication details
- 🛑 Information about non-public features or functionality
If you don't want something public, don't share it here.
✅ Safe to share
Stripe object IDs are safe to share in public, and are often required to help us investigate and debug issues. Some examples of IDs you can share safely are:
- ✅ Customer IDs (
cus_) - ✅ Checkout Session IDs (
cs_) - ✅ Subscription IDs (
sub_) - ✅ Invoice IDs (
in_) - ✅ Setup Intent IDs (
seti_) - ✅ Payment Intent IDs (
pi_) - ✅ Charge IDs (
ch_andpy_) - ✅ Request IDs (
req_)
This list isn't comprehensive; there are too many Stripe object IDs and prefixes to list that are safe to share publicly.
If in doubt, ask someone on this server with the Stripe Staff role if a particular piece of information is safe to share before you share it.
Whammo ^ haha
config ID: bpc_1R1WkfGPvaqcikYelQZxUFwl
'products': [
{
"product": "prod_RvNALm2pV4n4G1",
"prices": ["price_1R1WQJGPvaqcikYeEYQEDtqp", "price_1R1WQJGPvaqcikYeq90lfbJT"] }
]
Hmm
Can you create two separate products for beta and non-beta pricing then?
I did yeah. This is just the beta pricing. It should show just those prices, but it shows nothing and no option to update.
Hi, taking over as my teammate needs to step away. Let me catch up.
Kk sounds good, thanks @prisma cosmos !
We document Customer Portal Configurations Limits here: https://docs.stripe.com/customer-management#customer-portal-limitations
Yeah, but as you can see above, that's not exactly the case here.
On your code when you create the portal, you're passing both prices. If you're looking to only show one of the prices, why are you passing both?
No, I want to show both yearly and monthly. I'm only passing one product.
That example I showed you was the generic customer portal from Stripe when you add products to it. I have added both Beta and non-Beta pricing to demonstrate that the tiered pricing updates work. However, when creating a custom configuration (trying to show ONLY the beta pricing) it will not show the option to edit it.
Can you share the request where you pass only the BETA pricing and you can't edit it?
Yeah, just a sec.
try:
configuration = stripe.billing_portal.Configuration.modify(
"bpc_1R1WkfGPvaqcikYelQZxUFwl",
features={
'subscription_update': {
'enabled': True,
"default_allowed_updates": ["price", "quantity"],
'products': [
{
"product": "prod_RvNALm2pV4n4G1",
"prices": ["price_1R1WQJGPvaqcikYeEYQEDtqp", "price_1R1WQJGPvaqcikYeq90lfbJT"]
}
]
},
"payment_method_update": { # Added to resolve the error
"enabled": True
},
"subscription_cancel": {
"enabled": True,
"mode": "at_period_end"
},
}
)
portal_session = stripe.billing_portal.Session.create(
customer=organization.stripe_customer_id,
return_url=return_url,
configuration=configuration.id
)
return redirect(portal_session.url)
I have toggled the subscription_cancel 'enabled' value to False (removing Cancel subscription) to confirm it is the correct configuration. So it is definitely working, but I can't understand why it is not showing the ability to change the subscription.
Can you share the request id created to create the billing portal session? Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Sure just a sec
Thanks for you help btw. I'm really trying to get this wrapped up today.
Sure
Kk so just to create the billing portal session, not to configure correct?
{
"id": "bps_1R1ZA1GPvaqcikYeNnpBGyDu",
"object": "billing_portal.session",
"configuration": "bpc_1R1WkfGPvaqcikYelQZxUFwl",
"created": 1741723941,
"customer": "cus_R6tEtOx5K1qCa0",
"flow": null,
"livemode": false,
"locale": null,
"on_behalf_of": null,
"return_url": "http://127.0.0.1:8000/organization/3/projects",
"url": "https://billing.stripe.com/p/session/test_YWNjdF8xTlNSQzdHUHZhcWNpa1llLF9SdlEwN0tRVGNjRkNYalJqdlp2Mzd4Q1EwUlB4a2450100AoXl5SAg"
}
Request POST body
{
"configuration": "bpc_1R1WkfGPvaqcikYelQZxUFwl",
"customer": "cus_R6tEtOx5K1qCa0",
"return_url": "http://127.0.0.1:8000/organization/3/projects"
}
And this is the configurations post and response:
{
"id": "bpc_1R1WkfGPvaqcikYelQZxUFwl",
"object": "billing_portal.configuration",
"active": true,
"application": null,
"business_profile": {
"headline": null,
"privacy_policy_url": null,
"terms_of_service_url": null
},
"created": 1741714681,
"default_return_url": null,
"features": {
"customer_update": {
"allowed_updates": [
],
"enabled": false
},
"invoice_history": {
"enabled": false
},
"payment_method_update": {
"enabled": true
},
"subscription_cancel": {
"cancellation_reason": {
"enabled": false,
"options": [
"too_expensive",
"missing_features",
"switched_service",
"unused",
"other"
]
},
"enabled": false,
"mode": "at_period_end",
"proration_behavior": "none"
},
"subscription_pause": {
"enabled": false
},
"subscription_update": {
"default_allowed_updates": [
"price",
"quantity"
],
"enabled": true,
"proration_behavior": "none",
"schedule_at_period_end": {
"conditions": [
]
}
}
},
"is_default": false,
"livemode": false,
"login_page": {
"enabled": false,
"url": null
},
"metadata": {
},
"updated": 1741723941
}
Request POST body
{
"features": {
"payment_method_update": {
"enabled": "True"
},
"subscription_cancel": {
"enabled": "False",
"mode": "at_period_end"
},
"subscription_update": {
"default_allowed_updates": {
"0": "price",
"1": "quantity"
},
"enabled": "True",
"products": {
"0": {
"prices": {
"0": "price_1R1WQJGPvaqcikYeEYQEDtqp",
"1": "price_1R1WQJGPvaqcikYeq90lfbJT"
},
"product": "prod_RvNALm2pV4n4G1"
}
}
}
}
}
You need to pass the "configuration" you want in there
Isn't it there in the POST:
{
"configuration": "bpc_1R1WkfGPvaqcikYelQZxUFwl",
"customer": "cus_R6tEtOx5K1qCa0",
"return_url": "http://127.0.0.1:8000/organization/3/projects"
}
There is, you asked 'not to configure correct?' so I wanted to make sure we were on the same page
Oh sorry, I meant, you just wanted the data for the Creation of the Portal Session, not the Configuration update.
I gave you both.
Got it, still looking at this on my end
kk thanks!
You understand the behavior we're looking to create, right? We just want a configuration that allows users that meet X condition (Beta Users) to see only a certain Product (Beta Org Seat) and its Prices (monthly / annual)
Can you create a brand new customer and create the session on that customer?
You control that and you're creating these different configurations on these billing sessions. You're asking why the customer us unable to edit the subscription on a specific session right?
Yeah exactly. I'm adding a subscription to all users that are Beta users. It should be the tiered Beta product. When they open their customer portal they should be the ONLY ones that see the tiered beta product and prices (monthly/annual) and they should be able to change # of seats.
If I create a new customer, it will likely require me to do a checkout session and that will be the non-beta pricing. I suppose I can create one programmatically. Just a sec.
So to create a session, I have to give it a subscription.
I can give it the "Organization Seat (Beta) " tiered subscription?
Okay, so I'm not sure why this is the case... but for some reason, it's working for the new customer.
Why is it not working for the existing customers?
Yeah, you'd always want to start with the simplest integration and add more complexity to better understand these. There are limitations: https://docs.stripe.com/customer-management#customer-portal-limitations like 'Customers can’t update or cancel subscriptions that currently have an update scheduled with a subscription schedule' and 'Customers can only modify subscriptions if the new price has the same tax behaviour as the initial price. Additionally, no modifications are allowed if the tax behaviour is unspecified, even if the tax behaviour of the new price is unspecified. Learn more about the tax_behavior parameter and how it relates to subscriptions.'
It is not that it's not working for existing customers, rather that existing customer just has so much going on that it's harder to identify which of these limitations is impacting it.
I see. So would it be possible for me to delete these customers that have had an existing subscription (even though it was free $0.00)? And re-add them fresh with a new subscription?
Sure if that is what you'd want. However, I think your next step is to add the next layer and see if creating a billing session works for this customer and go from there. It's really helpful to test these yourself and I also recommend that you use TestClocks: https://docs.stripe.com/billing/testing/test-clocks to advance time as well in test mode so you do not need to wait days/ weeks to see how it all behaves.
Okay, I'm just super confused by this—is it possible that because of existing subscriptions (even though canceled and not the most recent subscriptions) the portal configuration is breaking?
I mean anything is possible but I do not think it's breaking. I suspect it might be related to one of the limitations so you'd want to isolate and add more compexity to your test for this new customer.
Strange. There's really nothing new being added to this customer at any given time.
You're saying that "for some reason" it's ignoring the configuration information being passed into portal sessions for existing customers, correct?
Hi hi! I’m going to be taking over for my colleague here; can you please summarize your issue/question for me?
See above. The issue is not really resolved. ^
I see lots and lots of words. 🙂 What is the current unresolved issue, in a sentence or two?
What is causing certain portal session generation to ignore the configuration information being passed into portal sessions?
What config is it ignoring?
The products list.
Thanks for your help btw. Just trying to get this wrapped up and felt like we were just figuring it out.
No worries - thanks for your patience! 🙂
You too, sorry to be short.
No worries. Often times these conversations have transformed from the initial question, so it's easier to just have someone explain where things are at right now.
I see, gotcha.
Basically here's the deal:
I have customers that were beta users. To start off, we created subscriptions and gave them 100% off coupons. Moving forward, we want to transition to a 5 organization seat free tiered pricing.
Ok, so when you created a new Customer, you were able to successfully do what you want to do, but it didn't work for an existing customer?
Can you share with me the failed and successful Customer IDs?
For new customer:
Successful Id: cus_RvQMGWw3qu7u4w
Failure Id: cus_R6tEtOx5K1qCa0
Same exact process for setting the configuration and generating the portal.
Yup, I'm going to look at the details of things in the logs to see if I can figure out why this happened.
(Logs you can't see 😉 )
Not yet, no.
Any leads?
Just hoping to have a direction since we're sending an announcement out to beta users asap.
The two Subscriptions were created differently for some reason because they were created through the Dashboard.
I also see that the successful one has a pending_setup_intent waiting for a Payment Method, and the failed one also had automatic_tax enabled.
Hmm interesting.
Oy vey, another handoff?
Every couple of hours, ya.
I'm here, so you can't be.
Hello! I'm taking over and catching up...
Okay, mostly caught up (still have a few things to look at) but the big thing that stands out to me is what was called out above: the Subscription that worked as expected did not have automatic tax enabled. It looks like the Prices you're using don't have tax behavior specified, so we might be preventing upgrades for that reason.
Can you try specifying tax behavior for the Prices in question and try again? Or can you confirm Subscriptions with automatic tax enabled aren't working and ones without automatic tax are?
Ah just a sec. On a call will review shortly.
Sounds good!
Okay, so yes it seems that it's based on automatic tax collection!
Toggling it on and off.
Okay, that makes sense. If you add tax behavior to the Prices you're using does that get it working the way you want even if automatic tax is enabled?
No, on the Prices themselves it's the tax_behavior: https://docs.stripe.com/api/prices/update#update_price-tax_behavior
I believe you currently have all of them set to unspecified.
Ah, I see, I created all of the prices from the UI, so I believe I just set "Include tax in the price" to auto.
You could instead set a default tax behavior: https://docs.stripe.com/tax/products-prices-tax-codes-tax-behavior#setting-a-default-tax-behavior-(recommended)
Wait... would that work with the Portal? 🤔
Okay, so one of the limitations of the Customer Portal is this:
Customers can only modify subscriptions if the new price has the same tax behavior as the initial price. Additionally, no modifications are allowed if the tax behavior is unspecified, even if the tax behavior of the new price is unspecified. Learn more about the tax_behavior parameter and how it relates to subscriptions.
I think that's what you're running into, so if setting a default doesn't work you might have to specify it on the Prices themselves.
Gotcha gotcha.
Checking that now.
So the prices are already set to not include tax in the price.
And the product is also set to that now.
Okay, did that change the Portal behavior?
Setting it to No did not change the portal behavior. It still disappears from the portal when "collect tax automatically" is toggled for the customer.
When not automatically collecting tax, the subscription update button is available.
Hm. Can you give me the Portal Session ID for the one that's not working?
Of course, it could be because of this:
Ohhhhhhhhhh yes.
I don't have customer addresses for free beta users.
Yep, that'll do it.
We can't calculate tax without that, so we can't facilitate an upgrade.
I see.
So I'm neck deep in this and drowning a bit... what's the best approach here for my existing beta users?
Taking a big step back, what's your ultimate goal?
First of all, thank you. 🙂
Ultimate goal here is to give 5 free seats to beta users.
Everyone new doesn't get that free tier.
Coupons didn't work because % and flat rate doesn't work for yearly/monthly and scaling up for more seats.
Oh, okay, so beta folks get special beta-only tiered Prices where the first five are free?
Yessir!
Currently they all have a basic plan (they can change the number of seats) and a 100% free forever coupon.
Gotcha. So really what you're running up against is this: you have to choose to either enable automatic tax and collect the information required to calculate tax, or you can turn off automatic tax.
Gotcha, so let's just say, moving forward, I want the tax to be automatically collected for existing subscriptions.
BUT, for the beta subscriptions... if I want to do that, I have to open some special portal for them to add their address?
Yep. You can actually have it be the same Portal configuration where you also enable the Customer address update feature alongside the existing features you're already using: https://docs.stripe.com/api/customer_portal/configurations/object#portal_configuration_object-features-customer_update-allowed_updates
And then make sure your customers understand that for the upgrade option to appear they need to provide a complete billing address.
I see, gotcha gotcha. So I'll add the ability for them to add their customer info.
Yep.
Dude, THANK YOU. I'm not quite out of the woods just yet, but this has been hugely helpful.
Happy to help!
So no change would be needed in my programming except to allow them to add their customer information.
I don't think so. You'd need to test to be sure in test mode, but based on what I know so far this should work.
Okay, let me try it real quick before you bounce.
I'm here for another 30+ minutes, so you're good. 🙂
For Beta Users, process moving forward is:
- Delete existing subscriptions.
- Add the Beta-tiered subscription (with tax collecting on) to the users.
- Enable the user to add customer information.
- IF user is beta user, have their portal use a specific configuration.id with only the Beta product/pricing
That sounds like where I'd start, yeah. Set that up, test it, make sure it works as expected (and especially that adding an address gets the upgrade button working), then make sure you write up clear guidance for your beta users.
Yeah, trying that right now with my test account.
Hold plz
It's just this right?
configuration = stripe.billing_portal.Configuration.modify(
"bpc_1R1WkfGPvaqcikYelQZxUFwl",
features={
'subscription_update': {
'enabled': True,
"default_allowed_updates": ["price", "quantity"],
'products': [
{
"product": "prod_RvNALm2pV4n4G1",
"prices": ["price_1R1WQJGPvaqcikYeEYQEDtqp", "price_1R1WQJGPvaqcikYeq90lfbJT"]
}
]
},
"payment_method_update": { # Added to resolve the error
"enabled": True
},
"subscription_cancel": {
"enabled": True,
"mode": "at_period_end"
},
"customer_update": {
"enabled": True
},
}
)
customer_update enabled?
No.
Sorry, my computer is laggingggg
Well, it's correct, but you also need to add allowed_updates alongside enabled and the value of allowed_updates is an array containing what you want to enable, like address.
Awesome!
And is there a bulk way to set all of the subscription prices for customers to collect tax automatically?
No, you'd need to do it manually or write a script to update them all via the API.
Gotcha kk
Alrighty, I thiiiiink, although don't quote me... that we miiiiight—afraid to say it—be good.
Gonna test a couple more things.
Ah shoot...
Is there a way to require individuals to update their address and to programmatically turn on their automatic tax collection?
I guess I can do that all through the API
Damn coding is a bitch, huh.
No. That's something you'll have to explain to people and guide them through.
It looks like I can't turn on automatic tax collecting for live subscriptions (non test) unless I have their address. Will it automatically toggle on when they do add their address?
No, you'd need to enable it after their address is added.
Kk, shucks. But there must be an API call I can make that checks whether or not they have an address and if so, I then can tell them to collect taxes automatically.
Yeah, you can check this property on the Customer: https://docs.stripe.com/api/customers/object#customer_object-tax-automatic_tax
You can also listen to customer.updated Events to see when an address update is made.
Or, more specifically, when they're in a state where they can support automatic tax.
Note that tax is an expandable field on Customers and isn't included by default.