#ambi_best-practices
1 messages ¡ Page 1 of 1 (latest)
đ 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/1331316091095351440
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
const {
id: stripeSubscriptionId,
status: stripeStatus,
cancel_at_period_end: cancelAtPeriodEnd,
latest_invoice: latestInvoice,
} = event.data.object
if (subscriptionStatus == SubscriptionStatus.pastDue && cancelAtPeriodEnd && latestInvoice != null) {
await this.stripe.invoices.voidInvoice(latestInvoice)
await this.stripe.subscriptions.cancel(stripeSubscriptionId, { invoice_now: false })
}
Hello! If you're setting it so the Subscription cancels at the end of the period, it's not canceled. Also, the Subscription being canceled doesn't really impact any outstanding Invoices which have already been created. It sounds like when they cancel through the Portal you should void the outstanding Invoices if you no longer want to collect payment: https://docs.stripe.com/api/invoices/void
How would I go about performing the voiding of the invoice?
I sent a code snippet, and I am wondering if the way I implemented it is correct.
Checking on the subscription.updated event, for the following conditions in the if statement
We can't perform code reviews here or tell you what your code will do when run. You can use test mode to determine if the code you have works as you expect it to or not.
alright
thanks
its not about the code
I am asking I am looking at the correct information provided in the event of the subscrption.updated
nevermind