Good morning. I don't understand how I could handle a purchase in my game.
I tried to do everything according to the documentation, but the purchase does not work.
I added the product to Google Play Console.
I added "
com.android.vending.BILLING" permisson to my project in
Project -> Export -> Android -> Permissions -> Custom Permissions .
I added an iap file from github Godot and I set it up as an autoload in
Project -> Project Settings -> AutLoad. It is this file https://github.com/godotengine/godot-demo-projects/blob/master/misc/android_iap/iap.gd
I can normally use references by typing
iap in any file.
Could someone show me how to make a in game purchase with Godot?
When I click the " BUY" button, I have this script
func _on_Buy_50_pressed(): # Button pressed
iap.connect("purchase_success", self, "purchase_success_callback") # Connect
iap.purchase("50gold") # Buy item with id=50gold
And this is my purchasesuccesscallback(item) function
GOLD += 50
print(item + " has purchased")
$CURRENT_ITEM/ITEM_NAME.value = item
$CURRENT_GOLD/GOLD_VALUE.value = GOLD
Could someone show me how to do it right?