#sevitom_unexpected

1 messages ยท Page 1 of 1 (latest)

tender shardBOT
#

๐Ÿ‘‹ 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/1241088153016733747

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

strong hill
#

Hi ๐Ÿ‘‹

Do you have example Subscription and Invoice IDs I can review?

viral plinth
#

Hi, do you mean ids from my test environment?

strong hill
#

Yes

viral plinth
#

customer id: cus_Q7kHXZdQ3Ujkna
sub id: sub_1PHUn7HPBcGdUhQsr5psmX5s
invoice id: in_1PHUtGHPBcGdUhQsA8DX8snE

thanks for the help!

strong hill
#

Okay so you generated an Invoice for $800 based on the accumulated usage at the time the subscription canceled. But 2 seconds after it was created, the invoice went to a state of closed_canceled

#

Does that sound right?

viral plinth
#

That sounds right, and that behavior is unexpected right?

#

The invoice creation and state change is triggered by cancellation caused by billing cycle end

strong hill
#

Acutally no, I think that is expected. We don't say that this invoice will be auto-collected. Additionally we document

Canceling subscriptions disables creating new invoices for the subscription and stops automatic collection of all invoices from the subscription by setting auto_advance to false.
here: https://docs.stripe.com/billing/subscriptions/overview#cancel-subscriptions

viral plinth
#

Also, If I do not set cancel_at_period_end through the API but instead set cancel_at_period_end through the stripe dashboard, it behaves as expected

#

I can give you ids for that case in a few minutes

#

This test gave me the same result

#

๐Ÿ˜ฆ

#

its gotta be a stripe issue right?

#

stripe sim time*

#

it says right there in the UI they should be charged

strong hill
#

But when you complete the action, the invoice is canceled instead?

viral plinth
#

At this point, the invoice isn't created yet, its "upcoming"

#

if i complete this action, nothing changes because the subscription is scheduled to cancel in the future

#

then i run stripe sim time to Jun 19 expecting the charge, but the state change you saw happens automatically

#

sub_1PHVUcHPBcGdUhQsVHcRNW3A

in_1PHVWMHPBcGdUhQsILhtB1xv

this is the second test I ran with the same result through the dashboard

strong hill
#

Okay I need to check with a colleague. This might be an artifact of using Test clocks

viral plinth
#

Ok cool, that would be no problem

strong hill
#

QQ have you tried to finalize and attempt payment on the invoice? It looks like the invoice is still in a status of draft

viral plinth
#

I have not

#

In terms of designing our system, we want to avoid doing that and use this automatic functionality

strong hill
#

The Invoice will remain in draft status for 1 hour after being created. This timeline is not controlled by the test clock

viral plinth
#

Understood, so its 100% a test clock issue?

strong hill
#

Not quite. Because auto_advance is disabled when the susbcription is canceled, it will be up to you to finalize and attempt payment.

viral plinth
#

I don't think thats right, all the documentation and even the UI says it should be automatically collected

#

I will try a test where I very carefully advance the sim clock really quick and get back to you

#

give me a few mins

tender shardBOT
viral plinth
#

Yea I'm not sure, I tried just advancing sim time an hour past the period end and got the same result

deft swan
#

Can you clarify this part:

even the UI says it should be automatically collected
What are you reading/looking at that suggests this?

viral plinth
deft swan
#

Gotcha, this seems to be somewhat ambiguous in what the Dashboard suggests, since the invoice is generated, but the collection is not happening automatically due ot the cancelation. You can manually charge the customer using the invoice view in the dashboard, or finalize/pay via the API.

#

I would suggest writing in to our support team with the steps you followed and the mismatched description <> behaviour: https://support.stripe.com/contact

viral plinth
#

I'm really not convinced, there are two places the functionality in phrased like the customer should be billed and its very conceivable to me its a corner case with Stripe Sim Time in test mode

#

why would it say in both places they will be "billed" but not collected?

#

"After you schedule the cancellation of a subscription using cancel_at_period_end, you can reactivate it at any point up to the end of the period by updating cancel_at_period_end to false. The final invoice includes any metered usage after the subscription cancels at the end of the billing period."

deft swan
#

The final invoice includes any metered usage after the subscription cancels at the end of the billing period.
Which is does here, correct?

#

ie, the invoice is generated as you expect, but not automatically collecting, right?

viral plinth
#

Can we keep this thread open for a bit while I test? I swear I ran a case where it randomly worked, but I regularly delete my customers while testing so I can keep using sim time

#

what would be the point for the functionality if I had to manually send the invoice?

#

an invoice is always created at the end of the period regardless, so its not really any different from what normally happens if the subscription doesn't cancel at the end of its period

deft swan
#

Yes please test this some more, consider a try using the API instead of the dashboard to see if that has an effect

viral plinth
#

Subscription: sub_1PHWa2HPBcGdUhQsYc34OiuT
Invoice: sub_1PHWa2HPBcGdUhQsYc34OiuT

Subscription is canceled due to cancellation at end of period
Invoice will be charged, that random state change that causes it not to be charge did not occur

#

Is there a dev maybe with a unit test or line of code they can look at and know the exact intended behavior? because Test Mode + Sim time is definitely giving mixed results

deft swan
#

Yep, the team can definitely try to reproduce and investigate and if you write in with reproduction steps in the Dashboard that will kick that off

viral plinth
#

here you go

Start with a metered, monthly subscription that has an upcoming invoice with charged items in it.

Update Stripe Subscription to cancel_at_period_end at dashboard

Advance sim time past period end.

Invoice auto_advance set to false and never charged

deft swan
#

In the interim, you should /finalize these invoices manually, either via the Dashboard or API

viral plinth
#

ok thanks for the help