#rust_api

1 messages ยท Page 1 of 1 (latest)

clear questBOT
#

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

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

austere cave
#

in_1SOVzbJW1HYWVXZV4q8PoZfn is an instnace of a credit memo being voided

#

I know i can do this through the credit note api for sure but I want to avoid sending requests so i dont hit the rate limit of 100/second

urban pike
#

hi there, give me a moment to catch up

austere cave
#

is there a way i can avoid that, could i somehow calculate if a credit note was applied by computing something once the invoice webhook event comes in ?

urban pike
#

Hmm...I can check that but I would need a more recent invoice. Do you have an invoice created in the last 30 days with a credit note applied?

austere cave
#

I dont unfortunately, this is the only edge case i found when backfill one of my customers

urban pike
#

all good. I was looking at in_1SEeXzJW1HYWVXZVKYCLjmwj initially but I noticed you shared another invoice ID.
in_1SOVzbJW1HYWVXZV4q8PoZfn is pretty new so I can check its event logs, give me a moment

#

Are you already listening to invoice webhooks like invoice.updated?

austere cave
#

yes i am, currently listening to paid, payment failed, created, updated, finalized,

urban pike
#

okay, in that case, when a credit note is applied to an invoice, Strpe emits two events โ€” credit_note.created and invoice.updated
Since you are already listening to invoice.updated, you can look at pre_payment_credit_notes_amount parameter in this event after you apply a credit note to an invoice.
You can view this event in your Dashboard as an example: evt_1SVcvaJW1HYWVXZV1oixTxUV
pre_payment_credit_notes_amount should be a non-zero value if the credit note is applied on the invoice (i.e. not voided)

#

evt_1SVcvaJW1HYWVXZV1oixTxUV is from in_1SOVzbJW1HYWVXZV4q8PoZfn.

#

Also, after a credit note is applied to an invoice, any changes to the credit note will also emit invoice.updated event for the invoice. But I would still recommend listening to credit note events for easier tracking of the credit note status

austere cave
#

got it, so it sounds like theres no way to infer the credit note application from just the invoice object

#

I'll give this a try tomorrow

#

btw, for starting_balance and ending_balance within the invoice object, is that based off of credit notes as well ?

#

or do i have to track something else

urban pike
austere cave
#

got it ok