I can successfully show the Google payment prompt and make a payment, but none of the purchase_success
, purchase_fail
, or purchase_cancel
functions are called. What am I doing wrong?
extends Node
# class member variables go here, for example:
# var a = 2
# var b = "textvar"
var payment = null
func is_available():
return payment!=null
func _ready():
if Engine.has_singleton("GodotPayments"):
payment = Engine.get_singleton("GodotPayments")
if payment:
DebugScreen.d("payments supported")
#payment.setPurchaseCallbackId(get_instance_ID())
payment.setPurchaseCallbackId(null)
else:
DebugScreen.d("payments not supported")
# Called every time the node is added to the scene.
# Initialization here
pass
func purchase(item_name):
if payment:
DebugScreen.d("purchase " + item_name)
# transaction_id could be any string that used for validation internally in java
payment.purchase(item_name, "transaction_id")
else:
DebugScreen.d("iap unavailable")
#func purchase_success(receipt, signature, sku):
# DebugScreen.d("purchase_success : " + str(sku))
# emit_signal("purchase_success", sku)
func purchase_fail():
DebugScreen.d("purchase_fail")
#emit_signal("purchase_fail")
func purchase_cancel():
DebugScreen.d("purchase_cancel")
#emit_signal("purchase_cancel")
func purchase_owned(sku):
DebugScreen.d("purchase_owned : " + str( sku))
#emit_signal("purchase_owned", sku)
#func _process(delta):
# # Called every frame. Delta is time since last frame.
# # Update game logic here.
# pass