#Akin

1 messages · Page 1 of 1 (latest)

humble scaffoldBOT
dense rock
#

Hi there! Sorry for the delay

#

Can you share more details about what's failing exactly? I'm not sure what you mean by "custom email within an event"

#

With webhooks, you should be listening for specific events and responding to Stripe to confirm the event was received. Any webhook handler code on your end would be totally custom.

midnight condor
#

So I am listening to charges.succeeded event and would like to send email with receipt attached to customer when this is fired

#

I wrote a function that does this(send email to customer) but noticed when i called this function i get a failed event log in stripe for this event

#

Is that clear or would like me to send more info or screenshot if it would make it clearer?

dense rock
#

The function to send the email to the customer should be called after your endpoint returns a 200 response to Stripe

#

Can you share details about the failed event log you're receiving?

midnight condor
#

Yes will send the screenshot now

#

Here is where i am calling the function in my code

#

Here is the failed log in stripe for that event

dense rock
#

hm, I don't think you want to use await here, as you want to send the 200 response to Stripe as soon as possible

#

also, for the default action, you can try logging something instead of responding to Stripe with a 400

#

You could also try calling onSendSubscriptionReceiptEmail outside of your webhook handler code

midnight condor
#

Ah okay, i will try removing the await and try to log something for the default action. Thanks

#

Also, invoice.paid event doesn’t not return receipt url in the response right?

dense rock
#

that's right. invoice.paid returns an invoice object. you can have your handler code retrieve the invoice and expand charge.receipt_url

midnight condor
#

How do you expand charge.receipt_url from the invoice?

dense rock