Skip to Content
Getting startedStripe to HubSpot

Stripe to HubSpot

This guide connects a Stripe account to HubSpot with the Stripe Customers & Subscriptions → HubSpot template. Stripe sends its events straight to the connector; plugsync writes your customers to HubSpot as contacts, with their subscription status, plan, renewal date and last payment on the record. Budget about 10 minutes.

You need a plugsync organization with a HubSpot portal connected (the dashboard tutorial covers both) and access to the Stripe Dashboard of the account whose events you want to send. Nothing is written to Stripe and nothing is read from its API: the connector only receives the events Stripe pushes, from the moment the endpoint is enabled. Customers that existed before that show up in HubSpot the next time Stripe sends an event about them.

What lands in HubSpot

Every Stripe customer becomes one contact, identified by its Stripe customer id (cus_...) in the stripe_customer_id property. Each event updates that same contact, so a customer that changes plan, renews or pays an invoice never produces a duplicate. When HubSpot already has a contact with the customer’s email and no Stripe id yet, that contact is adopted instead of creating a second one.

Stripe eventHubSpot contact properties
customer.created, customer.updatedstripe_customer_id, email, firstname, lastname, phone
customer.subscription.*stripe_subscription_id, stripe_subscription_status (active, trialing, past_due, canceled, …), stripe_plan, stripe_current_period_end (the renewal date)
invoice.paid, invoice.payment_failedstripe_last_payment_status (paid or failed), stripe_last_invoice_amount, stripe_last_invoice_currency, stripe_last_invoice_date, stripe_last_invoice_url

stripe_plan is the price’s nickname when it has one, its id (price_...) otherwise. The stripe_* properties are created on your portal by the first publish if they do not exist yet; see Schema provisioning.

Stripe sends amounts in the currency’s smallest unit, and the template divides them by 100, which is right for currencies with two decimals: an invoice of 4900 in EUR is written as 49. It is not right for the currencies Stripe treats as zero-decimal (JPY, KRW, VND and the others in Stripe’s list): an invoice of 4900 JPY would be written as 49 instead of 4900. If you bill in one of those, remove the cents_to_dollars transform from the stripe_last_invoice_amount mapping of the contact entity before publishing, so the amount is written as Stripe sends it. The same mapping cannot be right for both kinds of currency at once, so an account that bills in both gets one of them wrong.

A customer with a business name in Stripe also becomes a HubSpot company (name, phone and address), identified by the same customer id and associated to the contact. A customer without one stays a contact only. Unlike contacts, an existing HubSpot company is never adopted: Stripe has no field that identifies a company reliably (a business name is not unique, and a customer carries no domain), so a company that is already in HubSpot gets a second record the first time its Stripe customer arrives, to be merged in HubSpot.

Stripe does not guarantee the order in which it delivers events. Every event is written as an update-or-create, so a subscription that arrives before its customer.created still lands on the right contact, and the customer event completes it when it arrives. A contact created that way has no email until then.

That early contact cannot adopt an existing HubSpot contact, because a subscription event carries no email to look it up by. So when HubSpot already has a contact with the customer’s email and the subscription arrives first, there are briefly two contacts: the existing one, and the new one keyed by the Stripe customer id. The customer.created that follows then tries to write the email on the new contact, HubSpot refuses because that email already belongs to the other one, and the event is failed with an error saying so. To fix it, merge the two contacts in HubSpot: the merged contact keeps the Stripe customer id, so the next event for that customer (or a replay of the failed one) lands on it. An invoice event carries the customer’s email, so an invoice that arrives first does adopt the existing contact.

Stripe also retries a delivery that did not get a 2xx, for up to three days in live mode. A retry that arrives late can rewrite an older state over a newer one, for example an active status after the subscription was canceled, and it stays that way until Stripe sends the next event about that subscription or customer.

1. Create the connector from the template

