
The advantage of creating a subscription model in your mobile commerce is that users can enjoy discounted rates on their desired products, which they buy regularly. This option is also beneficial for offline store owners, as it increases customer loyalty and encourages customers to visit more frequently and make more purchases.  
 

In this use case we will create a subscription service mechanism based on Synerise's promotions and analytics. The subscription allows to collect one coffee a day for the next 30 days, 30 coffees in total. Customer pays upfront and the price per item is lower than if bought separately.  
 

## Prerequisites  

--- 

- Integrate Synerise [promotions](/docs/ai-hub/promotions) 

- Implement subscription status management using your billing system or payment gateway:  

- When the subscription is enabled (customer paid for a monthly subscription):  

1. Send a `subscription.status` event with the `segment_enabled` parameter set to `1` 

This parameter is used to track if a customer is eligible for a coffee on each day. It is changed with a workflow after the client buys coffee and resets at midnight. 

2. Update the customer's profile with the `subscription.active` attribute set to `1`  

This attribute is used to track if the monthly subscription is paid and active. 

- When the subscription ends or is disabled, update the customer's profile with the `subscription.active` attribute set to `0` 

In this example, Synerise doesn't de-activate the subscription after its period runs out. Your mobile application must do this. 

## Security configuration
---
Before you start working with this hub, if you are a Synerise customer or partner, consider reading [the section about denylisting events](/docs/settings/tool/api#denylist). This natively accessible configuration will allow you to manage the restrictions in points management that may help you prevent fraud. 

## Process 

--- 


In this use case, you will go through the following steps: 

1. [Create an aggregate](/use-cases/subscription#create-an-aggregate) checking the subscription status. 

2. [Create a segmentation](/use-cases/subscription#create-a-segmentation) eligible for the subscription based on the previously created aggregate. 

4. [Create a promotion](/use-cases/subscription#create-a-promotion) in Synerise, that reduces the subscribed item's price to zero for the customer. 

3. [Create a workflow that tracks redemptions](/use-cases/subscription#create-a-workflow-that-tracks-redemptions) when the customer redeems a coffee. This is needed to track if a coffee was already picked up on a particular day (by using the aggregate created earlier). 

5. [Create a workflow which checks the subscription status daily](/use-cases/subscription#create-a-workflow-which-checks-the-subscription-status-daily). 


## Create an aggregate 

--- 

In this part of the process, create an aggregate that returns the customer's daily redemption status from the most recent `subscription.status` event.  



<div class="admonition admonition-important"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg></div><div class="admonition-body"><div class="admonition-content">

It is important to collect on the client-side transactional information about buying a subscription by customer. In this situation you should generate on your side event (in this case it is `subscription.status`) with the parameter (in this case named `segment_enabled`) with information if the customer is eligible for their daily coffee and send this event to Synerise (the value should be `1` if yes, or `0` if not).

</div></div></div>
 

 
1. Go to <img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/icons/behavioral-data-hub-icon.svg" alt="Behavioral Data Hub icon" class="icon"> **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.  

2. Enter the name of the aggregate. 

3. Click **Analyze profiles by** and select **Last**.  

4. From the **Choose event** dropdown list, select the `subscription.status` event. 

5. As the event parameter, select **segment_enabled**. 

5. Click **+where** and choose the **segment_enabled** parameter. 

9. From the **Choose operator** dropdown list, select **Equal**. 

6. As the value set up `1` (it means that it is active). 

6. Define the period from which the aggregate will look up event data - in this case, it is **Lifetime**. 

7. Click **Save**. 


<figure> 

<img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/use-cases/all-cases/_gfx/subscription1.png" class="full" alt="Configuration of the aggregate"> 

<figcaption>Configuration of the aggregate</figcaption> 

</figure> 


## Create a segmentation  

--- 

Create a segmentation of customers based on the results of [the aggregate you created](/use-cases/subscription#create-an-aggregate) in the previous part of the process. This segmentation shows the customers who did not redeem a coffee on a particular day. 

 
1. Go to <img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/icons/decision-hub-icon.svg" alt="Decision Hub icon" class="icon" > **Decision Hub > Segmentations > New segmentation**. 

2. Enter the name of the segmentation. 

3. Click **Choose filter**.  

4. From the dropdown list, select the [aggregate you created before](/use-cases/subscription#create-an-aggregate).  

5. As the logical operator, select **Equal**.  

6. In the text field, enter `true`. 

7. Save the segmentation.  


<figure> 

<img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/use-cases/all-cases/_gfx/subscription2.png" alt="Segment settings" class="WYBIERZ ROZMIAR:full"> 

<figcaption>Segment settings</figcaption> 

</figure>  


## Create a promotion 

--- 

In this step, create a promotion that reduces the subscribed product’s price to zero and can be redeemed 30 times. 


1. Go to <img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/icons/ai-hub-icon.svg" alt="AI Hub icon" class="icon" > **AI Hub > Regular Promotions > Add promotion**.  

2. Select the **For selected items** option. 

3. In the **Audience** section: 

4. Choose the [segment created previously](/use-cases/subscription#create-a-segmentation). 

5. Click **Apply**. 

4. In the **Content** section: 

2. Add the name in the **Display name**. 

2. In the **Price** field, enter `0`.  

3. In the **Long description** add the names and SKU's of products which price should be reduced to zero (in this case coffees). 

4. Define the name and description of the promotion. 

3. Confirm the settings by clicking **Apply**. 

4. In **Type & limits** section: 

1. Choose the **Custom** type. 

2. Choose the **Multibuy** sub-type. 

4. Define the number of usages per activation as `1`. 

6. Define distribution period in the **Schedule** section and publish the promotion to apply all changes and run the promotion. 

7. After buying the subscription the promotion created above should be activated on the client side - **for 30 times** (because it is the promotion for 30 coffees). Check the [first](https://developers.synerise.com/LoyaltyandEngagement/LoyaltyandEngagement.html#operation/ActivateAPromotion) or [second](https://developers.synerise.com/LoyaltyandEngagement/LoyaltyandEngagement.html#operation/BatchActivate) option which help you in activation of the promotion in our documentation. 


## Create a workflow that tracks redemptions 

--- 

In this step create a workflow that generates the event which informs that user collecting his daily coffee. In this workflow, after the promotion is redeemed by customer who has subscription - `client.removePoints` event is generated. This event is the trigger of the described workflow, which removes a customer from the segment for one day (they will not be able to use this subscription two times a day). 


1. Go to <img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/icons/automation-hub-icon.svg" alt="Automation Hub icon" class="icon" > **Automation Hub > Workflows > New workflow**.  

2. Enter the name of the workflow. 


### Define the Profile Event trigger node 

--- 

At this stage, you configure the workflow to be triggered by a `client.removePoints` event. 


1. As the first node of the workflow, add **Profile Event**. In the configuration of the node:  

1. From **Choose event** dropdown menu, choose `client.removePoints` event. 

2. Click the + where button, from the **Choose parameter** dropdown menu, choose **promotionUuid**.  

3. From the **Choose operator** dropdown, choose **Equal (String)**. 

4. In the next field, type the UUID of the promotion that you created earlier. 

2. Confirm by clicking **Apply**. 


### Define the Generate Event node 

--- 

At this stage, an event is generated which is then used to exclude this profile from the segmentation of customers who did not pick up a coffee on this day. 


1. As the second node of the workflow, add **Generate Event**.  
2. In the **Event name**, enter `subscription.status`. 
4. In the **Body** section, define the parameters of this event. In this case it is:  ``` {"segment_enabled": "0"} ``` This removes the customer from the segment of customers eligible for a coffee on this day. 
5. Click **Apply**. 


### Add the finishing node 

--- 

9. Add the **End** node. 

10. In the upper right corner, click **Save & Run**.  


<figure><img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/use-cases/all-cases/_gfx/subscription-workflow1.png" class="full" alt="The workflow configuration"><figcaption>The workflow configuration</figcaption></figure> 


## Create a workflow which checks the subscription status daily 

--- 

In this step create a workflow that checks the current subscription status. It is triggered by the **Audience** node, which starts the automation every day at 00:00. This way, customers who picked up their daily coffee and were removed from the segment of eligible customers the day before, are re-added to the segment and can use the promotion during the next day. They must also have an active subscription. 


### Define the Audience trigger node 

--- 

At this stage, you configure the conditions that trigger the workflow.  


1. As the trigger node, add an **Audience** node.  

2. In the configuration of the node:  

1. Set the **Run trigger** option to **repeatable**. 

2. Set the interval to 1 per day. 

3. As the time when the process starts, Choose 0:00 A.M. to make sure that the automation will check the customer status at the beginning of each day. 

4. Select the time zone. 

6. In **Define audience**, choose **New Audience** and click **Define conditions**. 

1. As the first condition, from the **Choose filter** dropdown menu, choose the `subscription.status` event.  

2. Click the **+ where** button, choose **segment_enabled**, and then select **Equal**. As the value, enter `0` 

6. Set the time range to **Last 1 day before 1 day**.  

3. As the second condition, from **Choose filter** dropdown menu, choose the `subscription.active` attribute and then select **Equal**. As the value, enter `1`.  

8. Click **Apply**. 


<figure><img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/use-cases/all-cases/_gfx/subscription3.png" class="full" alt="The configuration of the Audience node"><figcaption>The configuration of the Audience node</figcaption></figure> 


### Define the Generate Event node 


At this stage, an event with information that the customer has an active subscription and should be added to the segment again is generated. Based on that, the customer will be able to redeem another coffee during this day. 


1. As the second node of the workflow, add **Generate Event**.  

2. In the **Event name**, enter `subscription.status`. 

4. In the **Body** section, define the parameters of this event. In this case, it is:  

``` 

{"segment_enabled": "1"} 

```  

This re-adds the customer to the segment of customers eligible for a coffee on this day. 

5. Click **Apply**. 


### Add the finishing node 

--- 

9. Add the **End** node. 

10. In the upper right corner, click **Save & Run**.  


<figure><img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/use-cases/all-cases/_gfx/subscription4.png" class="full" alt="The workflow configuration"><figcaption>The workflow configuration</figcaption></figure> 

## Request from cash register
---

After using one of the [method](/use-cases/subscription#create-a-promotion)described in the promotion section - when customer buy a coffee, the cash register sends a request about promotions ([read more](https://developers.synerise.com/LoyaltyandEngagement/LoyaltyandEngagement.html#operation/GetClientPromotionsByACustomFilter)). If the cash register sees in the answer that customer has an active subscription, after processing the transaction, [redeem](https://developers.synerise.com/LoyaltyandEngagement/LoyaltyandEngagement.html#operation/RedeemAPromotion) the one promotion according to one of the methods above. 

## What's next  

--- 

This promotion can be the first step towards a more advanced marketing strategy and possibilities. While collecting your primary subscription (in this case coffee) you can for example receive a gift once in a billing period - (for example free muffin or small coffee).  


## Check the use case set up on the Synerise Demo workspace 

--- 

You can check the configuration directly in Synerise Demo workspace: 

- [aggregate](https://app.synerise.com/analytics/aggregates/9b44ca29-0f2b-3d63-94ba-d5903707472d) 

- [segmentation](https://app.synerise.com/analytics/segmentations/fdcf4f45-7268-49f1-b1dd-9d2add9f2723)  

- [workflow which generates the event informing about collecting the coffee on a specific day](https://app.synerise.com/automations/automation-diagram/2a0fc77a-4784-4a5c-a2a9-bb6e6f123094) 

- [workflow](https://app.synerise.com/automations/automation-diagram/5be43d01-05fd-4845-baa9-3d425f3196ab) which adds customers with active subscription to the segment again 

- [promotion](https://app.synerise.com/campaigns/promotions/7bc157e2-0e43-4072-b5f7-5f5e7db90352) 


If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.  

If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business.  

## Read more 

--- 

- [Aggregates](/docs/analytics/aggregates) 

- [Automation Hub](/docs/automation) 

- [Loyalty programs basics](/use-cases/loyalty-programs-basics) 

- [Promotions](/docs/ai-hub/promotions) 

- [Segmentation](/docs/analytics/segmentations) 

 
 
 

 
