#sai_rez - delete draft invoice

1 messages ยท Page 1 of 1 (latest)

mortal quarry
carmine fable
#

Can a draft invoice be considered as finalised?

mortal quarry
#

No, draft and finalized are different states. An invoice will be in draft form for an hour or until you make a call to finalize it

carmine fable
#

So for a customer who has multiple draft invoices what's the best way to handle this use case? Ideally I would like to remove them

mortal quarry
#

Why do they have multiple draft Invoices?

#

Do they have multiple subscriptions?

carmine fable
#

Could do, I have been looking at a few customers and they have 1 subscription but multiple draft invoices, possible from automatic collection which failed

mortal quarry
#

Do you have an ID for a customer like that?

#

(cus_123...)

carmine fable
#

Here you go

#

cus_KJnWUfCR5nGFZi

#

They have an unpaid subscription, this requirement is to clean up invoices on unpaid, overdue, and cancelled subscriptions

mortal quarry
#

Thank you. Checking in to them now

carmine fable
#

Thanks

mortal quarry
#

Apologies, still looking in to this. The other threads I am on got busy. I should be able to get back to this in a minute.

carmine fable
#

No worries, thanks for the update

mortal quarry
#

Thank you for understanding. I am reaching out to a colleague who can look in to this while I am juggling. Apologies for the delay

carmine fable
#

Appreciate the help

mortal quarry
#

My colleague is still looking in to this. We can see that the initial failed invoice failed after all payment attempts were unsuccessful and that the draft invoices have been cancelled almost immediately after being created. We are looking in to how and why they were cancelled here.

#

I assume your end goal in this case is to have Invoices not be generated anymore in this scenario?>

carmine fable
#

Yes exactly, we have already taken measures to mark failed invoices as uncollectable, we're now looking to cleanup existing ones

#

Our initial idea was to mark all draft and open invoices for unpaid/overdue/cancelled customers as uncollectable, however it seems for draft that can only be done if they are finalised

zenith carbon
#

Hi ๐Ÿ‘‹ I'm stepping in for @mortal quarry

#

These invoices after the initial failed one are all in a closed_canceled state.

carmine fable
#

Could you explain what that is, haven't come across it

zenith carbon
#

Yeah it can be tough because we see this records in our admin pages. The DB provides "friendly" terms and names so it can be difficult to explain what I am seeing to you. Let me take a closer look

carmine fable
#

Awesome thanks

#

Wasn't sure if it's okay to ask another question in this thread

zenith carbon
#

Yes, it's preferred you keep all discussion here. Especially since it's related.

carmine fable
#

Okay will keep in mind, I had a quick question, hopefully simpler to answer. Are invoices with status overdue on the dashboard the same as status open?

zenith carbon
#

Not exactly.

carmine fable
#

When making an api call to list all invoices for a customer, they all return as open, however on dashboard it;s overdue, curious if that's expected

zenith carbon
carmine fable
#

Yes I had a look at these, so on the dashboard when there is a status of failed or overdue next to an invoice, it's technically still open as it's not been paid?

zenith carbon
#

I think that is the case. I need to review these in my own test account. But the Dashboard values are intended to provide you an idea of what is going on, where the invoice.status is trying to give you a real time description of the current state of the invoice.

carmine fable
#

It can certainly be confusing haha

#

Okay well that clears that up, thanks

carmine fable
#

Hey @zenith carbon any updates on closed_canceled status?

zenith carbon
#

That is the object state for the invoices associated with that subscription/customer.

#

They do show appear to show up as Draft in the DB though

carmine fable
#

Is there a way to remove them?

#

Using the API

zenith carbon
#

Hold on, I'm going to investigate.

#

Unfortunately you cannot remove these invoices.

#

You can mark them as void to indicate you will not seek payment

carmine fable
#

I can't void them unfortunately as they are not finalised

#

Yes we've made adjustments in the settings to avoid this already, we are just looking to clean the data of previous customers

quiet shale
#

What error do you get when you try to finalize/void exactly?

carmine fable
#

{ "error": { "message": "You can only pass in open invoices. This invoice isn't open.", "type": "invalid_request_error" }
}

quiet shale
#

Can you share more information like the exact invoice id and the exact request id?

carmine fable
#

in_1J3fkXKl7yri9QNLkIc2TRnR

quiet shale
#

you just leaked your API key

#

please roll that API key

carmine fable
#

It's a test account, no live account details

quiet shale
#

doesn't matter, please roll the API key as anyone could have seen it

#

Okay so it's all Test mode, why does this matter overall?

carmine fable
#

Because we have customers in our live account that have multiple draft invoices that we would like to remove, it's clean up the data

#

So using test mode with similar customer properties to test

quiet shale
#

gotcha

#

so what you need to do instead is this

#

1/ Update the invoice to set auto_advance: false if it's not set
2/ Finalize the invoice (this won't charge since you disabled auto advance)
3/ Void the invoice

Unfortunately we don't let you void an open invoice, you always have to finalize first ๐Ÿ˜ฆ

carmine fable
#

Okay will try, thanks a lot for your patience

quiet shale
#

Of course! sorry this is confusing, that's why we discourage the "mark subscription as unpaid" flow a lot