> For the complete documentation index, see [llms.txt](https://docs.chord.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chord.co/collect-data/shopify/server-events/subscription-events.md).

# Subscription events

If your store sells subscriptions, Chord can track each subscription's lifecycle: created, cancelled, paused, expired and failed payments.

Shopify only sends subscription webhooks to the app that created the subscription, such as Shopify Subscriptions or Recharge. The Chord Webhook Events app can't receive them. Instead, you import three workflows into [Shopify Flow](https://apps.shopify.com/flow), Shopify's free automation app, and they send these events to Chord.

## Events

* [Subscription Created](/collect-data/tracking-plan/subscription-created.md), when a subscription contract is created
* [Subscription Cancelled](/collect-data/tracking-plan/subscription-cancelled.md), when a contract is cancelled
* [Subscription Paused](/collect-data/tracking-plan/subscription-paused.md), when a contract is paused
* [Subscription Expired](/collect-data/tracking-plan/subscription-expired.md), when a contract expires
* [Subscription Payment Failed](/collect-data/tracking-plan/subscription-payment-failed.md), when a billing attempt fails

## Before you start

* Set up [server events](/collect-data/shopify/server-events.md).
* Ask Chord for the three Flow files and your back-end write key. Each file sets up one workflow:
  * **Subscription Contract Created** sends Subscription Created.
  * **Subscription Updated** sends Subscription Cancelled, Paused or Expired, depending on the contract's new status.
  * **Subscription Payment Failed** sends Subscription Payment Failed.

## Step 1: Install Shopify Flow

Install [Shopify Flow](https://apps.shopify.com/flow) from the Shopify App Store, if your store doesn't have it already.

## Step 2: Add your write key as a secret

The workflows read your write key from a Shopify Flow secret, so the key never appears in the workflow itself.

In Shopify Flow's settings, add a secret named `chord_cdp_secret`, and paste your back-end write key as its value. The name must match exactly.

## Step 3: Import the workflows

1. In Shopify admin, go to **Apps > Shopify Flow**.
2. Click **Import**.

   ![Importing a workflow into Shopify Flow](https://2938842758-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5Oy2IAsu7IvAGAlWgC36%2Fuploads%2Fgit-blob-e3bbe12047f333d13cf66f77fdc10ce580f0ac3c%2Fshopify-flow-import.png?alt=media)
3. Upload one of the `.flow` files and confirm the import.
4. Turn on the workflow.
5. Repeat for the other two files.

Each workflow sends its event to `https://production.cdp.ingest.chord.co/api/track`. If Chord gave you a different CDP domain, change the URL in every **Send HTTP request** step.

## Step 4: Verify

1. In Shopify Flow, check that all three workflows show as **Active**. Each one starts from a subscription trigger, runs some code, and sends an HTTP request to Chord.

   ![An active Chord subscription workflow](https://2938842758-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5Oy2IAsu7IvAGAlWgC36%2Fuploads%2Fgit-blob-a5909a1f8c365045d19c310d50297a89e84c52dd%2Fshopify-flow-subscription-workflows.png?alt=media)
2. Create a test subscription in your store.
3. In Chord, open **Live Events** for your back-end source and check that Subscription Created appears.

If a workflow runs but no event appears, open the run in Shopify Flow's **Recent runs** list to see the error. A 401 error means the `chord_cdp_secret` secret is missing or holds the wrong key.

## What each event contains

Every event carries the Shopify customer ID as `userId`, and these properties:

* `id`: the subscription contract ID
* `customer_id`: the Shopify customer ID
* `order_id`: the order that started the subscription
* `status`: the contract's status, such as `ACTIVE` or `PAUSED`
* `currency`
* `delivery_policy`: how often the subscription ships, as `interval` and `interval_count`

Subscription events don't carry an anonymous ID, so Chord links them to the customer by their Shopify customer ID.

You can change what a workflow sends by editing the body of its **Send HTTP request** step.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.chord.co/collect-data/shopify/server-events/subscription-events.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
