I'm following this guide here for installing and using webhooks in ASP.Net MVC, but it looks like this guide is for a wep api type project. I'm using a MVC type project and there is no Register method, unlike a API project. In MVC we have a RegisterRoutes method. So how do I register my webhooks in MVC?
an API project that uses Register and config, my ASP.Net MVC site doesn't have this.
MVC uses RegisterRoutes
UPdate Here I added a web api controller and the code I posted below is whats in the web api controller. I included the nuget packages for webhooks, the registration in global.asax.cs and in the register method. But I'm still having problems reaching the code 'ExecuteAsync' no breakpoints are being hit
public class StripeWebHookHandler : WebHookHandler
{
// ngrok http -host-header="localhost:[port]" [port]
// http(s)://<yourhost>/api/webhooks/incoming/stripe/ strip receiver
public StripeWebHookHandler()
{
this.Receiver = StripeWebHookReceiver.ReceiverName;
}
public override Task ExecuteAsync(string generator, WebHookHandlerContext context)
{
// For more information about Stripe WebHook payloads, please see
// 'https://stripe.com/docs/webhooks'
StripeEvent entry = context.GetDataOrDefault<StripeEvent>();
// We can trace to see what is going on.
Trace.WriteLine(entry.ToString());
// Switch over the event types if you want to
switch (entry.EventType)
{
default:
// Information can be returned in a plain text response
context.Response = context.Request.CreateResponse();
context.Response.Content = new StringContent(string.Format("Hello {0} event!", entry.EventType));
break;
}
return Task.FromResult(true);
}
}