Skip to content

The moment it happens

Report failed Chargebee payments in Slack

One message per failed invoice with the customer, amount and reason, even while dunning keeps retrying.

Runs
The moment it happens
Apps
Chargebee
AI
Not needed
Access
read-only key; admin sets webhook

Send this to your assistant

Create a ClickRuntime automation: when a Chargebee payment fails, post the customer, amount and failure reason to #billing in Slack. Alert only once per invoice.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

A failed payment is a small emergency that looks like routine noise. The card declines, Chargebee records a failed transaction, and unless someone is watching the billing screen, nobody knows until the retry window has closed. For a company with a few hundred subscriptions, that gap is where recurring revenue quietly slips away.

As soon as Chargebee reports a payment failure, this reads the event, pulls out the transaction details and the customer behind it, and posts a clear message to the channel you choose. The person on billing duty can see who, how much and why it failed without logging in.

Teams with high-value accounts get the most from it, since a fast personal email can save a renewal that automated retries would lose. The alert is built from Chargebee's own event data, so what the team reads in Slack matches exactly what the billing system recorded about the failed charge.

What you get out of it

  • Reach the customer while retries remain

    Chargebee retries failed charges on a schedule. If you contact the customer after the first failure, they can update the card before the final attempt, and the account never lapses or loses access.

  • Know which failures matter most

    The post names the customer and the amount, so you can triage. A $29 monthly failure can wait for the retry. A $9,000 annual one deserves a phone call that afternoon. Large accounts get a personal call or note instead of the generic automated email that smaller plans receive.

  • Stop relying on someone checking billing

    Nobody watches a billing dashboard all day. A message in the channel the team already reads means failures are seen by whoever is online, including after hours when handing off to a teammate is easy.

  • Spot a pattern across many failures

    Several failures arriving in an hour in the same channel often point to a gateway outage or a changed integration rather than customer cards. Seeing them grouped lets you raise the issue with your payment provider quickly.

  • Leave a timestamped trail for audits

    Each alert is a dated record that a failure was known and when. If a customer later disputes a suspension, you can show exactly when the team was told and acted. The record is also handy when you compare months and want to know whether failures are rising or falling.

How it works

What happens, step by step

  1. When a payment fails in Chargebee, Chargebee tells ClickRuntime straight away.

  2. ClickRuntime picks out the customer, the amount and the reason it failed.

  3. A message goes to your #billing Slack channel with those details, such as "Insufficient funds".

Before it runs live

  • Connect Chargebee
  • Paste your automation's link into the other app's webhook settings

What you get

RunsThe moment it happens
Report failed Chargebee payments in Slackjust nowSucceeded
Slack · #billing💳 Payment failed: Acme Corp, USD 199.00 Reason: Insufficient funds

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Act only on the items that match your own rules, and skip the rest
  • Add an AI step, for example to summarize, sort or draft a reply
  • Add another app, for example also send it to Slack
  • Combine it with other Chargebee steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
payment_failed_alert_chargebee.pyexample
from clickruntime import on_event, credentials, state, notify

def from_chargebee(event):
    return event.header("Authorization") == credentials.secret("CHARGEBEE_WEBHOOK_AUTH")  # "Basic ..." set on the webhook

@on_event
def handle(event):
    if not from_chargebee(event):
        return {"posted": False, "reason": "unauthorised"}
    body = event.json
    if body["event_type"] != "payment_failed":
        return {"posted": False}
    c, txn = body["content"]["customer"], body["content"]["transaction"]
    invoice_id = (body["content"].get("invoice") or {}).get("id", txn["id"])
    if state.get(f"alerted:{invoice_id}"):
        return {"posted": False, "reason": "already alerted"}
    name = c.get("company") or c.get("email")
    notify.slack(f"💳 Payment failed: {name}, {txn['currency_code']} {txn['amount'] / 100:,.2f}\n"
                 f"Reason: {txn.get('error_text') or txn.get('error_code') or 'unknown'}", channel="#billing")
    state.set(f"alerted:{invoice_id}", True)
    return {"invoice": invoice_id}

FAQ

Common questions

Does it alert on every retry or only the first failure?
It reacts to each payment failure event that Chargebee sends, so a repeated failed retry can post again. If that is too noisy, your AI assistant can add a step to post only once per invoice, shown for your approval.
What details appear in the message?
The message includes the customer, the amount and the transaction information Chargebee supplies about the failure. Sensitive card data is never part of the event, so full card numbers cannot show up in Slack. Customers' full card numbers never leave the payment provider, so the details shown are limited to what Chargebee exposes in the event.
Is the incoming webhook secure?
Yes. The endpoint is protected with basic authentication, and the credentials are stored as secrets. Requests that do not present them are rejected, so only your Chargebee site can trigger a post. A request without the correct credentials simply gets an error response and nothing is posted, which keeps the channel free of spoofed alerts.
What permissions does it need?
read-only key; admin sets webhook. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run for each event the app sends.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Report failed Chargebee payments in Slack” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.