Promotions and Vouchers


Promotions


Get all promotions of a customer


This method retrieves all available promotions that are defined for a customer.

Note: The API key must have the PROMOTIONS_DETAILS_FOR_CLIENT_READ permission from the Client group.

Declared In:
lib/main/modules/PromotionsModule.js

Class:
PromotionsModule

Declaration:

public getAllPromotions(onSuccess: (promotionResponse: PromotionResponse) => void, onError: (error: Error) => void)

Parameters:

Parameter Type Mandatory Default Description
onSuccess Function no - Function to be executed when the operation is completed successfully
onError Function no - Function to be executed when the operation is completed with an error

Return Value:
No value is returned.

Example:

Synerise.Promotions.getAllPromotions(function(promotionResponse) {
	//success
}, function(error) {
	//failure
});

Get promotions with query parameters


This method retrieves promotions that match the parameters defined in an API query.

Note: The API key must have the PROMOTIONS_DETAILS_FOR_CLIENT_READ permission from the Client group.

Declared In:
lib/main/modules/PromotionsModule.js

Related To:
PromotionsApiQuery

Class:
PromotionsModule

Declaration:

public getPromotions(apiQuery: PromotionsApiQuery, onSuccess: (promotionResponse: PromotionResponse) => void, onError: (error: Error) => void)

Parameters:

Parameter Type Mandatory Default Description
apiQuery PromotionsApiQuery yes - PromotionsApiQuery object responsible for storing all query parameters
onSuccess Function no - Function to be executed when the operation is completed successfully
onError Function no - Function to be executed when the operation is completed with an error

Return Value:
No value is returned.

Example:

let apiQuery = new PromotionsApiQuery();
apiQuery.statuses = [
	PromotionStatus.Active
];
apiQuery.types = [
	PromotionType.General
]
apiQuery.sorting = [
	{ property: PromotionSortingKey.CreatedAt, order: ApiQuerySortingOrder.Ascending }
];

apiQuery.limit = 120;
apiQuery.page = 2;
apiQuery.includeMeta = true;

Synerise.Promotions.getPromotions(apiQuery, function(promotionResponse) {
	//success
}, function(error) {
	//failure
});

Get promotion by UUID


This method retrieves the promotion with the specified UUID.

Note: The API key must have the PROMOTIONS_DETAILS_FOR_CLIENT_READ permission from the Client group.

Declared In:
lib/main/modules/PromotionsModule.js

Class:
PromotionsModule

Declaration:

public getPromotionByUUID(uuid: string, onSuccess: (promotion: Promotion) => void, onError: (error: Error) => void)

Parameters:

Parameter Type Mandatory Default Description
uuid string yes - UUID of the promotion
onSuccess Function no - Function to be executed when the operation is completed successfully
onError Function no - Function to be executed when the operation is completed with an error

Return Value:
No value is returned.

Example:

Synerise.Promotions.getPromotionByUUID("UUID", function(promotion) {
	//success
}, function(error) {
	//failure
});

Get promotion by code


This method retrieves the promotion with the specified code.

Note: The API key must have the PROMOTIONS_DETAILS_FOR_CLIENT_READ permission from the Client group.

Declared In:
lib/main/modules/PromotionsModule.js

Class:
PromotionsModule

Declaration:

public getPromotionByCode(code: string, onSuccess: (promotion: Promotion) => void, onError: (error: Error) => void)

Parameters:

Parameter Type Mandatory Default Description
code string yes - Code of the promotion
onSuccess Function no - Function to be executed when the operation is completed successfully
onError Function no - Function to be executed when the operation is completed with an error

Return Value:
No value is returned.

Example:

Synerise.Promotions.getPromotionByCode("CODE", function(promotion) {
	//success
}, function(error) {
	//failure
});

Activate promotion by UUID


This method activates the promotion with the specified UUID.

Note: The API key must have the PROMOTIONS_ACTIVATE_PROMOTIONS_UPDATE permission from the Promotions group.

Declared In:
lib/main/modules/PromotionsModule.js

Class:
PromotionsModule

Declaration:

public deactivatePromotionByUUID(uuid: string, onSuccess: () => void, onError: (error: Error) => void)

Parameters:

Parameter Type Mandatory Default Description
uuid string yes - UUID of the promotion
onSuccess Function no - Function to be executed when the operation is completed successfully
onError Function no - Function to be executed when the operation is completed with an error

Return Value:
No value is returned.

Example:

Synerise.Promotions.activatePromotionByUUID("UUID", function() {
	//success
}, function(error) {
	//failure
});

Activate promotion by code


This method activates the promotion with the specified code.

Note: The API key must have the PROMOTIONS_ACTIVATE_PROMOTIONS_UPDATE permission from the Promotions group.

Declared In:
lib/main/modules/PromotionsModule.js

Class:
PromotionsModule

Declaration:

public activatePromotionByCode(code: string, onSuccess: () => void, onError: (error: Error) => void)

Parameters:

Parameter Type Mandatory Default Description
code string yes - Code of the promotion
onSuccess Function no - Function to be executed when the operation is completed successfully
onError Function no - Function to be executed when the operation is completed with an error

Return Value:
No value is returned.

Example:

Synerise.Promotions.activatePromotionByCode("CODE", function() {
	//success
}, function(error) {
	//failure
});

Activate promotions in a batch


This method activates promotions with a code or with UUID in a batch.

Note: The API key must have the PROMOTIONS_ACTIVATE_PROMOTIONS_UPDATE permission from the Promotions group.

Declared In:
lib/main/modules/PromotionsModule.js

Related To:
PromotionIdentifier

Class:
PromotionsModule

Declaration:

public activatePromotionsBatch(promotionsIdentifiers: Array<PromotionIdentifier>, onSuccess: () => void, onError: (error: Error) => void)

