Stripe Subscription Lifecycle to CRM
On Stripe subscription events (created, upgraded, downgraded, canceled), the flow updates the customer's plan, MRR, and status in Dataverse/CRM, triggers onboarding or win-back plays, and notifies the account owner in Teams. Keeps the CRM's subscription picture accurate in real time.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
This flow keeps a CRM's subscription picture accurate from Stripe. On a 15-minute schedule it pulls recent subscription lifecycle events (created / updated / canceled) from Stripe, upserts the customer's plan, MRR, and status into a Dataverse CRM mirror table, and notifies the account owner in Microsoft Teams with the right play — onboarding for new subscriptions, win-back for cancellations, and a plan-change review for upgrades/downgrades.
Why it matters: Sales and finance need current plan and MRR data. Periodic sync from Stripe avoids stale pipelines and missed expansion/churn signals, and routes each lifecycle event to the correct revenue play.
Status: Built. Ships Off (demo). Flow Checker: 0 errors / 0 warnings.
Use Case
A SaaS business wants Stripe subscription changes reflected in the CRM with the right follow-up. New subscriptions kick off onboarding; cancellations launch win-back; upgrades/downgrades surface a plan-change review — each with plan, normalized MRR, and the account owner notified in Teams.
Flow Architecture
Recurrence Poll Stripe Events
Recurrence (15 min)Polls Stripe on a schedule for lifecycle events.
Initialize Correlation Id + config
Initialize VariableTrace id for the cycle plus Stripe base URL/key, Teams group/channel ids, and subscription table name.
Initialize Account Owner Email / Lookback
Initialize VariableConfigurable owner address and event lookback window (minutes).
Compose Lookback Unix
ComposeUnix-seconds lower bound for the created[gte] filter.
HTTP Get Subscription Events
HTTP — GET /v1/eventsStripe REST events (subscription created/updated/deleted), Bearer key.
Parse Subscription Events
Parse JSONMake the event list iterable.
For Each Subscription Event
Foreach (sequential)Process each lifecycle event.
Compose Subscription Object / Plan Item
ComposeExtract the Stripe subscription object and first line item (price + quantity).
Get Stripe Customer
Stripe — GetCustomerEnrich the customer email (connector-first).
Compose Monthly Revenue
ComposeNormalize price to MRR (cents to major units, yearly divided by 12).
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_StripeApiBaseUrl | String | https://api.stripe.com/v1 | Stripe REST base URL. |
| flowlibs_StripeApiKey | String | sk_live_REPLACE_ME | Stripe secret key used as the REST Bearer token. Replace before go-live. |
| flowlibs_TeamsGroupId | String | <your-team-id> | Teams team/group id for the account-owner notifications. |
| flowlibs_TeamsChannelId | String | <your-channel-id> | Teams channel id for notifications. |
| flowlibs_StripeSubscriptionTable | String | flowlibs_stripesubscriptions | Dataverse entity-set name of the CRM mirror table. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Stripe | shared_stripe | GetCustomer |
| HTTP | http | GET /v1/events |
| Microsoft Dataverse | shared_commondataserviceforapps | ListRecords CreateRecord UpdateRecord |
| Microsoft Teams | shared_teams | PostMessageToConversation |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Go live
- Authorize the Stripe, Dataverse, and Teams connections, set flowlibs_StripeApiKey, then turn the flow On.
- Account-owner routing
- Replace the static Initialize Account Owner Email with a lookup of the owner from the customer/account record.
- Cadence
- Tune the Recurrence interval and Initialize Lookback Minutes together (keep lookback >= interval, with margin).
- Expansion vs. churn
- Extend the Switch to compare old/new MRR and flag upgrades to a CSM.
- Real-time
- Swap the poll for a Stripe webhook into a built-in Request trigger if sub-minute latency is needed (requires registering the endpoint + signing secret in Stripe).
- Proration / partial periods
- Refine Compose Monthly Revenue for mid-cycle changes.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01Lookback window (Unix sec)
Lower bound for the created[gte] event filter.
EXPR.02MRR (cents to major units, yearly divided by 12)
Normalize monthly vs annual prices to a monthly recurring revenue.
EXPR.03Upsert filter
Find the existing CRM row by Stripe subscription id.
EXPR.04Update record id
Primary id used for the Dataverse UpdateRecord.
Customize & download
Generate a ready-to-import copy of this solution with your environment-variable values baked in — available on Base, Pro, or Team.
Upgrade to customize
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.