Assignment 2
Stripe ↔ HubSpot Integration
Three viable architectures. n8n is the recommended choice: full custom logic, visual builder, multi-location support, near-zero cost. Live API demos below — add keys in Settings.
| Native HubSpot App | n8n Recommended | Custom FastAPI | |
|---|---|---|---|
| Setup time | 30 min | 2–3 hours | 4–6 hours |
| Cost | Included | Free (self-hosted) | Free |
| Custom logic | Limited | Full | Full |
| Multi-location | |||
| Visual builder | N/A |
n8n workflow
[Stripe Webhook Trigger]
↓
[Parse Event Type]
↓ ↓ ↓
[payment_ [subscription [subscription
failed] .updated] .deleted]
↓ ↓ ↓
[Set billing [Update MRR [Mark
= at_risk] + status] canceled]
↓
[HubSpot: Find Company by stripe_customer_id]
↓
[HubSpot: Update Company Properties]
↓
[Log result / notify on error]HubSpot property schema
| stripe_customer_id | Text (indexed) | Join key |
| stripe_subscription_status | Dropdown | active | past_due | canceled | trialing |
| stripe_mrr | Number (currency) | Monthly recurring revenue |
| stripe_billing_health | Dropdown | healthy | at_risk | delinquent |
| stripe_last_payment_date | Date | Last successful payment |
| stripe_location_count | Number | Multi-location rollup |
Multi-location data model
HubSpot Company: "Smith Dental Group" ├── stripe_mrr = $895 (sum of all locations) ├── stripe_billing_health = at_risk (worst across locations) ├── Deal: "Location 1 – Downtown" → sub_xxx └── Deal: "Location 2 – Suburbs" → sub_yyy
Live API demo
Click Run to validate connectivity. Calls execute from your browser using session-only keys. If your browser blocks the call with CORS, the same request runs cleanly server-side via n8n — the wiring is identical.
HubSpot ping
Validates the HubSpot token by fetching one Company.
GET /crm/v3/objects/companies?limit=1Stripe ping
Validates the Stripe key and surfaces test vs live mode.
GET /v1/balanceActive subscriptions
Rollup source for stripe_mrr and stripe_subscription_status.
GET /v1/subscriptions?status=active&limit=5Churn summary
Source for retention dashboards and freemium re-engagement.
GET /v1/subscriptions?status=canceled&limit=5Freemium-tier architecture (forward-looking)
When subscription.deleted fires, instead of purely marking the deal lost, branch into a freemium workflow: deliver ad-supported savings analyses, track re-engagement signals in HubSpot, trigger re-conversion at milestones.
[subscription.deleted]
↓
[HubSpot: Set lifecycle_stage = freemium]
↓
┌────┴────────────────────────────┐
↓ ↓
[Enable ad-supported analyses] [Start re-engagement sequence]
↓ ↓
[Track usage in HubSpot] [Email cadence: t+7, t+30, t+90]
↓ ↓
[After 3 analyses → milestone] [Score re-engagement signals]
↓ ↓
└──────┬─────────────┘
↓
[Trigger re-conversion offer]
↓
[HubSpot Deal: reactivation]