#dunaroo_unexpected

1 messages · Page 1 of 1 (latest)

oblique sableBOT
#

👋 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.

willow plover
#

@next elbow, let me know if I can provide any further information. Appreciate your help!

next elbow
willow plover
#

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).

next elbow
#

Can you share the product/price IDs as well as billing portal configuration ID?

willow plover
#

For sure—is all that data safe to share in this chat?

#

I guess it's test data so no worries.

next elbow
#

yup, IDs are safe to share

oblique sableBOT
#

💁 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_, or ek_)
  • 🛑 Secrets (examples include Stripe's client secrets, which contain _secret_, and Stripe's webhook signing secrets, which start with whsec_)
  • 🛑 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_ and py_)
  • 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.

willow plover
#

Whammo ^ haha

#

config ID: bpc_1R1WkfGPvaqcikYelQZxUFwl
'products': [
{
"product": "prod_RvNALm2pV4n4G1",
"prices": ["price_1R1WQJGPvaqcikYeEYQEDtqp", "price_1R1WQJGPvaqcikYeq90lfbJT"] }
]

next elbow
#

Hmm
Can you create two separate products for beta and non-beta pricing then?

willow plover
#

I did yeah. This is just the beta pricing. It should show just those prices, but it shows nothing and no option to update.

oblique sableBOT
prisma cosmos
#

Hi, taking over as my teammate needs to step away. Let me catch up.

willow plover
#

Kk sounds good, thanks @prisma cosmos !

prisma cosmos
willow plover
prisma cosmos
#

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?

willow plover
#

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.

prisma cosmos
#

Can you share the request where you pass only the BETA pricing and you can't edit it?

willow plover
#

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.

prisma cosmos
willow plover
#

Sure just a sec

#

Thanks for you help btw. I'm really trying to get this wrapped up today.

prisma cosmos
#

Sure

willow plover
#

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"
}
}
}
}
}

prisma cosmos
#

You need to pass the "configuration" you want in there

willow plover
prisma cosmos
#

There is, you asked 'not to configure correct?' so I wanted to make sure we were on the same page

willow plover
#

Oh sorry, I meant, you just wanted the data for the Creation of the Portal Session, not the Configuration update.

#

I gave you both.

prisma cosmos
#

Got it, still looking at this on my end

willow plover
#

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)

prisma cosmos
#

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?

willow plover
#

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.

willow plover
#

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?

prisma cosmos
#

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.

willow plover
#

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?

prisma cosmos
#

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.

willow plover
#

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?

oblique sableBOT
prisma cosmos
#

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.

willow plover
#

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?

cerulean atlas
#

Hi hi! I’m going to be taking over for my colleague here; can you please summarize your issue/question for me?

willow plover
#

See above. The issue is not really resolved. ^

cerulean atlas
#

I see lots and lots of words. 🙂 What is the current unresolved issue, in a sentence or two?

willow plover
#

What is causing certain portal session generation to ignore the configuration information being passed into portal sessions?

cerulean atlas
#

What config is it ignoring?

willow plover
#

The products list.

#

Thanks for your help btw. Just trying to get this wrapped up and felt like we were just figuring it out.

cerulean atlas
#

No worries - thanks for your patience! 🙂

willow plover
#

You too, sorry to be short.

cerulean atlas
#

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.

willow plover
#

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.

cerulean atlas
#

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?

willow plover
#

For Beta users only.

#

Yes, exactly.

#

For existing customer:

cerulean atlas
#

Can you share with me the failed and successful Customer IDs?

willow plover
#

For new customer:

#

Successful Id: cus_RvQMGWw3qu7u4w
Failure Id: cus_R6tEtOx5K1qCa0

#

Same exact process for setting the configuration and generating the portal.

cerulean atlas
#

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 😉 )

willow plover
#

Thank you!

#

Haha, secret logs

cerulean atlas
#

Still diiging, just FYI.

willow plover
#

Txh!

