The platform provides an easy way to enable IAP for the games you launch here, but you still need to do some work in the game to
I'll be covering the details of how you can do this if you are building a game for this platform using Godot engine.
I assume that you know the following
If you didn't know, Godot has a node for pretty much everything.. and yes there is one for making an HTTP Request this is going to be very handy for our purpose of checking if an item is bought by the user or not.
The above screenshot shows an example scene setup with HTTPRequest node added.
Once you have setup a scene with HTTPRequest node, you can add a script to the root of the scene and add the following code.
func _ready() var headers = ["auth_token: <Auth Token>"] #https://play.idevgames.co.uk #item check url for store item. var url = "https://play.idevgames.co.uk/request/check/xxxxxxxxxx" var http_request = $HTTPRequest #add HTTPRequest node to your scene. http_request.connect("request_completed", self, "_on_request_completed") http_request.request(url, headers) func _on_request_completed(result, response_code, headers, body): if body.get_string_from_utf8() == "true": print("Purchased") else: print("Not purchased")
We are basically making an http request and parsing the response to check if its' true or not. If the response is true it means that the user has bought the item and you can enable it to be used in-game.
When you enable IAP for you game, the platform automatically adds a "GameShop" button as an overlay for the game (check screenshot below)
When you click on that button you will be able see something like this
So that's how you integrate IAP from idevgames platform into your Godot game, hope this was helpful to you.
Back to top