#omaradelp4er
1 messages · Page 1 of 1 (latest)
Hi there
hi
i want to get the email and metadata from the session in the webhook to perform an operation when the webhook is trigerd but i cannot
when i try to write this: var webhook = new WebHookTest
{
Email = session.CustomerEmail,
};
_unit.WebHookTest.Add(webhook);
_unit.Complete();
i got error that i cannot inser null value in my database
that mean that i cannot access the session data although i see it in my dashbord
When you say session do you mean a Checkout Session object?
and also when i do this session.CustomerDetails.Email ii got null error
yes
i mean this session var session = stripeEvent.Data.Object as Stripe.Checkout.Session;
Okay but when you log it right below initializing session you do see the correct data returned?
just in this i can see the data: var json = await new StreamReader(HttpContext.Request.Body).ReadToEndAsync();
_logger.LogInformation(json);
What happens if you log out session as a whole after initializing it? Is that null?
Have you logged out stripeEvent.Data.Object yet?
i tried to log the session after convert it into json now and i see all the data correctly
i will try stripeEvent.Data.Object now
Sounds good. You may want to refer to https://stripe.com/docs/webhooks/quickstart?lang=dotnet which can give you a simple code example of how we suggest handling this
all of it logs data but still i cannot use it in my code
i do all of this
Sorry I don't understand what that means. You can't submit the data to your database properly?
Like if you can print the data then it is there
It is then up to you to handle it properly
i mean i cannot get it in my c# code how to do it
If it is printing then you do have it in your code... I can't write your code for how to handle the data after receiving it in your webhook endpoint. I can only help you with Stripe-specific issues
ok thanks