See llms.txt for all machine-readable content.

Back to Templates

Recover failed Stripe payments by decline reason with Gmail and CRM

Quick overview

This workflow listens for failed Stripe invoice payments, classifies the decline reason, and then either emails the customer via Gmail, alerts your billing team, and/or updates your CRM through an inbound webhook, including follow-up retries and status rechecks.

How it works

  1. Triggers when Stripe sends an invoice.payment_failed event and only continues on the first failure attempt to avoid duplicate outreach.
  2. Fetches the latest Stripe charge for the customer and classifies the decline into retryable, needs card update, needs manual review, or unknown based on the charge outcome/failure code.
  3. Sets a recovery schedule (max attempts and recheck delays) and routes the case based on the decline category.
  4. For retryable declines, emails the customer via Gmail that Stripe will retry and then waits and rechecks the Stripe invoice status on day 1, 3, and 7.
  5. If the invoice becomes paid, posts a “recovered” status to your CRM webhook; otherwise, after the final attempt it alerts your team via Gmail and posts an “at risk” status to the CRM.
  6. For needs-update declines, emails the customer a hosted Stripe invoice link to pay with a new card and posts a “needs payment update” status to your CRM webhook.
  7. For risky or unclassified declines, emails your team for manual follow-up and posts a “needs manual review” or “unclassified” status to your CRM webhook.

Setup

  1. Add Stripe API credentials for the Stripe trigger and the Stripe API requests that fetch the latest charge and recheck the invoice.
  2. Add a Gmail credential for the customer and team notification emails.
  3. Update the Config values (team email, company name, CRM inbound webhook URL, and maximum payment attempts).
  4. Ensure your CRM can receive the posted JSON payload via an inbound webhook endpoint and map fields like customer, invoice, failure code, and status to your records.

Requirements

  • • Stripe account (test mode works for setup)
  • • Gmail account for customer and team emails
  • • Optional: any CRM with an inbound webhook, such as GoHighLevel or HubSpot

Customization

  • • Move decline codes between the soft, hard and risky lists in Classify Decline Reason
  • • Change the recheck days (1, 3 and 7 by default) in Set Recovery Schedule
  • • Swap Gmail for Slack, Outlook or SMS for team alerts

Additional info

Full write-up with the decline code table: https://heaqdigital.com/failed-payment-recovery-automation