NODEPACT · N8N WORKFLOW GUIDE

Automate Stripe Failed-Payment Recovery with n8n and Slack

Catch a failed invoice payment, give your operations team the context to act, and keep recovery aligned with the retry policy already configured in Stripe.

7 minute readFor SMB operations, growth, RevOps, and automation teams
WORKFLOWStripe TriggerEdit FieldsIf: invoice link exists?Slack: Send message
On this page

START HERE

Before you build

  • An n8n workspace

    Use an n8n instance that can receive Stripe webhooks. A production webhook needs a publicly reachable HTTPS URL.Stripe: Receive and test webhook events

  • Stripe test-mode access

    Create an n8n Stripe credential with a test-mode key first. You will need permission to configure or inspect a webhook endpoint in Stripe Workbench.n8n: Stripe TriggerStripe: Receive and test webhook events

  • A Slack test destination

    Connect the n8n Slack credential and choose a channel your billing operators can access. Example channel name: #billing-triage-test; replace it with a channel in your workspace.n8n: Slack node

01 / NODEPACT TUTORIAL

What this workflow does

Stripe emits invoice.payment_failed when an invoice payment attempt fails. The workflow below turns that event into a concise Slack alert with an invoice reference and, when available, a customer-facing invoice link. Your team can then follow the recovery policy configured in Stripe.Stripe: Webhooks with subscriptionsStripe API: Invoice object

Stripe Trigger (invoice.payment_failed)
  → Edit Fields (keep the useful invoice details)
  → If (hosted invoice URL is present?)
  → Slack: Send message
The If node keeps missing or not-yet-finalized invoice links out of Slack messages.n8n: Stripe Triggern8n: Slack nodeStripe API: Invoice object

02 / NODEPACT TUTORIAL

Before you build

  • An n8n workspace with a webhook URL that Stripe can reach.
  • A Stripe test-mode credential and access to the test webhook settings.
  • A Slack credential and a test channel for billing alerts.
  • A written owner for billing follow-up and a decision about which invoice details belong in Slack.
Stripe: Receive and test webhook eventsn8n: Slack node

Use only the fields your team needs. Avoid sending card details, secrets, or unnecessary customer data to a shared channel. Keep separate Stripe test and live credentials, and do not paste credential values into node expressions or Slack text.

03 / NODEPACT TUTORIAL

Build the workflow

  1. 01

    Add the Stripe Trigger

    Create a workflow and add n8n’s Stripe Trigger. Connect your Stripe test credential and select invoice.payment_failed. Use the test webhook URL while developing, then the production URL when you activate the workflow. If your setup asks you to register the endpoint in Stripe Workbench, subscribe it only to the event this workflow needs.n8n: Stripe TriggerStripe: Webhooks with subscriptionsStripe: Receive and test webhook events

  2. 02

    Verify the incoming webhook

    In n8n versions that expose Stripe Trigger webhook authentication, set the Stripe Signature Secret on the Stripe credential. n8n documents signature validation in supported releases; without a signature secret, a person who knows the webhook URL could send a forged event. Use the endpoint’s actual signing secret, never an example value.n8n: Stripe TriggerStripe: Receive and test webhook events

  3. 03

    Inspect one event and keep the useful fields

    Run a test event and inspect the Stripe Trigger output before writing expressions. Add an Edit Fields node and map the event ID, invoice ID, customer reference if present, amount_due with currency, and hosted_invoice_url. Stripe’s Invoice object marks hosted_invoice_url as nullable; it is null before an invoice is finalized. Keep the event ID in the alert so operators can distinguish repeat deliveries.Stripe API: Invoice objectStripe: Receive and test webhook events

  4. 04

    Branch when the invoice link is missing

    Add an If node that checks whether hosted_invoice_url is present. On the true output, prepare an alert with that link. On the false output, send the invoice ID and ask the operator to open it in Stripe. Do not render an empty URL as a customer action.Stripe API: Invoice object

  5. 05

    Send a readable Slack triage message

    Add the Slack node and choose Message → Send. Select the billing channel and map the tested fields into a compact message: “Stripe invoice payment failed · invoice [invoice ID] · [amount] [currency] · customer [reference]”. Include the hosted invoice link only on the branch where it exists. Tell the operator to check the invoice in Stripe before contacting the customer.n8n: Slack nodeStripe API: Invoice object

  6. 06

    Set the recovery policy in Stripe

    Decide retries and customer notices in Stripe Billing, not by repeatedly issuing payment attempts from n8n. Stripe documents Smart Retries and customer notification as possible responses to invoice.payment_failed. When an invoice requires customer authentication, also listen for invoice.payment_action_required and route it as a distinct “customer action needed” case.Stripe: Webhooks with subscriptions

  7. 07

    Add a failure path for the automation itself

    For a workflow that needs operational monitoring, create a second workflow whose first node is Error Trigger, then attach it as the main workflow’s error workflow in Settings. Send a separate alert with the failed workflow name and execution link. n8n notes that an error workflow does not run when the main workflow is tested manually, so verify it with an automatic test execution.n8n: Error Trigger node

