Skip to main content
Connic

Stripe Dunning

By Connic

Automated Stripe payment recovery with multi-stage personalized dunning emails. Tracks customer history and escalates from friendly reminders to pause notices.

FinanceIntermediateStripeEmail
connic init my-project --templates=stripe-dunning

Overview

Handles Stripe webhook events for failed payments and subscription changes. The payment analyzer looks up customer history from the database, decides the appropriate dunning stage, and uses trigger_agent to dispatch the recovery composer. Middleware filters irrelevant Stripe events with StopProcessing and extracts customer metadata into context. Supports multi-stage dunning from friendly reminders to service pause notifications.

Use cases

Failed payment recovery

Automatically send escalating recovery emails when subscription payments fail, personalized by dunning stage.

Subscription lifecycle

React to subscription status changes (past_due, cancelled) with appropriate customer communications.

Win-back campaigns

Trigger personalized win-back emails when customers cancel, tailored to their usage history.

Architecture

Stripe Webhook
payment-analyzer
recovery-composer
Payment Events DB
Email Outbound

Main template files

Install these files with connic init my-project --templates=stripe-dunning. The CLI places agent definitions in a folder named after the template under agents/.

stripe-dunning/
  agents/
    payment-analyzer.yaml
    recovery-composer.yaml
    dunning-pipeline.yaml
  tools/
    payment_tools.py
  middleware/
    payment-analyzer.py
  schemas/
    payment-analysis.json
    recovery-email.json
  requirements.txt
  README.md

Get started

Install the template, create a Connic project, and deploy through a connected Git repository or the CLI.

Prerequisites

  • Python 3.10+
  • A Connic account (create a project first)
  • Project credit for a connic/* model, or credentials for a BYOK provider
Create project
  1. Install and scaffold

    Install the SDK and create a project from this template.

    terminal
    pip install connic-composer-sdk
    connic init my-project --templates=stripe-dunning

    Then cd my-project

  2. Deploy

    Choose a deployment method. A connected Git repository deploys on push; use the CLI for projects without a connected Git repository.

    Git integration
    1. In Connic: Project Settings → Git & Environments, connect the GitHub repository

    2. On the same page, map a branch (e.g. main) to the Production environment

    3. Push the scaffolded project to that repository

    terminal
    git add .
    git commit -m "Add Stripe Dunning template"
    git push origin main
    CLI deploy
    1. In Connic: Project Settings → API Keys & MCP Auth, create an API key and copy project ID

    2. Run connic login in the project folder

    3. Use connic dev to try with hot-reload, connic test to run suites, or connic deploy for production

    terminal
    connic login
    connic dev     # Ephemeral dev env with hot-reload
    connic test    # Run declarative test suites
    connic deploy  # Deploy to production
  3. Connect and configure

    Add a Stripe connector, copy the webhook URL to the Stripe Dashboard, then paste the signing secret back. Add an Email outbound connector for recovery emails. Use a connic/* model, or add BYOK credentials under Project Settings → LLM Provider.

Template source

Browse the full template, contribute improvements, or fork it for another use case.

connic-org/connic-awesome-agents/tree/main/stripe-dunning

Information

Publisher
By Connic
Difficulty
Intermediate
Works with
Stripe, Email
Source
GitHub