Sign In Register

How can we help you today?

Start a new topic

How to setup buying currency via SteamWallet?

Hey there, So I wondered if it is possible to let players buy currency via Steam. I know there is "SteamBuyGoodsRequest", but there is barely any documentation about it. The idea is that players are authenticated with their Steam account and when they want to buy a specific currency for real money, it should be handled by GameSparks and actually payed via Steam (means either their wallet or with their paymentmethod they added) . Would someone be so nice and explain how to setup Steam, the Game and GameSparks to allow that? It would be enough to have it work via the TestHarness. I assume the purchase needs to be handled via Steam first (So steam needs to have the "currency" too) and then GameSparks just uses the OrderID? Kind regards, Cedric Neukirchen

Hi Cedric,

 

You can configure real money with 3rd party stores by using our virtual goods and currencies, we have a step by step guide on setting this up here. This will allow you to specify the Steam Product ID that can be configured in the Virtual Good itself. 

Following from this you would then use the SteamBuyGoodsRequest to validate the players purchase and give them the desired good.

 

Regards,

Ronan

Hey Ronan,


thanks for your answer. I read through that already, but it's not really adding any detail towards the Steam side of things.
It talks about adding WindowStore, iOS App Store and GooglePlay Store.

I enabled the Steam Integrations in the GameOverview settings. So I can see the SteamProduct ID. My question is now: What are the steps between setting up the VirtualGood and the SteamBuyGoodsRequest.

Do I have to setup the SteamGame first to have a Product with ID and do all the buying through the SteamAPI?
Then after that is done, send the OrderID (which I hopefully get from the SteamAPI after buying something) to GameSparks and use the SteamBuyGoodsRequest? Is that save to have in the GameClient? 

Kind regards,
Cedric Neukirchen

Hi Cedric,


The process is as follows:


-Set up a virtual good on the platform. And enter a valid Steam Product ID.

-When a purchase has taken place in the client through SteamAPI, you should get an Order ID, which is a unique 64-bit ID.

-You will input this Order ID to a SteamBuyGoodsRequest, and GameSparks will automatically figure out which virtual item it's linked to and award it to the player.


In terms of virtual currency, unfortunately you can't just consume the virtual good and receive currency, you will have to configure it. We've put in a feature request for currency packs, but we are waiting on it.


Here's a work around using Cloud code:


ConsumeVirtualGoodRequest:


 

//Check if no errors occured with creating the request
if(Spark.getData().error == null){
    //Pass useful information to the response
     Spark.setScriptData("vGood", {"shortCode":Spark.getData().shortCode,"quantity":Spark.getData().quantity})
} 

 


ConsumeVirtualGoodRespons:


 

//Check if there's no problem with the consumption of this virtual good
if(Spark.getData().error == null){
    //Check for how many items were bought
    for(var i = 0; i < Spark.getData().scriptData.vGood.quantity; i++){
        //Identift the item being consumed
        if(Spark.getData().scriptData.vGood.shortCode === "pack_100"){
            //Credit the player with the currency type
           Spark.getPlayer().credit("gems", 100, "Bought Currency pack")
        } else if(Spark.getData().scriptData.vGood.shortCode === "pack_500"){
            //Credit the player with the currency type
           Spark.getPlayer().credit("gems", 500, "Bought Currency pack")
        }
    } 
}

 

I hope this helps,

Omar

Hey Omar, Thanks a lot (: that solves my question then. PS: The reply button in the Gamesparks email sends me to the login page with #reply or so and one can't login with that. Might want to have your webdevs checking into that.

 You're welcome.


Thank you for the feedback, I will see to it that it's fixed.


Cheers,

Omar

Login to post a comment