Sign In Register

How can we help you today?

Start a new topic
Answered

Cloud Code: On Registration set default data for user

I want to create some cloud code that upon Registration that I can set some default data for the user.  For example,  if a user registers in our system, then the user will get 1500 of  Currency1  to start out with.  I don't want this handled on the client side,  I want it to be handled upon registration.


I am looking right now at  Cloud Code --> Bindings --> Requests --> RegistrationRequest


if I do a  Spark.getPlayer().credit1(1500);   the result of this when run from TestHarness is that the currently logged in User get's credited this amount,  but not the User I am creating.


What is the proper way to accomplish this?


Thanks,


Best Answer

Hi Marco


We have the ability to do this automatically for you. From the overview page, click the edit icon in the top right.


Here you can set "Signup Bonuses", which are an amount of each currency thats given to a player when they register.


If you want finer grained control, you can do it in cloud code, but you need to use RegistrationResponse rather than request. Request code is executed before the request, so as you've seen, this affect the user making the request.


Gabriel

1 Comment

Answer

Hi Marco


We have the ability to do this automatically for you. From the overview page, click the edit icon in the top right.


Here you can set "Signup Bonuses", which are an amount of each currency thats given to a player when they register.


If you want finer grained control, you can do it in cloud code, but you need to use RegistrationResponse rather than request. Request code is executed before the request, so as you've seen, this affect the user making the request.


Gabriel

Login to post a comment