Handle Payment Failed in Rust Actix Web

Actix-web developers utilize Comorando to automatically generate webhook events for payment failures by intercepting errors within their Actix-web applications, specifically targeting routes handling payment processing. Comorando then transforms these errors into standardized Comorando events, enriching them with relevant context like request details and error codes, which are subsequently delivered to a central eventing system for further processing and alerting.

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

// actix-web — payment-failed handler with Comorando
use actix_web::{post, web, HttpRequest, HttpResponse};
use comorando::Client as Comorando;

#[post("/webhook")]
async fn webhook(req: HttpRequest, body: web::Bytes) -> HttpResponse {
    let sig = req.headers().get("stripe-signature").unwrap().to_str().unwrap();
    let event = stripe::Webhook::construct_event(&body, sig, &WEBHOOK_SECRET).unwrap();

    // Comorando evaluates rules and fires actions automatically
    let comorando = Comorando::new(&std::env::var("COMORANDO_API_KEY").unwrap());
    comorando.decisions().create(json!({
        "event":  event.event_type,
        "data":   event.data.object,
        "org_id": std::env::var("COMORANDO_ORG_ID").unwrap()
    })).await.unwrap();
    HttpResponse::Ok().json(serde_json::json!({"received": true}))
}

Automate your backend events today

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

Start Free See Pricing