#ares_webhooks
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/1379388684448829532
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- ares_webhooks, 22 hours ago, 24 messages
- ares_api, 1 day ago, 15 messages
Likely related to an older change (depending on what version you've upgraded from):
The Charge object no longer auto-expands refunds. While you can manually expand refunds, Stripe recommends against it for performance reasons.
We have upgraded from 2020-08-27
Then you'll need to retrieve the Charge object and 'expand' the refunds property in your webhook code
export async function handler(event: Stripe.Event): Promise<void> {
const charge = <Stripe.Charge>event.data.object;
if (!charge.refunds)
throw new PsstError('error', {
code: 500,
type: 'InternalServerError',
message: `Missing refunds on charge [${charge.id}]`,
});
......
}
how can we expand this? this is the event object coming as part of charge.refunded webhook
You can't expand the event. You need to make an API call to retrieve the Charge object using the ch_xxx ID
And you can pass expand: ['refunds'] to that call
something like this
export async function handler(event: Stripe.Event): Promise<void> {
const charge = <Stripe.Charge>event.data.object;
const chargeObject = await stripe.charges.retrieve(charge.id, {
expand: ['refunds'],
});
.....
}
Exactly
okay that should fix the issue for me. thanks for always helping. Appreciate it.
No problem, glad I could help!