#idhruv-webhooks-metadata
1 messages · Page 1 of 1 (latest)
Can you elaborate? Where are you looking for metadata? What are you seeing on your end that seems inconsistent?
sure. i will explain
const webhookEndpoint = await stripe.webhookEndpoints.create({ url: ${BASE.URL}/api/payment/create/subscription-paid, enabled_events: [ 'invoice.payment_succeeded', ], metadata: {'bookingId': String(bookingArr[i]?._id)} });
i am settin metadata while creating webhooks after my subscription schedule is created
now i expect that for every subscription cut every month i send this bookingId to my external api
but in my case when payment is cut it sends empty metadata for every cut it takes via subscription
Do you have request IDs for both the API call that updated metadata and the event that triggered the webhook with empty metadata?
Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
trying to find the same, just a moment
req_5iVWb9kNiCVerU: here we set the webhook with bookingId inside metadata
but when internal api gets called it empty data
Okay, but that only sets the metadata for invoice.payment_succeeded events, but you said you're looking for the metadata in "subscription schedules"
this is what api caught, empty stuff
no the problem is metadata should be visible at internal api's request end when subscription cut takes place
Is the view in that screenshot in test-mode?
yes
so, the workflow is like this -> subscription cut takes place -> invoice is paid -> webhook calls one of my internal api
What is "cut"? I don't know what that means
and i assume it should have that metadata which i loaded it with whle creating webhook
cut means when money is fully paid
for every monthly cycle from customer's account
The endpoint appears to have been configured properly with metadata: https://dashboard.stripe.com/test/logs?object=we_1LL5uqGdNldKu1zmYx0aZ824
So these requests are erroring out and I don't see any successful webhook attempts. I would get that working first, and then attempt to fix the metadata problem. It's possible that no modification to the webhook payload takes place on failed webhooks, though I'm not sure
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
actually thats what i am struggling with, successful webhook attempt is not occurring coz it cannot find the metadata i send to my internal api which webhook calls
and it works if i call via stripe cli but when code is running on the server it returns empty metadata
I don't see any successful webhook attempts to your endpoint, so I'm trying to understand. Do you have a conditional in your webhoook handler that relies on metadata in order to send back a 200 success response? Can you confirm that this is actually hitting your server?
yes actually, we rely heavily on the value we send in metadata
Can you send back a 200 saying that you got the webhook and then make sure that the successful delivery of the webhook is not the problem?
I would be surprised if it was, but I want to rule that out before attempting to repro, as it will take a considerable amount of time on my end to do so
okay and where should i do it? should i return 200 from webhook endpoint api in my code?
Yeah, so you'd just return a 200 in your response at the beginning of your webhook handler, before the metadata conditional executes
yep trying it
POST /api/payment/create/subscription-paid 200 3.783 ms - 63
i can see this from my server
because as soon as subscription was created few endpoint calls were made
but where i can see this in stripe
In the logs i can only see req_SUrrEybwCjbv1D and req_ukUK2Dlj3DftaX which just conveys that subscription and webhooks were created with required metadata loaded in webhooks
Hello, two-shoes had to step out but I can help. Catching up on this thread now...
Are you setting metadata anywhere other than the webhook endpoint itself?
As far as I know, setting metadata on the endpoint will only ever put metadata on the endpoint, it won't populate metadata on all of the events that go to that endpoint.