Sign In Register

How can we help you today?

Start a new topic
Answered

How to apply a discount on a buyVirtualGoodsRequest

Hello again!

We want to apply a promotion (temporal discount) in a virtualGood only for some players based on their location, with cloud code we can check if the user is a candidate to apply the discount using "buyVirtualGoodsRequest" but then... How can we apply the discount on his transaction?


...modifying the virtualCurrency parameter is not an option because it will affect to all the players....


Thank you!


Best Answer

Jorge,


One way to do this would be to credit the player back with the appropriate currency on the buyVirtualGoodsResponse using something along the following lines:


var discountAmount = 2;


var response = Spark.sendRequest({"@class":".AccountDetailsRequest"});

var userCountry = response.location.country;


if (userCountry == "IRL") {

    Spark.getPlayer().credit1(disountAmout);

}


Regards,


John.


1 person has this question

Answer

Jorge,


One way to do this would be to credit the player back with the appropriate currency on the buyVirtualGoodsResponse using something along the following lines:


var discountAmount = 2;


var response = Spark.sendRequest({"@class":".AccountDetailsRequest"});

var userCountry = response.location.country;


if (userCountry == "IRL") {

    Spark.getPlayer().credit1(disountAmout);

}


Regards,


John.

Hi John,


we thought on that at first, to credit back the player, but we had doubts if it would generate confussion on statistics and purchases. We can take that solution now, but it would be just great to create a Promotions and Discounts tab on the virtual currencies that could modify the price based on date and player's location.


Anyway, it would be great to be able to get the player's country from the Player object, we really missed it :-)


Thank you, and congratulations again for the support and all the work on the backend, it's getting really amazing what you are doing here.



OK - I will look into getting this onto the backlog for you.


John.

Login to post a comment