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.

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 Array [] List of statuses for query (SNRPromotionStatus)
types Array [] List of types for query (SNRPromotionType)
sorting Array [] 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
  • SNR_PROMOTION_STATUS_ASSIGNED
  • SNR_PROMOTION_STATUS_REDEEMED

These constants should be used when you get promotions by using the SNRPromotionsApiQuery 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 SNRPromotionsApiQuery 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 SNRPromotionsApiQuery 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
})
Important: Getting promotions using the SNRPromotionsApiQuery 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.

Note: Method reference for promotions is available in this section.
😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.