Log Stripe subscription cancellations to Amplitude and a churn sheet

The moment a Stripe subscription cancels, record a churn event in Amplitude and add a row to your finance and CS churn tracker sheet.

Deterministic Code
StripeAmplitudeGoogle SheetsProductFinanceData SyncNotifications & Alerts
PromptCreate

Whenever a Stripe subscription is canceled, I want to ingest a matching churn event into Amplitude and log the cancel to a churn tracker Google Sheet. Every step is deterministic and no LLM reasoning is needed.

Trigger: a Stripe webhook on the customer.subscription.deleted event. When Stripe fires the webhook, read the payload and pull the subscription's customer email, plan name (or price nickname), MRR (in the smallest currency unit converted to a number), the subscription start date, and the cancellation reason from cancellation_details.reason (falling back to canceled_at or an empty string when it is missing). Also capture the Stripe event id and the canceled_at timestamp.

Step 1: call Amplitude's Send Events (HTTP V2) operation to record a single event. Use the customer email as user_id, event_type set to a configurable event name that defaults to "Subscription Canceled", the canceled_at time as the event time, and event_properties containing plan, mrr, start_date, cancellation_reason, and stripe_subscription_id. Use the Stripe event id as insert_id so retries dedupe safely on Amplitude's (device_id, event_type, time, insert_id) key.

Step 2: call Amplitude's Identify (Update User Properties) operation for the same user_id, setting is_churned=true, churned_at=canceled_at (ISO 8601), churn_mrr=MRR, and last_plan=plan. This is a user-property update only, not a second event.

Step 3: call Google Sheets Append Values on a configurable Sheet ID and tab (default "Churn Log"), appending one row in this column order: customer email, plan, MRR, tenure in days (canceled_at minus start_date, rounded down), cancellation reason, and ISO 8601 timestamp. Use valueInputOption USER_ENTERED so the timestamp and numbers are parsed correctly.

Expose two knobs on the prompt page: the Amplitude event name (default "Subscription Canceled") and the Google Sheet spreadsheet ID plus tab name. Respect Amplitude data residency when configured. If the webhook payload lacks an email, skip the row and the event rather than sending a blank user_id.

Additional information

What does this prompt do?
  • Listens for subscription cancellations in Stripe and captures each one the moment it happens.
  • Records a Subscription Canceled event in Amplitude so churn shows up on your funnels and retention charts alongside product usage.
  • Marks the customer's Amplitude profile as churned with the timestamp, lost MRR, and last plan so cohorts pick them up automatically.
  • Appends a row to your Churn Log Google Sheet with the customer, plan, MRR, tenure in days, cancellation reason, and timestamp for finance and CS.
What do I need to use this?
  • A Stripe account with permission to configure webhooks
  • An Amplitude project on the US or EU data center
  • A Google account with edit access to the Churn Log spreadsheet
How can I customize it?
  • Choose the Google Sheet and tab where cancellations get logged
  • Rename the Amplitude event and user property names to match your team's taxonomy
  • Filter to specific plans or price IDs if you only want to log certain subscription tiers

Frequently asked questions

Why bother sending Stripe cancellations into Amplitude when Amplitude already tracks usage?
Most Amplitude setups only see events fired from the product itself. Subscription cancellations happen on Stripe's side, often through billing pages or dunning retries, so they never make it into Amplitude on their own. Bridging them in means your retention and churn charts finally match the money.
What happens if Stripe retries the webhook or fires it twice?
The workflow uses the Stripe event id as the deduplication key when sending to Amplitude, so retries do not create duplicate churn events. The Google Sheet row is written once per cancellation on the first successful delivery.
Does this capture cancellations from Stripe's dunning flow too?
Yes. Stripe emits a subscription cancellation event whether the customer clicks Cancel, an admin cancels on their behalf, or the subscription is closed after failed payment retries. All three land in the same tracker.
Will this work if my Amplitude project is on the EU data center?
Yes. When you connect Amplitude, set the data residency to EU and the workflow will send events and profile updates to the EU endpoints instead of the US ones.
Can I change what columns get written to the churn sheet?
Yes. The default row includes customer email, plan, MRR, tenure in days, cancellation reason, and timestamp, but you can add or reorder columns after the workflow is set up.

Stop guessing why your Amplitude churn charts look wrong.

Bridge Stripe's server-side cancellations into your product analytics and finance log so every team sees the same story.