godot-sdk-integrations / godot-google-play-billing

Godot Android plugin for the Google Play Billing library
MIT License
160 stars 50 forks source link

Query of an array does not seem to work #48

Closed Chrompower closed 1 year ago

Chrompower commented 1 year ago

Hello everybody, when I am trying to query an array of SKUs, it does not work.

This is my array: onready var googleSkuArray = ["tailskin1","tailskin2","tailskin3"]

This is how I am trying to query the SKUs:

    func _on_connected():
        print ("Connection successful")
        payment.querySkuDetails([googleSkuArray], "inapp")`

This is my code for a completed query:

    func _on_product_details_query_completed(sku_details):` 
        print ("SKU QUERY SUCCESSFUL")
        for available_sku in sku_details:
            var sku_id = available_sku["id"]
            print ("available sku = ", sku_id)
            print(available_sku)

The "SKU QUERY SUCCESSFUL" gets printed, but nothing else. If I then try to buy an item with: payment.purchase(tailskinx)

It does not work, nothing happens. If I query only one item with: payment.querySkuDetails([tailskinx], "inapp")

... everything works fine.

According to the docs (https://docs.godotengine.org/en/stable/tutorials/platform/android/android_in_app_purchases.html), it should be possible to query an array of strings.

Am I doing something wrong? Or is this a bug? I would appreciate any help!

NianoTT commented 1 year ago

You do ([googleSkuArray], "inapp") but googleSkuArray is ["tailskin1","tailskin2","tailskin3"] so you end up with ([["tailskin1","tailskin2","tailskin3"]], "inapp") - thats one array too much.

As it's already an array, just (googleSkuArray, "inapp") should work.

Chrompower commented 1 year ago

Hello Niano,

yes, that was the problem. I am dumb.

Thank you very much <3