An intermediate api to handle steam microtransactions using steam web services. Ready to use with Unity, Unreal, Godot and so on
An intermediate api to handle steam microtransactions (In Game Purchases) using steam web services.
You can use this repo to fork and host an API to be used with Unity, Unreal, Godot or any engine you want to develop a steam game.
This Bridge API has been created based on the Steam Partner API recommendations.
If you need to implement microtransactions in your game, you must create a web service to handle and request the Steam WEB API, and that's precisely the purpose of this repository.
To help game developers save time and money, I've created a single code that enables them to implement microtransactions quickly.
With this repository, you can use Heroku or Digital Ocean to deploy your own API with just a few clicks. See Heroku git deploy or Digital Ocean Deploy, or choose any other host you prefer.
First of all, it's important to read Steam's recommendations on this topic: https://partner.steamgames.com/doc/features/microtransactions
Steam doesn't recommend calling the Steam Partner API directly from your game. Instead, you should create your own API to act as a bridge between your game and Steam. That's the purpose of this API repository.
This is a TypeScript (Node.js v18+) based API, and you can use services like Heroku or Digital Ocean to publish it.
To get started, follow these steps:
To run the API locally and for testing, duplicate the file env.example
and rename it to .env
, and then update it with the correct values.
yarn
to install the dependencies.yarn test
.yarn start
.There is some confusion about which webkey to use for Steam in-app purchases and API in-game. Here are the instructions for generating the correct key:
To prevent users from sending arbitrary amounts for products, there is a file called products.json
in the src/
directory. Make sure to replace the ID and amount according to your list of products.
You can check the documentation of this API here: https://jasielmacedo.github.io/steam-microtransaction-api/
The flow is as follows:
/InitPurchase
endpoint to start the purchase./FinalizePurchase
endpoint.If the user has parental control and the callback was not called, you can check the status by calling the /CheckPurchaseStatus
endpoint.
In-game purchases are not complicated, but you need to be sure that the Steam user is reliable. To avoid scammers, simply call the /GetReliableUserInfo
endpoint. If the return is true, you can start the microtransaction.
You can check the example folder to see an example using Unity.
Maybe you're thinking, "Have you tested this code properly?" Well, I used a similar version of this code inside a game called Deliverace. It's not available on Steam anymore, but this code works.
If you have any questions, suggestions, or issues, you can use the Issues area.
You can contribute by opening a pull request. Together, we can help a lot of developers implement in-game purchases.