04 / NODEPACT TUTORIAL

Test it before using live payments

  1. 01

    Listen on the test webhook

    In the n8n editor, put the Stripe Trigger into test/listen mode and use its test URL. For a local test, Stripe CLI can forward events to that URL; copy the webhook signing secret printed by the CLI into the n8n Stripe credential used for this test.Stripe: Receive and test webhook eventsn8n: Stripe Trigger

  2. 02

    Send a failed-invoice test event

    With the Stripe CLI authenticated to a test account and forwarding to the n8n test URL, trigger invoice.payment_failed. Stripe lists this event as supported by the CLI. The CLI creates test API objects as part of a trigger, so keep it pointed at test mode.Stripe CLI: Trigger test webhook eventsStripe: Webhooks with subscriptions

  3. 03

    Check both sides of the workflow

    Confirm the event appears in n8n, the field mappings match the received invoice, the correct If branch runs, and exactly the intended Slack channel receives a message. Verify that a missing hosted invoice URL creates a useful invoice-ID alert instead of a broken link. No production payment or delivery result is implied by this test.

  4. 04

    Activate only after review

    After checking the event, message, channel access, signature verification, and Stripe retry policy, switch to the production webhook and credentials. Confirm that the production endpoint is publicly reachable over HTTPS before relying on it.Stripe: Receive and test webhook eventsn8n: Stripe Trigger

stripe listen --forward-to <n8n-test-webhook-url>
stripe trigger invoice.payment_failed
Replace <n8n-test-webhook-url> with the test URL shown in your n8n Stripe Trigger. Stripe CLI prints the signing secret for the forwarded events.Stripe: Receive and test webhook eventsStripe CLI: Trigger test webhook events

05 / NODEPACT TUTORIAL

Edge cases to plan for

  • Duplicate deliveries: Stripe can retry webhook deliveries, and distinct events can describe related changes. Keep event IDs in alerts; if duplicate Slack alerts would create work, add durable de-duplication keyed by event ID before the send step.
  • Event order: Stripe does not guarantee event delivery order. Do not close a case or declare a payment still unpaid from event arrival order alone; check the current invoice in Stripe. An invoice.paid event is separate from invoice.payment_failed.
  • Customer authentication: invoice.payment_action_required is a separate event. Route it to an operator who can direct the customer through your existing authentication flow.
  • Missing hosted invoice link: hosted_invoice_url can be null before finalization. Send the invoice ID and use Stripe’s Dashboard instead of exposing a blank or guessed URL.
  • Slack send failures: check the Slack node execution for credential, channel-access, or message errors. If you choose a direct Incoming Webhook instead of the Slack node, treat its URL as a secret and rotate it if exposed.
  • Sensitive data: limit the channel audience and include only the fields needed for triage. Do not include card numbers, verification codes, Stripe secret keys, or signing secrets.
Stripe: Receive and test webhook eventsStripe: Webhooks with subscriptionsStripe API: Invoice objectSlack: Sending messages using incoming webhooks

06 / NODEPACT TUTORIAL

Where this workflow runs

Buyers import and run the workflow in their own n8n account, using their own Stripe and Slack credentials. NodePact sells the blueprint; it does not execute or host third-party automations.

SOURCE NOTES

References

  1. n8n: Stripe Trigger

    Stripe Trigger credentials and incoming webhook signature verification.

  2. n8n: Slack node

    Slack credentials and the Message → Send operation.

  3. Stripe: Webhooks with subscriptions

    invoice.payment_failed, invoice.payment_action_required, Smart Retries, and recovery actions.

  4. Stripe API: Invoice object

    Invoice identifiers, amounts, currency, nullable hosted_invoice_url, and retry fields.

  5. Stripe: Receive and test webhook events

    HTTPS endpoints, signing secrets, test forwarding, duplicate deliveries, and event ordering.

  6. Stripe CLI: Trigger test webhook events

    Supported test event names and the effects of triggering test fixtures.

  7. n8n: Error Trigger node

    Creating and attaching an error workflow, including its manual-test limitation.

  8. Slack: Sending messages using incoming webhooks

    Incoming Webhook URL secrecy and common send errors if using that alternative.