Handle Payment Failed in Dotnet Minimal Api

.NET Minimal-API developers integrate Comaro into their applications using the Comaro SDK, which provides a dedicated event handler that listens for `PaymentFailed` events from the Comaro payment gateway. When a payment fails, this handler automatically triggers a webhook call to Comaro, delivering the relevant transaction details and allowing the application to initiate automated actions like retry attempts, customer notifications, or updating internal records based on pre-configured Comaro event rules.

Zero Boilerplate

Stop writing the same event handlers over and over. Comorando executes your logic automatically.

Smart Retries

Exponential backoff, dead-letter queues, and alert escalation — built in, no config needed.

AI Decisions

Gemma 4 evaluates every event and suggests the optimal action based on your business rules.

Code Example

// minimal-api — payment-failed handler with Comorando
[ApiController, Route("webhook")]
public class WebhookController : ControllerBase {
    private readonly IComorandoClient _comorando;
    public WebhookController(IComorandoClient comorando) => _comorando = comorando;

    [HttpPost]
    public async Task<IActionResult> Handle() {
        var json = await new StreamReader(HttpContext.Request.Body).ReadToEndAsync();
        var stripeEvent = EventUtility.ConstructEvent(json,
            Request.Headers["Stripe-Signature"], _webhookSecret);

        // Comorando evaluates rules and fires actions automatically
        await _comorando.Decisions.CreateAsync(new DecisionRequest {
            Event = stripeEvent.Type,
            Data  = stripeEvent.Data.RawObject,
            OrgId = Environment.GetEnvironmentVariable("COMORANDO_ORG_ID")
        });
        return Ok(new { received = true });
    }
}

Automate your backend events today

Free tier includes 10,000 events/month. No credit card required.

Start Free See Pricing