#theasteve

1 messages · Page 1 of 1 (latest)

night haloBOT
forest wave
#

That's normal if there were previous open invoices that haven't been paid

#

They still have potential to be paid

#

So if you don't want that to be possible, you'll need to void all open invoices when cancelling as well

analog ridge
#

No this are new invoices

#

these*

forest wave
#

Well can you share an invoice id where this happened?

analog ridge
#

in_1OgFhHJrL4BQxxcUWwWiyZh5

#

this is another one

#

ch_3OfBJ9JrL4BQxxcU0uy9Rphb

forest wave
#

Subscription was cancelled at 2024-02-05 03:00:04 +0000. The invoice above was created at 2024-02-05 00:06:03 +0000

#

So it was an open invoice when sub was cancelled

analog ridge
#

what about this one ch_3OfBJ9JrL4BQxxcU0uy9Rphb

#

this is another charge as well ch_3OfBJ9JrL4BQxxcU0uy9Rphb

forest wave
#

All the same

#

You can check this yourself

#

We have created timestamps

#

And you can see what time you canceled the subscription

analog ridge
#

is this difference by seconds or something?

forest wave
#

No the issue is that these invoice were created before cancellation

#

They remain open even when subscription is cancelled

#

This is expected behavior

#

They're always eligible to be paid when open

#

So they can be paid anytime after subscription cancellation

#

You'd need to void the open invoices too if you don't want this to be possible

analog ridge
#
      insurance_policy.terminated? && invoice_created_after_policy_termination?
    end

    def invoice_created_after_policy_termination?
      charge_invoice = charge.invoice
      return false unless charge_invoice

      cancellation_time = Time.zone.at(insurance_policy.coverage_end_date).to_datetime
      charge_invoice.stripe_created_at > cancellation_time
    end```
#

Not sure where Im messing up, anyways thanks for your help.

#

Quick question

#

do I look at Subscription canceled_at to compare?

#

thats what your using to compare?

#

thanks a ton 🙏

forest wave
#

And then just looking at the created timestamp on each invoice