Quick overview
This workflow receives Stripe billing webhooks, verifies the Stripe signature, and then either revokes access for refunds/disputes or runs a multi-step dunning sequence for failed invoice payments, sending Gmail emails, alerting via Telegram, and logging the event to Google Sheets.
How it works
- Receives a POST webhook from Stripe and reconstructs the signed payload to validate the Stripe webhook signature with an HMAC check.
- Rejects requests with an invalid signature by returning a 401 response.
- Parses the Stripe event into a simplified billing record and routes execution based on the event type (charge.refunded, charge.dispute.created, or invoice.payment_failed).
- For refunds and disputes, calls your app API to look up the customer and revoke access, then cancels the related Stripe subscription.
- Emails the customer via Gmail about the closure and sends a Telegram alert to finance, then appends the event details to a Google Sheets “Billing Events” tab.
- For failed payments, sends an initial dunning email via Gmail, waits two days, checks Stripe for an open invoice, and sends a second notice if still unpaid.
- Waits four more days, sends a final notice, pauses the Stripe subscription, and sends a Telegram notification that dunning has finished.
Setup
- Create a Stripe webhook endpoint subscribed to charge.refunded, charge.dispute.created, and invoice.payment_failed, then set the webhook URL to this workflow and paste the signing secret into the HMAC secret field.
- Configure an HTTP Header Auth credential for Stripe API requests (Bearer secret key) and replace YOUR_APP_DOMAIN plus the /api/customers/{id} and /api/customers/{id}/revoke endpoints to match your application.
- Add a Gmail credential for sending customer emails and replace YOUR_BILLING_PORTAL_URL in all dunning email bodies.
- Add a Telegram credential, set YOUR_TELEGRAM_CHAT_ID for finance/owner notifications, and ensure your Google Sheets credential and spreadsheet ID contain a “Billing Events” sheet tab.