#

Any luck?

cerulean atlas
#

Not yet, no.

willow plover
#

Any leads?

#

Just hoping to have a direction since we're sending an announcement out to beta users asap.

cerulean atlas
#

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.

willow plover
#

Hmm interesting.

oblique sableBOT
willow plover
#

Oy vey, another handoff?

cerulean atlas
#

Every couple of hours, ya.

willow plover
#

Beginning to feel like the ugliest girl at the dance.

#

Haha

cerulean atlas
#

I'm here, so you can't be.

severe lintel
#

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.

oblique sableBOT
severe lintel
#

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?

willow plover
#

Ah just a sec. On a call will review shortly.

willow plover
#

Kk, just gonna try it here in a sec.

#

Just wrapped the call. Went soooo long

severe lintel
#

Sounds good!

willow plover
#

Okay, so yes it seems that it's based on automatic tax collection!

#

Toggling it on and off.

severe lintel
#

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?

willow plover
#

Oh let me check.

#

You mean this?

severe lintel
#

I believe you currently have all of them set to unspecified.

willow plover
#

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.

severe lintel
#

Wait... would that work with the Portal? 🤔

willow plover
#

Okay, switching to "No" for include tax in the price.

#

Yeah, that didn't work.

severe lintel
#

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.

willow plover
#

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.

severe lintel
#

Okay, did that change the Portal behavior?

willow plover
#

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.

severe lintel
#

Hm. Can you give me the Portal Session ID for the one that's not working?

willow plover
#

Of course, it could be because of this:

severe lintel
#

Ohhhhhhhhhh yes.

willow plover
#

I don't have customer addresses for free beta users.

severe lintel
#

Yep, that'll do it.

#

We can't calculate tax without that, so we can't facilitate an upgrade.

willow plover
#

I see.

#

So I'm neck deep in this and drowning a bit... what's the best approach here for my existing beta users?

severe lintel
#

Taking a big step back, what's your ultimate goal?

willow plover
#

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.

severe lintel
#

Oh, okay, so beta folks get special beta-only tiered Prices where the first five are free?

willow plover
#

Yessir!

#

Currently they all have a basic plan (they can change the number of seats) and a 100% free forever coupon.

severe lintel
#

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.

willow plover
#

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?

severe lintel
#

And then make sure your customers understand that for the upgrade option to appear they need to provide a complete billing address.

willow plover
#

I see, gotcha gotcha. So I'll add the ability for them to add their customer info.

severe lintel
#

Yep.

willow plover
#

Dude, THANK YOU. I'm not quite out of the woods just yet, but this has been hugely helpful.

severe lintel
#

Happy to help!

willow plover
#

So no change would be needed in my programming except to allow them to add their customer information.

severe lintel
#

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.

willow plover
#

Okay, let me try it real quick before you bounce.

severe lintel
#

I'm here for another 30+ minutes, so you're good. 🙂

willow plover
#

For Beta Users, process moving forward is:

  1. Delete existing subscriptions.
  2. Add the Beta-tiered subscription (with tax collecting on) to the users.
  3. Enable the user to add customer information.
  4. IF user is beta user, have their portal use a specific configuration.id with only the Beta product/pricing
severe lintel
#

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.

willow plover
#

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?

severe lintel
#

No.

willow plover
#

Sorry, my computer is laggingggg

severe lintel
#

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.

willow plover
#

Got it!

#

Trying...

#

Wow. You are a god.

#

It's working.

severe lintel
#

Awesome!

willow plover
#

And is there a bulk way to set all of the subscription prices for customers to collect tax automatically?

severe lintel
#

No, you'd need to do it manually or write a script to update them all via the API.

willow plover
#

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.

severe lintel
#

No. That's something you'll have to explain to people and guide them through.

willow plover
#

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?

severe lintel
#

No, you'd need to enable it after their address is added.

willow plover
#

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.

severe lintel
#

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.

oblique sableBOT