Parameters:

Parameter Type Mandatory Default Description
promotionsIdentifiers Array<PromotionIdentifier> yes - List of promotion identifiers
onSuccess Function no - Function to be executed when the operation is completed successfully
onError Function no - Function to be executed when the operation is completed with an error

Return Value:
No value is returned.

Example:

Synerise.Promotions.activatePromotionsBatch(promotionsIdentifiers, function() {
	//success
}, function(error) {
	//failure
});

Deactivate promotion by UUID


This method deactivates the promotion with the specified UUID.

Note: The API key must have the PROMOTIONS_DEACTIVATE_PROMOTIONS_UPDATE permission from the Promotions group.

Declared In:
lib/main/modules/PromotionsModule.js

Class:
PromotionsModule

Declaration:

public deactivatePromotionByUUID(uuid: string, onSuccess: () => void, onError: (error: Error) => void)

Parameters:

Parameter Type Mandatory Default Description
uuid string yes - UUID of the promotion
onSuccess Function no - Function to be executed when the operation is completed successfully
onError Function no - Function to be executed when the operation is completed with an error

Return Value:
No value is returned.

Example:

Synerise.Promotions.deactivatePromotionByUUID("UUID", function() {
	//success
}, function(error) {
	//failure
});

Deactivate promotion by code


This method deactivates the promotion with the specified code.

Note: The API key must have the PROMOTIONS_DEACTIVATE_PROMOTIONS_UPDATE permission from the Promotions group.

Declared In:
lib/main/modules/PromotionsModule.js

Class:
PromotionsModule

Declaration:

public deactivatePromotionByCode(code: string, onSuccess: () => void, onError: (error: Error) => void)

Parameters:

Parameter Type Mandatory Default Description
code string yes - Code of the promotion
onSuccess Function no - Function to be executed when the operation is completed successfully
onError Function no - Function to be executed when the operation is completed with an error

Return Value:
No value is returned.

Example:

Synerise.Promotions.deactivatePromotionByCode("CODE", function() {
	//success
}, function(error) {
	//failure
});

Deactivate promotions in a batch


This method deactivates promotions with a code or with UUID in a batch.

Note: The API key must have the PROMOTIONS_DEACTIVATE_PROMOTIONS_UPDATE permission from the Promotions group.

Declared In:
lib/main/modules/PromotionsModule.js

Related To:
PromotionIdentifier

Class:
PromotionsModule

Declaration:

public deactivatePromotionsBatch(promotionsIdentifiers: Array<PromotionIdentifier>, onSuccess: () => void, onError: (error: Error) => void)

Parameters:

Parameter Type Mandatory Default Description
promotionsIdentifiers Array<PromotionIdentifier> yes - List of promotion identifiers
onSuccess Function no - Function to be executed when the operation is completed successfully
onError Function no - Function to be executed when the operation is completed with an error

Return Value:
No value is returned.

Example:

Synerise.Promotions.deactivatePromotionsBatch(promotionsIdentifiers, function() {
	//success
}, function(error) {
	//failure
});

Vouchers


Get or assign voucher from pool


This method retrieves an assigned voucher code or assigns a voucher from a pool identified by UUID to the customer.

Once a voucher is assigned using this method, the same voucher is returned for the profile every time the method is called.

When the voucher is assigned for the first time, a voucherCode.assigned event is produced.

Note: The API key must have the VOUCHERS_ITEM_ASSIGN_CREATE and VOUCHERS_ITEM_ASSIGN_READ permission from the Assign group.

Declared In:
lib/main/modules/PromotionsModule.js

Class:
PromotionsModule

Declaration:

Parameters:

Parameter Type Mandatory Default Description
poolUuid string yes - Pool’s universally unique identifier
onSuccess Function no - Function to be executed when the operation is completed successfully
onError Function no - Function to be executed when the operation is completed with an error

Return Value:
No value is returned.

Example:

Synerise.Promotions.getOrAssignVoucher(poolUuid, function(voucherResponse) {
      // success
  }, function(error) {
      // failure
  })

Assign voucher code from pool


This method assigns a voucher from a pool identified by UUID to the profile.

Every request returns a different code until the pool is empty.

A voucherCode.assigned event is produced.

Note: Returns the HTTP 416 status code when the pool is empty.
Note: The API key must have the VOUCHERS_ITEM_ASSIGN_CREATE and VOUCHERS_ITEM_ASSIGN_READ permission from the Assign group.

Declared In:
lib/main/modules/PromotionsModule.js

Class:
PromotionsModule

Declaration:

Parameters:

Parameter Type Mandatory Default Description
poolUuid string yes - Pool’s universally unique identifier
onSuccess Function no - Function to be executed when the operation is completed successfully
onError Function no - Function to be executed when the operation is completed with an error

Return Value:
No value is returned.

Example:

Synerise.Promotions.assignVoucherCode(poolUuid, function(voucherResponse) {
      // success
  }, function(error) {
      // failure
  })

Get voucher codes assigned to customer


This method retrieves voucher codes for a customer.

Note: The API key must have the VOUCHERS_ITEM_ASSIGN_READ permission from the Assign group.

Declared In:
lib/main/modules/PromotionsModule.js

Class:
PromotionsModule

Declaration:

Parameters:

Parameter Type Mandatory Default Description
onSuccess Function no - Function to be executed when the operation is completed successfully
onError Function no - Function to be executed when the operation is completed with an error

Return Value:
No value is returned.

Example:

Synerise.Promotions.getAssignedVoucherCodes(function(voucherCodesResponse) {
  // success
  }, function(error) {
    // failure
  })

😕

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.

Close modal icon Placeholder alt for modal to satisfy link checker