Loyalty
Promotions
Promotions let you fetch special offers for your customers. The offers must first be configured in app.synerise.com.
Documentation on how to prepare promotions is available in the Promotions - Creating promotions section.
See also Class Reference - Promotions.

Basic Implementation
The example below is the most basic implementation and retrieves all promotions, without any parameters to filter them.
Promotions.getPromotions(success: { (promotionResponse) in
//success
}) { (error) in
//failure
}
Additional query options
The table explains the filtering options available when fetching promotions.
Property | Type | Default | Description |
---|---|---|---|
statuses | [PromotionStatus] |
[] | List of statuses for query (PromotionStatus ) |
types | [PromotionType] |
[] | List of types for query (PromotionType ) |
sorting | [[SNRPromotionSortingKey: SNRApiQuerySortingOrderString]] |
[] | 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 | Bool |
false | Specifies if meta data should be included in the response |
Promotion Status
ACTIVE
- promotion is activated by the customer.ASSIGNED
- promotion is assigned to a customer and visible to them.REDEEMED
- promotion is redeemed and finished for the customer.
Constants in the SDK correlated with promotion statuses:
SNR_PROMOTION_STATUS_ACTIVE
- promotion is active and available for the customer.SNR_PROMOTION_STATUS_ASSIGNED
- promotion is assigned to a customer and visible to them.SNR_PROMOTION_STATUS_REDEEMED
- promotion is redeemed and finished for the customer.
These constants should be used when you get promotions by using the PromotionsApiQuery
object.
Promotion Type
GENERAL
- promotions are available to all customers.MEMBERS_ONLY
- promotions are available to customers who joined a loyalty program.CUSTOM
- custom promotions are a category that has custom configuration, tailored for chosen customers.
Constants in the SDK correlated with promotion types:
SNR_PROMOTION_TYPE_GENERAL
SNR_PROMOTION_TYPE_MEMBERS_ONLY
SNR_PROMOTION_TYPE_CUSTOM
These constants should be used when you get promotions by using the PromotionsApiQuery
object.
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:
SNR_PROMOTION_SORTING_KEY_EXPIRE_AT
- time when the promotion expires.SNR_PROMOTION_SORTING_KEY_CREATED_AT
- time when the promotion was created.SNR_PROMOTION_SORTING_KEY_LASTING_AT
- time when the promotion stops being active for the Customer.SNR_PROMOTION_SORTING_KEY_REQUIRE_REDEEMED_POINTS
- how many loyalty points are needed to redeem the promotion.SNR_PROMOTION_SORTING_KEY_UPDATED_AT
- time when the promotion was last updated.SNR_PROMOTION_SORTING_KEY_TYPE
- type of the promotion.SNR_PROMOTION_SORTING_KEY_PRIORITY
- priority of the promotion.
You can sort each of the above ascending or descending by using the values:
SNR_API_QUERY_SORTING_ASC
SNR_API_QUERY_SORTING_DESC
You can add a number of key-value pairs for sorting.
Parameterized implementation
First, configure the PromotionsApiQuery
object. Then you can use it in an SDK method.
let apiQuery = PromotionsApiQuery()
apiQuery.types = [SNR_PROMOTION_TYPE_GENERAL]
apiQuery.statuses = [SNR_PROMOTION_STATUS_ACTIVE, SNR_PROMOTION_STATUS_ASSIGNED]
apiQuery.types = [SNR_PROMOTION_TYPE_GENERAL]
apiQuery.sorting = [
[SNR_PROMOTION_SORTING_KEY_PRIORITY: SNR_API_QUERY_SORTING_ASC]
]
apiQuery.limit = 50
apiQuery.page = 1
apiQuery.includeMeta = true
Promotions.getPromotions(apiQuery: apiQuery, success: { (promotionResponse) in
//success
}, failure: { (error) in
//failure
})
PromotionsApiQuery
is best way to achieve it. Parameterized methods in the SDK are deprecated.Working with 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 single promotion too.
There is a list of the methods below:
Promotions.getPromotion(uuid:success:failure:)
- Gets promotion identified by UUID.
Promotions.getPromotion(code:success:failure:)
- Gets promotion identified by code.
Promotions.activatePromotion(uuid:success:failure:)
- Activates promotion identified by UUID.
Promotions.activatePromotion(code:success:failure:)
- Activates promotion identified by code.
Promotions.activatePromotions(identifiers:success:failure:)
- Activates promotions.
Promotions.deactivatePromotion(uuid:success:failure:)
- De-activates promotion identified by UUID.
Promotions.deactivatePromotion(code:success:failure:)
- De-activates promotion identified by code.
Promotions.deactivatePromotions(identifiers:success:failure:)
- Activates promotions.
Vouchers
See also Class Reference - Promotions.
Voucher Status
UNASSIGNED
- voucher is unassigned to any customer.ASSIGNED
- voucher is assigned to a customer and visible to them.REDEEMED
- voucher is redeemed and finished for the customer.CANCELED
- voucher is canceled for the customer.
Working with vouchers
There is a list of the methods below:
Promotions.getOrAssignVoucher(poolUUID:success:failure:)
- Gets voucher code only once or assign voucher with provided pool UUID for the client.
Promotions.assignVoucherCode(poolUUID:success:failure:)
- Assigns voucher with provided pool UUID for the client.
Promotions.getAssignedVoucherCodes(success:failure:)
- Gets client’s voucher codes.