The moment it happens
Log failed Stripe payments to Google Sheets
Every failed Stripe payment is added to a Failed payments tab with the customer's email, amount, decline reason and a link to the payment.
- Runs
- The moment it happens
- Apps
- Google Sheets, Stripe
- AI
- Not needed
- Access
- Stripe webhook signing secret; Google Sheets read+write
Send this to your assistant
Create a ClickRuntime automation: when a Stripe payment fails, add a row to the Failed payments tab of my sheet with the date, customer email, amount, decline reason and a link to the payment in Stripe.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
Failed payments are easy to miss. Stripe retries subscriptions on its own schedule and sends its own emails, but nobody on the team sees a list of who failed and why until revenue at the end of the month is lower than expected.
With this automation, every failed payment becomes a row in a sheet the moment it happens, with Stripe's decline reason in plain words and a link to open the payment in Stripe.
SaaS founders, membership sites and support teams use the sheet as a follow-up list: contact the customer, note the outcome in the next column, and see recovery rates over time.
What you get out of it
A follow-up list that builds itself
Every failure is recorded with the customer's email, so someone can reach out the same day rather than at month end.
Decline reasons in plain words
Codes such as insufficient_funds or expired_card tell you whether to send a card update link or wait for a retry.
One click to the payment
The Stripe link on each row opens the exact payment for refunds, retries or notes.
Signature checked
Only events signed by your Stripe account are accepted, so the sheet cannot be filled with fake rows.
Trends you can chart
With months of failures in one tab, it is easy to see whether a card network or region causes more problems.
How it works
What happens, step by step
You add a ClickRuntime trigger link as a webhook in Stripe for failed payments.
When a payment fails, Stripe sends the event and ClickRuntime checks its signature.
The customer's email, the amount, Stripe's decline code and message are read from the event.
A row with a direct link to the payment is added to your Failed payments tab.
Before it runs live
- Connect your Google Sheets account and pick the spreadsheets it may use
- Connect Stripe
- Paste your automation's link into the other app's webhook settings
What you get
Build your own
Need it to work differently?
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 Google Sheets and Stripe steps into one automation
Under the hood
The code that runs this automation
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from datetime import datetime, timezone
from clickruntime import on_event, credentials, verify, state
SHEET_ID = "your-spreadsheet-id"
@on_event
def handle(event):
if not verify.stripe(event.body, event.header("Stripe-Signature"), credentials.secret("STRIPE_WEBHOOK_SECRET")):
return {"ignored": "bad signature"}
if state.get(f"seen:{event.json['id']}"):
return {"duplicate": True}
pi = event.json["data"]["object"]
err = pi.get("last_payment_error") or {}
email = pi.get("receipt_email") or (err.get("payment_method") or {}).get("billing_details", {}).get("email") or ""
row = [datetime.fromtimestamp(pi["created"], timezone.utc).date().isoformat(), email,
pi["amount"] / 100, pi["currency"].upper(), err.get("decline_code") or err.get("code") or "",
err.get("message") or "", pi.get("customer") or "", f"https://dashboard.stripe.com/payments/{pi['id']}"]
build("sheets", "v4", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False) \
.spreadsheets().values().append(spreadsheetId=SHEET_ID, range="Failed payments!A:H",
valueInputOption="USER_ENTERED", body={"values": [row]}).execute()
state.set(f"seen:{event.json['id']}", True)
return {"logged": pi["id"]}FAQ
Common questions
Which Stripe event should I select?
Will a retried payment show up twice?
Can it email the customer too?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Log Stripe sales in a sheet and send buyers their product
Every payment becomes a row in your sales sheet, and the buyer gets the download link you keep in that sheet.
See how it worksLog every Stripe cancellation and its reason in a sheet
Each cancelled subscription is added to your churn sheet with the customer, plan, revenue lost and the reason they gave.
See how it worksLog Stripe payments to Google Sheets
Every successful Stripe payment is added as a new row in a Google Sheet within seconds.
See how it worksKeep exploring
Set up “Log failed Stripe payments to Google Sheets” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.