public async Task <ActionResult> StripeCallbackAsync() { Event stripeEvent; try { stripeEvent = EventUtility.ConstructEvent( await new StreamReader(HttpContext.Request.Body).ReadToEndAsync(), Request.Headers["Stripe-Signature"], _stripeOptions.CurrentValue.WebhookSecret, throwOnApiVersionMismatch: false); } catch (StripeException) { // event construction failed, so request wasn't valid return(ResultUtilities.BadRequest("You're not stripe, are you?")); } switch (stripeEvent.Type) { case Events.CheckoutSessionCompleted when stripeEvent.Data.Object is Session session: await _stripe.HandleSupporterCheckoutCompletedAsync(session); break; default: return(ResultUtilities.BadRequest($"Stripe event {stripeEvent.Type} should not be received by this server.")); } return(Ok()); }