#trueinviso

1 messages · Page 1 of 1 (latest)

steep currentBOT
restive bronze
#

What state are you referring to? Do you have an example?

#

What are you trying to do exactly?

alpine rapids
#

well in the screenshot you can see that there is no ID yet for the item, so I can see the item in the Stripe dashboard, but the actual update isn't complete yet.

#

So my webapp is still waiting for the stripe update webhook to fire

#

Sometimes it takes a few minutes for that webhook to fire

#

So I'd like to display a message on the account page informing the user that their requested subscription update is in progress

#

Otherwise the user won't know that their subscription update was successful

restive bronze
#

Can you share the subscription ID here?

alpine rapids
#

sub_1MC6RVHDRwNsRKsO4IamLN3A

This is the ID, but now the update is fully complete

#

there is a 2-3 minute window where the app is waiting for the customer.subscription.updated webhook to fire, which is plenty of time for a user to get confused and think the update failed.

restive bronze
#

hey sorry about the delay, missed the update her, looking

#

this appears to have had many schedules created and released on it

#

What updates are you making where you see this?

alpine rapids
#

yes it has for testing purposes

#

any update I make, does not actually complete for a couple minutes

restive bronze
#

Are you using pending_if_incomplete? I don't see a request using that, but I'm trying to understand these updates you're describing

alpine rapids
#

any update

restive bronze
#

Are you always making your change via schedule?

alpine rapids
#

changing a plan is what I'm doing

#

yes, because of the business rules in our app, if they upgrade it needs to happen immediately, downgrades happen end of billing cycle. Each subscription can have multiple item changes

#

so sometimes there might be an immediate upgrade then a scheduled downgrade on another product in a few weeks

restive bronze
#

OK then if that's how you're using subscriptions to stage these subscription changes, you can inspect the subscription schedule attribute to see the attached schedule indicating some kind of pending change, which would allow you to show some kind of ⏲️ icon
https://stripe.com/docs/api/subscriptions/object?lang=ruby#subscription_object-schedule

#

If you need more detail you can retrieve that schedule or expand it on the subscription retrieval
https://stripe.com/docs/expand

Learn how to reduce the number of requests you make to the Stripe API by expanding objects in responses.

#

expand[]=schedule

alpine rapids
#

but how do I know if it's pending? Sometimes the start_date is already past on a phase, but the update hasn't actually completed yet

#

is there a specific field on subscription you are referring to?

restive bronze
#

What do you mean the update hasnt completed?

#

I think the presence of a schedule at all is what you're primarily looking for

alpine rapids
#

there is no way to know if a phase on the schedule is complete

restive bronze
#

If there are no future phases and the schedule is set to release then there are no pending changes

#

What do you mean "complete"?

alpine rapids
#

the actual subscription change hasn't happened yet and fired the customer.subscription.updated webhook

restive bronze
#

i would expect to find future phases if that were the case

alpine rapids
#

also when I create the schedule it doesn't actually finish the last phase, it gives it an end date of the end of the billing cycle, even tho it's basically done already

restive bronze
#

That's within your control, you can release after the change

#

but its also why i say to look for future phases, ie, is there more than one phase (the current phase)

alpine rapids
#

what do you consider a future phase, one that has a start_date in the future?

restive bronze
#

if there is only the current phase, unless the schedule is set to cancel when complete there will be no further changes

alpine rapids
#

I can work around that, but my original problem remains, the last phase has started, but the actual subscription is complete with updating

#

is not complete updating I mean

#

usually it's like the screenshot I showed you, I can see the subscription item in the dashboard, but the item has no id yet

#
"items": {
    "object": "list",
    "data": [
      {
        "id": "si_MvyaHTL9063CVu",
        "object": "subscription_item",
        "billing_thresholds": null,
        "created": 1670354218,
        "metadata": {},
        "price": {
          "id": "sh_pro_135",
          "object": "price",
          "active": true,
          "billing_scheme": "per_unit",

I wonder if that active field on the subscription item's price is false when there is no ID

#

So I just added another addon called multi-city, and I see it in the dashboard without an SI ID, when I retrieve the subscription, that item is not in the items list of the subscription, it only has the "active" ones

#

so I can't find a way to see the pending subscription items on the subscription that aren't added yet

#

I dunno, I guess I'm not explaining this well

restive bronze
#

When the phase changes (current_phase is updated, reflected in subscription_schedule.updated) the subscription update should happen at the same time

#

Are you seeing anything unexpected in teh data anywhere, or is this something you're seeing exclusively in the dashboard view?

#

If you set up your schedule to change the subscription much later, say tomorrow, do you see that item listed?

#

Or only once the phase changes?

alpine rapids
#

so the update happens

restive bronze
#

What update

alpine rapids
#

but it's not complete

#

the subscription update requested by the phase

restive bronze
#

you're getting the subscription update event?

alpine rapids
#

it takes a few minutes for the actual update to finish at that point

#

it takes a few minutes for the subscription update event to happen

#

so yes, I do get it, but it takes a few minutes

#

so for a few minutes the user is in a state where they don't know that their update was successful

#

this is the case without schedules as well

#

if I update the subscription using the subscription update endpoint, it can take a minute or two for the event to fire

#

Does my question make sense now?

restive bronze
#

OK, i think I understand now -- thanks for your patience

#

This appears to be related to processing the subscription changes due to phase progression

#

@valid falcon is going to help you out and i've shared some details around the complexity of managing phase changes here, since we are not currently emitting an event for the phase change

#

evt_1MC9BRHDRwNsRKsOaqxuhEmf is the change due to your update request to create an additional phase

#

really you need to be waiting for customer.subscription.updated to know when the subscription has been modified

alpine rapids
#

I am waiting for that

#

it takes a few minutes for it to fire

restive bronze
#

Are you seeing the item with no id anywhere in the API data?

#

Or only inspecting in the dashboard?

alpine rapids
#

When I retrieve the subscription in this state, it's not in the list of subscription items, even tho you can see it in the dashboard without an ID

#

When I retrieve using the API I mean, it doesn't contain the new item in the list of items even tho it's in the dashboard without an ID

valid falcon
#

Hi @alpine rapids 👋

@restive bronze had to step away. Are you able to write in to support and generate an email thread so we can get back to you async? This is a particularly complex issue and we're going to need to do some repro work on our end to fully understand what to advise and what needs to be surfaced to the product team.

alpine rapids
#

I guess there isn't a way to know, and I need to add the products on my side immediately, but mark them as pending. Then when the update event finally fires I can mark them as active

#

Tbh this seems like it would be a fairly common issue, but maybe a lot of people activate subscriptions on their end without waiting for the webhook to fire