In the dashboard open Connectors, choose New connector, and under Start from a template pick Stripe Customers & Subscriptions → HubSpot. From the API:

curl -s -X POST https://app.plugsync.com/api/v1/connectors/from-template/stripe_billing \ -H "Authorization: Bearer $TOKEN" -H 'content-type: application/json' \ -d '{"name": "Stripe billing"}' # -> 201 {"id": "<connector_id>", "sample_scenario": "stripe_billing_flow", ...}

The connector comes with one webhook source, stripe_webhook, which verifies Stripe’s signature, plus the entities and flows above. It publishes as-is: open Review changes and Publish v1, or call POST /api/connectors/{connector_id}/publish. The publish creates the source and returns a generated secret in created_sources: you replace it with Stripe’s in step 3, so you do not need to keep it.

2. Add the endpoint in Stripe

In the Stripe Dashboard open Developers → Webhooks (Workbench → Webhooks on newer accounts) and add an endpoint (Stripe may call it a destination) with:

  • Endpoint URL: https://app.plugsync.com/api/webhooks/{connector_id}/stripe_webhook
  • Events to send:
    • customer.created
    • customer.updated
    • customer.subscription.created
    • customer.subscription.updated
    • customer.subscription.deleted
    • invoice.paid
    • invoice.payment_failed

Other customer.subscription.* events (trial_will_end, paused, resumed) are accepted too and update the same subscription properties; add them if you want them. Any other event Stripe sends is received and matches no flow, so nothing is written to HubSpot for it.

Use a test-mode endpoint first if you want to try the setup without real customers: test mode and live mode each have their own endpoints and their own signing secrets.

3. Copy the signing secret into the connector

Every Stripe endpoint has its own signing secret, which starts with whsec_. Open the endpoint you just created in the Stripe Dashboard and, under Signing secret, choose Reveal and copy it.

Set it on the connector’s stripe_webhook source. In the dashboard open the connector, go to Sources, edit stripe_webhook, paste the value into Secret and save. From the API:

curl -s -X PATCH https://app.plugsync.com/api/connectors/$CONNECTOR_ID/sources/stripe_webhook \ -H "Authorization: Bearer $TOKEN" -H 'content-type: application/json' \ -d '{"secret": "whsec_..."}' # -> 200

The secret applies immediately, with no publish, and is never shown again. Paste the whole value, whsec_ included.

From then on every delivery is checked against it before anything else happens: a request with a missing or wrong Stripe-Signature answers 401, and so does one whose timestamp is more than 5 minutes old, which stops a captured request from being replayed. When you roll the secret in Stripe, Stripe signs with both the old and the new secret for the overlap you choose, and a delivery is accepted as long as one of the two signatures matches the secret stored on the source. Set the new secret on the source before the old one expires.

4. Check that events arrive

Send a test event from the endpoint page in Stripe, or create a customer in test mode. Each delivery appears in the connector’s Activity tab and in GET /api/connectors/{connector_id}/sync-events, with the HubSpot contact it created or updated. Stripe shows the response of each attempt on the endpoint page: 202 means accepted, 401 means the signing secret on the source does not match the endpoint’s.

To see the result before connecting a real account, send the template’s sample scenario to the published connector. It plays a customer, a subscription, a paid invoice and a plan change for one sample customer, and leaves one contact and one company in HubSpot:

curl -s -X POST https://app.plugsync.com/api/v1/onboarding/sample-data \ -H "Authorization: Bearer $TOKEN" -H 'content-type: application/json' \ -d '{"connector_id": "'$CONNECTOR_ID'", "scenario": "stripe_billing_flow"}' # -> {"accepted": 4, "scenario": "stripe_billing_flow"}

Sample events do not count toward your plan’s event quota.

Changing what is written

The template is an ordinary connector config: entities, flows and mappings can be edited and republished like any other. The webhook source and its signature check are described in the webhook reference; mappings and flows in Config V3.

Last updated on