---
title: Build a subscription link extension
description: >-
  Learn how to build a subscription link extension that allows Partners to
  customize the View subscription link that displays in the Shopify admin.
source_url:
  html: >-
    https://shopify.dev/docs/apps/build/purchase-options/subscriptions/contracts/subscription-link-extensions/start-building
  md: >-
    https://shopify.dev/docs/apps/build/purchase-options/subscriptions/contracts/subscription-link-extensions/start-building.md
---

# Build a subscription link extension

**Note:**

Create and manage Subscription link extensions with [Shopify CLI](https://shopify.dev/docs/apps/build/cli-for-apps).

You can customize the **View subscription** link by managing the **Subscription link** app extension from your app through the Shopify CLI.

Merchants can see the **View subscription** link on the customer and order pages on Shopify admin. Please reference [this guide](https://shopify.dev/docs/apps/build/purchase-options/subscriptions/contracts/build-a-subscription-contract) for more information about how to create a subscription contract.

***

## What you'll learn

In this tutorial, you'll learn how to do the following tasks:

* Create a subscription link extension.
* Preview and deploy the extension.

***

## Requirements

* You have a Shopify app with the [latest version of Shopify CLI](https://shopify.dev/docs/api/shopify-cli#upgrade) installed.

***

## Step 1: Generate a new extension

1. Use Shopify CLI to generate a new extension:

   ## Terminal

   ```terminal
   shopify app generate extension --template subscription_link_extension --name subscription-link --flavor react
   ```

   You should now have a new extension directory at `extensions/subscription-link`.

2. Navigate to `extensions/subscription-link/shopify.extension.toml` and make sure the `pattern` matches your endpoint. This ensures that the **View subscription** link redirects to the correct endpoint:

   ## extensions/subscription-link/shopify.extension.toml

   ```toml
   [[extensions]]
   name = "subscription-link"
   type = "subscription_link_extension"
   uid = "6d03b9f2-a131-2fb2-477e-0f5c88a337b3256fe3e4"
   handle = "subscription-link"


   pattern = "/subscriptions{?customer_id,shop}&id={contract_id}"
   ```

   **Note:**

   The `pattern` must match the URL that you want to redirect to. It can be a relative path, or an absolute URL template.

The `[[extensions]]` array uses the following configuration properties:

* `name`: The merchant-facing name of the extension.

* `type`: The extension type. For a subscription link extension, use `subscription_link_extension`.

* `uid`:

  The extension user identifier. An app-scoped identifier that `shopify app deploy` uses to determine whether an extension is being created, updated, or deleted. `uid` is created and managed by Shopify: it's generated automatically when you scaffold the extension with Shopify CLI, so you don't need to set or edit it manually. It must be unique within the app.

* `handle`: The unique internal identifier for the extension. After you create a draft version of the extension, or deploy an extension, you can't change the `handle` value.

* `pattern`: The URL that the **View subscription** link redirects to. It can be a relative path, or an absolute URL template.

***

## Step 2: Preview the extension

To preview the extension, either start or restart your server with the following command:

## Terminal

```terminal
shopify app dev
```

***

## Step 3: Deploy the extension

Once you're ready to release your app, deploy the extension with the following command:

## Terminal

```terminal
shopify app deploy
```

***
