#dmonn_unexpected

1 messages ยท Page 1 of 1 (latest)

unreal pikeBOT
#

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

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

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

torn hatch
#

Hey sorry, I had a call and you closed my previous thread

#

@small sun asked:

So you paused the collection on Jan 2 https://dashboard.stripe.com/logs/req_dnH8QKJ9sfGjYo, and resume it on Jan 16
https://dashboard.stripe.com/logs/req_4qHcvMB4VS50ZS As far I can tell, you didn't pause and resume the same subscription on the same day.


That's correct. I didn't resume on the same day, I resumed on the day that the original invoice was due. If we check the logs here: https://dashboard.stripe.com/acct_1GeGzCEefV9my3r1/events?related_object=sub_1QU4v4EefV9my3r1HooemOq9

Here's what happens on January 16th:

  • 19:14, draft invoice for $0 is created
  • 20:00, we resume the subscription (with a few trial days to reset the billing date)
  • 20:00, draft invoice for $0 is finalized
  • 20:14, same invoice is being edited to now be $240
  • 20:14, invoice for $240 finalized and paid

What we expected is that the draft invoice over $0 stays that way. We don't want the person to be charged (hence why we add trial days)

#

Use case here is: Pausing a subscription when it still has X days left in the billing cycle, then once they resume their subscription being able to add those X days back on (through trial days). But there's this edge cases where users still get charged if they resume within an hour (?) of their original invoice.

obsidian axle
#

(I can see the old thread)

#

I think this is working as expected. The issue ultimately is that you didn't set resumes_at when you paused the subscription. That means we don't void all created invoices during paused state automatically. Then when you resumed the subscription here was before the $240 invoice (in_1Qhr25EefV9my3r1dOklRStt) was finalized (~1 hour after creation โ€“ the natural lifecycle of an invoice). We then automatically attempted payment on it

#

Your request to unpause the sub actually generated a different invoice that reflects the requested trial period: in_1QhrkQEefV9my3r1W79luHF5

torn hatch
#

Gotcha. What's the best way to mitigate this? I don't know resumes_at at the time of the pause. Users actually come back online to resume. We then set the trial period + unpause in the same call. I was under the impression that the new billing date should overwrite the pending invoice?

Could I potentially void all draft invoices at the time of resumption? But then again, when I check the logs, I don't think the invoice was in draft any more at this point.

What I want to achieve essentially is being able to say "the subscription is being unpaused today, and we want the next payment to be in X days"

invoices = stripe.Invoice.list(
    subscription=<sub_id>,
    status='draft'
)
for invoice in invoices.data:
    stripe.Invoice.void_invoice(
        invoice.id
    )
obsidian axle
#

My recommendation would be to listen for invoice.created events that fire during paused state (like this) and void them manually if indeed paused

We then set the trial period + unpause in the same call. I was under the impression that the new billing date should overwrite the pending invoice?
Any updates to a sub will generate a new invoice and the old invoices remain unaffected and can still be paid (if open)

unreal pikeBOT
torn hatch
#

Ok sure ๐Ÿ‘ That works for me