#alexpanda_unexpected

1 messages ¡ Page 1 of 1 (latest)

somber pilotBOT
#

👋 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/1370158144029720766

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

random atlas
primal shoal
#

Hello
As far as I know, Once the subscription is cancelled then we stop finalizing invoices automatically. In this case, looks like the invoice was paid by the customer using Hosted Invoice page after we stopped retrying the invoice.

#

We don't automatically void the invoices for cancelled subscription though

random atlas
#

how can you tell it was a hosted page action by customer?

#

and is there a way for me to get the subscription ID in this case during the charge.succeeded event?

primal shoal
#

Ideal way to handle this ->

You could listen for customers.subscription.deleted webhook event and list all associated invoices using List all invoices API - https://docs.stripe.com/api/invoices/list#list_invoices-subscription
You can filter using subscriptions and status param

how can you tell it was a hosted page action by customer?
I looked at our internal logs

and is there a way for me to get the subscription ID in this case during the charge.succeeded event?
The charge object isn't associated with a subscription directly. You'd need to look at the associated invoice first and then expand that to look at the subscription
https://docs.stripe.com/api/charges/object?api-version=2024-06-20#charge_object-invoice
https://docs.stripe.com/api/invoices/object?api-version=2024-06-20#invoice_object-subscription

#

In the newest API version though (Basil) - we've made a few changes so the above approach won't work when you eventually update to the latest API version

random atlas
#

does the new approach work on old API?

primal shoal
random atlas
#

Thanks for the context, I think I have what I need