#ares_webhooks

1 messages ¡ Page 1 of 1 (latest)

wise geodeBOT
#

👋 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.

frosty meadow
vestal jungle
#

We have upgraded from 2020-08-27

frosty meadow
#

Then you'll need to retrieve the Charge object and 'expand' the refunds property in your webhook code

vestal jungle
#
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

frosty meadow
#

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

vestal jungle
#

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'],
  });
.....
}
frosty meadow
#

Exactly

vestal jungle
#

okay that should fix the issue for me. thanks for always helping. Appreciate it.

frosty meadow
#

No problem, glad I could help!