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.

Architecture comparison
Native HubSpot Appn8n RecommendedCustom FastAPI
Setup time30 min2–3 hours4–6 hours
CostIncludedFree (self-hosted)Free
Custom logicLimitedFullFull
Multi-location
Visual builderN/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_idText (indexed)Join key
stripe_subscription_statusDropdownactive | past_due | canceled | trialing
stripe_mrrNumber (currency)Monthly recurring revenue
stripe_billing_healthDropdownhealthy | at_risk | delinquent
stripe_last_payment_dateDateLast successful payment
stripe_location_countNumberMulti-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

HubSpot ping

Validates the HubSpot token by fetching one Company.

GET /crm/v3/objects/companies?limit=1
stripe

Stripe ping

Validates the Stripe key and surfaces test vs live mode.

GET /v1/balance
stripe

Active subscriptions

Rollup source for stripe_mrr and stripe_subscription_status.

GET /v1/subscriptions?status=active&limit=5
stripe

Churn summary

Source for retention dashboards and freemium re-engagement.

GET /v1/subscriptions?status=canceled&limit=5

Freemium-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]