With the Manage My Subscription feature, you can embed a link within your app where your customers can manage their subscriptions (for example, increase license counts or change plans) and manage their payments.

1

Gather the customer's subscription ID.

This is referenced as subscription_id within the Webhooks and APIs.

This data can be captured through our Webhooks (for example, the order.complete webhook), or queried using our GraphQL API.

2

Build a link within your app where the customer can navigate to manage their subscription.

3

When the link is clicked, your system will need to make a call to Salesbricks' GraphQL API.

Insert the subscriptionId as the variable within the call below.

For more guidance with using the GraphQL API, refer to our API Reference.

https://api.salesbricks.com/api/v1/graphql

GraphQL
mutation($subscriptionId: String!){
  createSubscriptionToken(subscriptionId: $subscriptionId){
    token {
      id
      expiresAt
      buyer {
        id
      }
    }
  }
}

The response to this call includes a temporary access token:

JSON
{
  "data": {
    "createSubscriptionToken": {
      "token": {
        "id": "546c21827-8009-4f13-933d-22c8c8a9fb9a",
        "expiresAt": "2024-01-05T23:38:16.667405+00:00",
        "buyer": {
          "id": "997c5c51-17a5-4759-956e-bb87f7afd289"
        }
      }
    }
  }
}
4

Append the token ID from the response to the following base URL to create the customer-specific subscription link:

https://app.salesbricks.com/subscription-management/ + <TOKEN_ID>

Example: https://app.salesbricks.com/subscription-management/546c21827-8009-4f13-933d-22c8c8a9fb9a

5

Launch this URL in a separate tab for the best experience.