#RichHamilton-webhook
1 messages · Page 1 of 1 (latest)
endpointSecret = "whsec_AS7GBIHZKcOn7jJlS6Fi1FibJ0lj7mVt"
Stripe-Signature = t=1649781708,v1=a24705e4171b7962d83267eaca1cf848c363786aa0716f7aa376e50a434c6843,v0=443da03be93be9bcdd915a563cd0099ffdbca3025b5e6f6528a3b0a22c23e945
evt_3KnliHBJoTIUOmnP10ByvB9C
and what does your webhook processing code look like?
(I am using Umbraco)
[HttpPost]
public async Task<IHttpActionResult> IndexAsync([FromBody] dynamic content)
{
var contentService = _services.ContentService;
StripePaymentHelper stripePaymentHelper = new StripePaymentHelper(_services.ContentService);
var contentString = Convert.ToString(content);
try
{
var stripeSignature = Request.Headers.GetValues("Stripe-Signature").First();
var stripeEvent = EventUtility.ConstructEvent(contentString,
stripeSignature, endpointSecret);
if (stripeEvent.Type == Events.PaymentIntentPaymentFailed || stripeEvent.Type == Events.PaymentIntentCanceled)
{...
I'm not the most familiar with .net, but from a quick read of your code my guess would be that you're not working with the raw body of the event. We expect you to make NO modifications to the raw body (you need to keep all the same spaces, new lines, etc) and any change will result in the wrong signature
OK
That would make sense as I'm reading as JSON and then converting
so maybe I just need to read as a raw string
Yeah, try working with the raw string and see if that helps
Sorry I missed this question! It should be application/json
If I use string I get NULL returned, it needs a type 😦
public async Task<IHttpActionResult> IndexAsync([FromBody] string content)
I'd suggest searching around for how others take in the raw request body with .net - maybe something like https://stackoverflow.com/a/39373215/14107360 will work?
I have a controller running on ASP.NET Core 1.0 RC2 and I'd like to dump the raw POST data out to telemetry as ApplicationInsights doesn't do this for you. My code looks like this
[HttpPost]
[Prod...