21 lines
655 B
C#
21 lines
655 B
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using PlotLine.Services;
|
|
|
|
namespace PlotLine.Controllers;
|
|
|
|
[AllowAnonymous]
|
|
[ApiController]
|
|
[Route("api/stripe/webhook")]
|
|
public sealed class StripeWebhookController(IStripeBillingService stripeBilling) : ControllerBase
|
|
{
|
|
[HttpPost]
|
|
public async Task<IActionResult> Post()
|
|
{
|
|
var json = await new StreamReader(Request.Body).ReadToEndAsync();
|
|
var signature = Request.Headers["Stripe-Signature"].ToString();
|
|
var result = await stripeBilling.HandleWebhookAsync(json, signature);
|
|
return StatusCode(result.StatusCode, result.Message);
|
|
}
|
|
}
|