Sign In Register

How can we help you today?

Start a new topic

Applying discounts to virtual goods

We have a Sales mongo collection and each sale has a list of virtual good shortcodes where each item is offered at a specific discount price

i.e. black-t-shirt costs 1 USD, white-t-shirt costs 2 USD etc.

We want to somehow dynamically target our players and determine which sale is relevant to them.


Q1: What is the easiest approach to buy a shortcode at a discounted price, without forcing administrators to manually create segmentations for each shortcode by hand?

Q2: Can we segment virtual goods and create segmentation query filters (SQF) dynamically through an API?

Desired workflow example :

1. player chooses to buy the virtual good 'black-t-shirt'

2. we create a SQF named 'sale1_black-t-shirt'

2. we configure 'black-t-shirt' virtual good to have segment 'sale1_black-t-shirt'

3. the player attempts to purchase the 'black-t-shirt' at the discounted price like:

Spark.getPlayer().setSegmentValue(" sale1_black-t-shirt");

var request = new SparkRequests.BuyVirtualGoodsRequest();

request.currencyShortCode = 'EUR'

request.quantity = 1;

request.shortCode = 'black-t-shirt'

var response = request.Send();

4. the player now owns 'black-t-shirt' bought at a discounted price



Login to post a comment