Loyalty
Loyalty in mobile SDK covers two features:
- Promotions - In Synerise, the Promotions module allows you to:
- introduce a system of awarding and spending loyalty points so your profiles can use them and purchase your products.
- use the module as a distribution channel for discounted products.
Tip: Read more about implementing promotions in your store.
- Vouchers - In Synerise, you can create a pool of discount codes which you can distribute through the mobile application.
Tip: Read more about voucher pools.
Promotions
Overview
Promotions let you fetch special offers for your profiles.
Class reference for promotions: Android, iOS, React Native, Flutter.
Method reference for promotions: Android, iOS, React Native, Flutter.
Basic implementation
The example below is the basic implementation and retrieves all promotions for a profile, without any parameters to filter them.
IDataApiCall<PromotionResponse> apiCall = Promotions.getPromotions();
apiCall.execute(onSuccess, showAlertError);
Advanced implementation
If you want to have full possibilities of configuring the query for promotions, getting items using the PromotionsApiQuery
is the best way to achieve it.
The table explains the filtering options available when fetching promotions.
Property | Type | Default | Description |
---|---|---|---|
statuses | List<PromotionStatus> |
[] | List of statuses for query |
types | List<PromotionType> |
[] | List of types for query |
sortParameters | LinkedHashMap<PromotionSortingKey, ApiQuerySortingOrder> |
[] | Specifies sorting rules for items in the response |
limit | Int |
100 | Limit of items per page in the response |
page | Int |
1 | Page number |
includeMeta | Boolean |
false | Specifies if metadata should be included in the response |
The example below is the advanced implementation and fetches promotions using PromotionsApiQuery
object.
List<PromotionStatus> statuses = new ArrayList<>();
if (activeBox.isChecked()) statuses.add(PromotionStatus.ACTIVE);
if (assignedBox.isChecked()) statuses.add(PromotionStatus.ASSIGNED);
if (redeemedBox.isChecked()) statuses.add(PromotionStatus.REDEEMED);
List<PromotionType> types = new ArrayList<>();
if (generalBox.isChecked()) types.add(PromotionType.GENERAL);
if (customBox.isChecked()) types.add(PromotionType.CUSTOM);
if (membersOnlyBox.isChecked()) types.add(PromotionType.MEMBERS_ONLY);
PromotionsApiQuery query = new PromotionsApiQuery();
query.limit = 100;
query.statuses = statuses;
query.types = types;
query.page = page;
query.includeMeta = includeButton.isChecked();
LinkedHashMap<PromotionSortingKey, ApiQuerySortingOrder> sortParams = new LinkedHashMap<>();
sortParams.put(PromotionSortingKey.TYPE, ApiQuerySortingOrder.ASCENDING);
sortParams.put(PromotionSortingKey.CREATED_AT, ApiQuerySortingOrder.ASCENDING);
sortParams.put(PromotionSortingKey.EXPIRE_AT, ApiQuerySortingOrder.DESCENDING);
query.setSortParameters(sortParams);
IDataApiCall<PromotionResponse> apiCall = Promotions.getPromotions(query);
apiCall.execute(onSuccess, new DataActionListener<ApiError>() {
@Override
public void onDataAction(ApiError apiError) {
// error handling
}
});
Promotion type
The promotion type options correspond to the promotion type options available in the Synerise application in the creating promotion form.
- GENERAL - promotions are available to all profiles.
- MEMBERS_ONLY - promotions are available to profiles who joined a loyalty program.
- HANDBILL - promotions which can only be selected by the AI promotion engine for a customer.
- CUSTOM - custom promotions are a category that has custom configuration, tailored for chosen profiles.
Constants in the SDK correlated with promotion types:
Android | iOS | React Native | Flutter |
---|---|---|---|
PromotionType.GENERAL |
SNR_PROMOTION_TYPE_GENERAL |
PromotionType.General |
PromotionType.general |
PromotionType.MEMBERS_ONLY |
SNR_PROMOTION_TYPE_MEMBERS_ONLY |
PromotionType.MembersOnly |
PromotionType.membersOnly |
PromotionType.CUSTOM |
SNR_PROMOTION_TYPE_CUSTOM |
PromotionType.Custom |
PromotionType.custom |
PromotionType.HANDBILL |
SNR_PROMOTION_TYPE_HANDBILL |
PromotionType.Handbill |
PromotionType.handbill |
Promotion status
- ACTIVE - promotion is activated by the profile.
- ASSIGNED - promotion is assigned to a profile and visible to them.
- REDEEMED - promotion is redeemed and finished for the profile.
Constants in the SDK correlated with promotion statuses:
Android | iOS | React Native | Flutter |
---|---|---|---|
PromotionStatus.ACTIVE |
SNR_PROMOTION_STATUS_ACTIVE |
PromotionStatus.Active |
PromotionStatus.active |
PromotionStatus.ASSIGNED |
SNR_PROMOTION_STATUS_ASSIGNED |
PromotionStatus.Assigned |
PromotionStatus.assigned |
PromotionStatus.REDEEMED |
SNR_PROMOTION_STATUS_REDEEMED |
PromotionStatus.Redeemed |
PromotionStatus.redeemed |
Promotion sorting options
You can set an array of sorting options. Each sorting option is a key-value pair. The key is the sorting key constant and the value is the sorting order.
Promotion-related sorting constants:
- EXPIRE_AT - time when the promotion expires.
- CREATED_AT - time when the promotion was created.
- LASTING_AT - time when the promotion stops being active for the profile.
- REQUIRE_REDEEMED_POINTS - how many loyalty points are needed to redeem the promotion.
- UPDATED_AT - time when the promotion was last updated.
- TYPE - type of the promotion.
- PRIORITY - priority of the promotion.
Constants in the SDK correlated with promotion sorting options:
Android | iOS | React Native | Flutter |
---|---|---|---|
PromotionSortingKey.EXPIRE_AT |
SNR_PROMOTION_SORTING_KEY_EXPIRE_AT |
PromotionSortingKey.ExpireAt |
PromotionSortingKey.expireAt |
PromotionSortingKey.CREATED_AT |
SNR_PROMOTION_SORTING_KEY_CREATED_AT |
PromotionSortingKey.CreatedAt |
PromotionSortingKey.createdAt |
PromotionSortingKey.LASTING_AT |
SNR_PROMOTION_SORTING_KEY_LASTING_AT |
PromotionSortingKey.LastingAt |
PromotionSortingKey.lastingAt |
PromotionSortingKey.REQUIRE_REDEEMED_POINTS |
SNR_PROMOTION_SORTING_KEY_REQUIRE_REDEEMED_POINTS |
PromotionSortingKey.requireRedeemPoints |
PromotionSortingKey.ExpireAt |
PromotionSortingKey.UPDATED_AT |
SNR_PROMOTION_SORTING_KEY_UPDATED_AT |
PromotionSortingKey.UpdatedAt |
PromotionSortingKey.updatedAt |
PromotionSortingKey.TYPE |
SNR_PROMOTION_SORTING_KEY_TYPE |
PromotionSortingKey.Type |
PromotionSortingKey.type |
PromotionSortingKey.PRIORITY |
SNR_PROMOTION_SORTING_KEY_PRIORITY |
PromotionSortingKey.Priority |
PromotionSortingKey.priority |
You can sort each of the above ascending or descending by using the values:
- ASCENDING
- DESCENDING
Constants in the SDK correlated with sorting order values:
Android | iOS | React Native | Flutter |
---|---|---|---|
ApiQuerySortingOrder.ASCENDING |
SNR_API_QUERY_SORTING_ASC |
ApiQuerySortingOrder.Ascending |
ApiQuerySortingOrder.ascending |
ApiQuerySortingOrder.DESCENDING |
SNR_API_QUERY_SORTING_DESC |
ApiQuerySortingOrder.Descending |
ApiQuerySortingOrder.descending |
You can add a number of key-value pairs for sorting.
Working with single promotions
In addition to getting all promotions or a filtered list, you can get a single promotion.
You can get a single promotion by:
- UUID of the promotion
- Code of the promotion
These are the basic identity properties for a promotion. They are useful and thanks to them, you can activate and deactivate a single promotion too.
The following methods are available:
Vouchers
Overview
In Synerise, you can create a voucher pool to distribute discount codes to your profiles for the campaign purposes.
The codes in a voucher pool get two forms:
- a text string
- a barcode
Class reference for vouchers: Android, iOS, React Native, Flutter.
Method reference for vouchers: Android, iOS, React Native, Flutter.
Voucher status
- UNASSIGNED - voucher is unassigned to any profile.
- ASSIGNED - voucher is assigned to a profile and visible to them.
- REDEEMED - voucher is redeemed and finished for the profile.
- CANCELED - voucher is canceled for the profile.
Working with vouchers
The following methods are available: