Skip to main content
connic

Stripe

Run an agent on failed payments, subscription changes, disputes or any other Stripe event. connic checks the signature before anything runs.

Modes
Inbound
Set up in
Dashboard or connectors/*.yaml
Documentation
Stripe docs
Publisher
By connic

Get the whole event as input

The agent receives each event as Stripe sends it, with its type and the data.object it refers to, so it can act on a decline code or a new plan right away.

Any event type
Payment intents, invoices, subscriptions, disputes and the rest of Stripe's catalog. The connector forwards whatever the endpoint sends.
Every linked agent
One event starts a run for each agent linked to the connector, and the response to Stripe lists the run IDs.
Skip what an agent ignores
Raise StopProcessing in before() middleware for event types an agent doesn't handle, and the run ends before the model is called.
payment-failed.json
{
  "id": "evt_3Q8812",
  "object": "event",
  "type": "payment_intent.payment_failed",
  "data": {
    "object": {
      "id": "pi_3Q8812",
      "amount": 4900,
      "currency": "eur",
      "customer": "cus_R48812",
      "last_payment_error": {
        "code": "expired_card",
        "message": "Your card has expired."
      }
    }
  }
}
subscription-updated.json
{
  "id": "evt_3Q9120",
  "object": "event",
  "type": "customer.subscription.updated",
  "data": {
    "object": {
      "id": "sub_1Q4102",
      "customer": "cus_R48812",
      "status": "active",
      "plan": { "id": "plan_pro", "amount": 4900, "interval": "month" }
    },
    "previous_attributes": {
      "plan": { "id": "plan_starter" }
    }
  }
}

Only signed events start a run

connic checks every request against your endpoint's signing secret before an agent sees it.

Signing secret first
Until you save the whsec_ secret from Stripe, every request gets a 400 and nothing runs.
HMAC-SHA256
The Stripe-Signature header must match a signature over the timestamp and the raw body. A missing or wrong signature gets a 401.
Five-minute window
Events signed more than five minutes ago are rejected, so old requests can't be replayed.
response-200.json
{
  "status": "ok",
  "event_type": "payment_intent.payment_failed",
  "dispatched_to": 1,
  "run_ids": ["550e8400-e29b-41d4-a716-446655440000"]
}
response-401.json
{
  "error": "Invalid Stripe signature"
}

Keep the Stripe trigger in code

Declare it in connectors/. The signing secret comes from a Variable, so it never sits in the file. Deploy once to get the URL, add the endpoint in Stripe, then store its whsec_ secret as a Variable and reference it.

connectors/billing-events.yaml
type: stripe
name: Billing events
config:
  webhook_secret: ${STRIPE_WEBHOOK_SECRET}
agents:
  - dunning-agent
update: connectors/billing-events.yaml (stripe)

Pick the events in Stripe

You connect once in the Stripe Dashboard. After that, you change which events reach your agents there, without a deploy.

Paused connector
connic answers Stripe with a 200 and starts no run. Events from that time aren't stored or replayed after you resume.
Rate limits
Requests above the connector's rate limit get a 429 with a retry_after value.
  1. Create the connector

    connic generates its webhook URL. For a connector in code, the first deploy does.

  2. Add the endpoint in Stripe

    Paste the URL as a webhook endpoint and select the events Stripe should send.

  3. Save the signing secret

    Copy the whsec_ secret that Stripe generates for the endpoint into the connector.

  4. Events start runs

    Each verified event starts the linked agents, and every run shows up in Agent Runs with its trace.

Where a Stripe trigger fits

Pick a setup to see which event starts the agent, what it receives and where the result goes.

A declined payment starts the agent, which emails the customer a message that fits the decline reason.

Declined payment
Stripe inbound
dunning-agent
Email to the customer
event.json
{
  "id": "evt_3Q8812",
  "object": "event",
  "type": "payment_intent.payment_failed",
  "data": {
    "object": {
      "id": "pi_3Q8812",
      "amount": 4900,
      "currency": "eur",
      "customer": "cus_R48812",
      "last_payment_error": {
        "code": "card_declined",
        "decline_code": "insufficient_funds",
        "message": "Your card has insufficient funds."
      }
    }
  }
}
connector-payload.json
{
  "to": "jana@example.com",
  "subject": "Your payment of 49.00 EUR didn't go through",
  "body": "We'll retry in three days, or pay now with another card."
}

A plan upgrade starts the agent, which gives your customer success team a heads-up in Slack.

Plan upgrade
Stripe inbound
upgrade-notifier
Heads-up in Slack
event.json
{
  "id": "evt_3Q9120",
  "object": "event",
  "type": "customer.subscription.updated",
  "data": {
    "object": {
      "id": "sub_1Q4102",
      "customer": "cus_R48812",
      "status": "active",
      "plan": { "id": "plan_pro", "amount": 4900, "interval": "month" }
    },
    "previous_attributes": {
      "plan": { "id": "plan_starter" }
    }
  }
}
connector-payload.json
{
  "text": "Example GmbH moved from Starter to pro (49 EUR per month).",
  "channel_id": "C01234567"
}

A new dispute starts the agent, which collects the order and support history into a draft response for finance.

New dispute
Stripe inbound
dispute-assistant
Draft for finance
event.json
{
  "id": "evt_3Q9455",
  "object": "event",
  "type": "charge.dispute.created",
  "data": {
    "object": {
      "id": "dp_1Q9455",
      "amount": 12900,
      "currency": "eur",
      "charge": "ch_3Q9455",
      "reason": "product_not_received",
      "status": "needs_response"
    }
  }
}
connector-payload.json
{
  "to": "finance@example.com",
  "subject": "Draft response for dispute dp_1Q9455",
  "body": "Order ord_8812 shipped Oct 2 and was signed for on Oct 4."
}

A cancelled subscription starts the agent, which reads the stated reason and drafts a win-back offer in your CRM.

Cancellation
Stripe inbound
winback-agent
Offer in your CRM
event.json
{
  "id": "evt_3Q9871",
  "object": "event",
  "type": "customer.subscription.deleted",
  "data": {
    "object": {
      "id": "sub_1Q4102",
      "customer": "cus_R48812",
      "status": "canceled",
      "cancellation_details": {
        "reason": "cancellation_requested",
        "feedback": "too_expensive"
      }
    }
  }
}
outbound-payload.json
{
  "run_id": "550e8400-e29b-41d4-a716-446655440000",
  "agent_name": "winback-agent",
  "status": "completed",
  "output": "Offer 20% off pro for three months. Reason given: price.",
  "error": null,
  "started_at": "2026-10-13T09:00:00Z",
  "ended_at": "2026-10-13T09:00:04Z",
  "token_usage": {
    "input_tokens": 905,
    "output_tokens": 41,
    "thinking_tokens": 0,
    "cached_input_tokens": 0,
    "total_tokens": 946
  }
}

Stripe FAQ

Add a Stripe connector, register its URL as a webhook endpoint in Stripe with payment_intent.payment_failed selected, and paste the endpoint's signing secret into the connector. Each failed payment then starts a run with the full event, including the error code and the customer ID.

Any event your Stripe endpoint subscribes to. The connector forwards everything the endpoint sends, so you change the selection in Stripe without touching your agent.

No. connic checks the Stripe-Signature header against your whsec_ secret with HMAC-SHA256 and rejects events signed more than five minutes ago. Until the secret is saved, the connector accepts no events.

connic answers Stripe with a 200 and starts no runs. Those events aren't stored, so they don't replay when you resume.