Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google requiring Google Play Billing Library version 6 or newer #65

Open
flaming-toast opened this issue May 28, 2024 · 48 comments · May be fixed by #67
Open

Google requiring Google Play Billing Library version 6 or newer #65

flaming-toast opened this issue May 28, 2024 · 48 comments · May be fixed by #67

Comments

@flaming-toast
Copy link

flaming-toast commented May 28, 2024

Hello!

Got this message just today on Google Play Console, it looks like this plugin will need to be upgraded to a newer version of the Google Play Billing library by August 24th if I'm not mistaken?

image

@flaming-toast flaming-toast changed the title Google requiring upgrading to Google Play Billing Library version 6 or newer Google requiring Google Play Billing Library version 6 or newer May 28, 2024
@Veradictus
Copy link

+1 needed please

@ArcanaCorvus
Copy link

We got the same message, hopefully it's a fairly easy fix

@dalvaren
Copy link

+1 needed

@Veradictus
Copy link

We got the same message, hopefully it's a fairly easy fix

I think depending on how much the API has changed, I will probably attempt it today to upgrade it and see if it explodes in my face.

@Veradictus
Copy link

I have no way of testing this at the moment since I am still working on my in-app purchases for my game, is anyone available to check:

https://github.com/Kaetram/godot-google-play-billing

@BlitBlatGames
Copy link

@Veradictus I successfully built the .aarfile and compiled the app. So, so far so good! I've sent the app to Google for review, will let you know it how it goes once it's approved. Thanks for your the help on this!

@BlitBlatGames
Copy link

It's been approved by Google, so that's a good sign, but it doesn't seem to be working 100% yet.

It seems the signal sku_details_query_completed is now product_details_query_completed and item.sku is now item.productId

These aren't problems, but what is a problem is that payment.queryProductDetails(["name0", "name1], "inapp") now only returns details for name0 instead of everything in that array.

I'll keep investigating.

@BlitBlatGames
Copy link

BlitBlatGames commented May 31, 2024

https://github.com/Kaetram/godot-google-play-billing/blob/master/godot-google-play-billing/src/main/java/org/godotengine/godot/plugin/googleplaybilling/GodotGooglePlayBilling.java#L133

That section there needs to be updated to not just get the first product only. This gets all the items in one call:


		ArrayList<QueryProductDetailsParams.Product> productList = new ArrayList<QueryProductDetailsParams.Product>();
		for (String productId : productIdList) {
		    QueryProductDetailsParams.Product product = QueryProductDetailsParams.Product.newBuilder()
                    .setProductId(productId)
                    .setProductType(type)
                    .build();
            productList.add(product);
        }

		QueryProductDetailsParams params = QueryProductDetailsParams.newBuilder()
            .setProductList(productList)
            .build();

I'm not a Java developer (and I really don't like the language, don't @ me!) so there might be a better way of doing this, but so far it seems to be working.

@Veradictus
Copy link

Veradictus commented Jun 1, 2024

BlitBlatGames

Solid, will try to fix it. I'm starting in-app purchases for my game today so I will update further as needed, and once the game is published on the Play Store and transactions work as intended, I will create a PR into this repo.

@777Pixels
Copy link

777Pixels commented Jun 4, 2024

I think this should fix your last problem...
At least on my side, it fixes some issue I got.
I have taken some code from the godot master branch.

check for the <<<<<<<<<<<<<<<<<<<<<<<<<

	public static Dictionary convertPurchaseToDictionary(Purchase purchase) {
		Dictionary dictionary = new Dictionary();
		dictionary.put("original_json", purchase.getOriginalJson());
		dictionary.put("order_id", purchase.getOrderId());
		dictionary.put("package_name", purchase.getPackageName());
		dictionary.put("purchase_state", purchase.getPurchaseState());
		dictionary.put("purchase_time", purchase.getPurchaseTime());
		dictionary.put("purchase_token", purchase.getPurchaseToken());
		dictionary.put("quantity", purchase.getQuantity());
		dictionary.put("signature", purchase.getSignature());
		// PBL V4 replaced getSku with getSkus to support multi-sku purchases,
		// use the first entry for "sku" and generate an array for "skus"
		// BUG ArrayList<String> skus = purchase.getSkus();    <<<<<<<<<<<<<<<<<<<<<<
		// BUG dictionary.put("sku", skus.get(0));             <<<<<<<<<<<<<<<<<<<<<<
		// BUG String[] skusArray = skus.toArray(new String[0]); <<<<<<<<<<<<<<<<<<<<<<
		// BUG dictionary.put("skus", skusArray);
		String[] products = purchase.getProducts().toArray(new String[0]);	// NEW <<<<<<<<<<<<<<<<<<<<<<
		dictionary.put("products", products);					// NEW<<<<<<<<<<<<<<<<<<<<<<
		dictionary.put("is_acknowledged", purchase.isAcknowledged());
		dictionary.put("is_auto_renewing", purchase.isAutoRenewing());
		return dictionary;
	}

@Veradictus
Copy link

I think this should fix your last problem... At least on my side, it fixes some issue I got. I have taken some code from the godot master branch.

check for the <<<<<<<<<<<<<<<<<<<<<<<<<

	public static Dictionary convertPurchaseToDictionary(Purchase purchase) {
		Dictionary dictionary = new Dictionary();
		dictionary.put("original_json", purchase.getOriginalJson());
		dictionary.put("order_id", purchase.getOrderId());
		dictionary.put("package_name", purchase.getPackageName());
		dictionary.put("purchase_state", purchase.getPurchaseState());
		dictionary.put("purchase_time", purchase.getPurchaseTime());
		dictionary.put("purchase_token", purchase.getPurchaseToken());
		dictionary.put("quantity", purchase.getQuantity());
		dictionary.put("signature", purchase.getSignature());
		// PBL V4 replaced getSku with getSkus to support multi-sku purchases,
		// use the first entry for "sku" and generate an array for "skus"
		// BUG ArrayList<String> skus = purchase.getSkus();    <<<<<<<<<<<<<<<<<<<<<<
		// BUG dictionary.put("sku", skus.get(0));             <<<<<<<<<<<<<<<<<<<<<<
		// BUG String[] skusArray = skus.toArray(new String[0]); <<<<<<<<<<<<<<<<<<<<<<
		// BUG dictionary.put("skus", skusArray);
		String[] products = purchase.getProducts().toArray(new String[0]);	// NEW <<<<<<<<<<<<<<<<<<<<<<
		dictionary.put("products", products);					// NEW<<<<<<<<<<<<<<<<<<<<<<
		dictionary.put("is_acknowledged", purchase.isAcknowledged());
		dictionary.put("is_auto_renewing", purchase.isAutoRenewing());
		return dictionary;
	}

Awesome, I haven't had any time to update my code, much appreciated!

@777Pixels
Copy link

Just found another issue in another file ( GodotGooglePlayBilling.java )
I'm not a java developper, so my code may not be optimal.
But now, I can see my item prices.


@UsedByGodot
	public void queryProductDetails(final String[] list, String type) {
		List<String> productIdList = Arrays.asList(list);

		List<QueryProductDetailsParams.Product> productList = new ArrayList<>();
		for(String productId : productIdList )
		{
			productList.add(  QueryProductDetailsParams.Product.newBuilder()
            					.setProductId(productId)
            					.setProductType(type)
            					.build());
		}
		//QueryProductDetailsParams.Product product = QueryProductDetailsParams.Product.newBuilder()
        //    .setProductId(productIdList.get(0))
        //    .setProductType(type)
        //    .build();

		QueryProductDetailsParams params = QueryProductDetailsParams.newBuilder()
            .setProductList(productList) // Arrays.asList(product))
            .build();

            ...           

@201949
Copy link

201949 commented Jun 5, 2024

If anyone is interested, here is the repository of the working plugin that I prepared for using Google Play Billing Library version 6.2.1 on Android for Godot 3.5.2
(https://github.com/201949/godot-google-play-billing-6)

@flaming-toast
Copy link
Author

@201949 You're amazing, thank you so much for this! 🚀 Would you consider making a pull request so that upstream may benefit from it as well? 😊

@akien-mga Hi Rémi! I'm so sorry for the ping, you must have a lot on your plate.. 😭 But I'm not entirely sure who the maintainer of this repository is, and l wanted to at least let someone know about the current situation with this plugin as the Aug 31st deadline will be coming up soon 🙇🏻‍♀️🙇🏻‍♀️ Thank you so much for your attention 🙏

@201949
Copy link

201949 commented Jun 10, 2024

@201949 You're amazing, thank you so much for this! 🚀 Would you consider making a pull request so that upstream may benefit from it as well? 😊

@flaming-toast I attempted to transition to Google Play Billing Library version 7 using the existing official upstream plugin, but I was unsuccessful, just as I was with the transition to version 6. Therefore, to address the need for organizing one-time purchases in my existing applications with the outdated library, I created my own solution, guided by official sources on the Google Play Billing Library. Additionally, I have now implemented support for subscriptions and made it publicly available. Here is the Release 6.2.1 with subs

@flaming-toast
Copy link
Author

@201949 This is awesome! Thank you so much for updating and even improving on the plugin! Since this official repository seems unmaintained now, I'll try migrating to your plugin, will let you know if I run into any issues 🙇🏻‍♀️ Thank you!

@dgsdestinygamestudios
Copy link

https://github.com/dgsdestinygamestudios/godot-google-play-billing/tree/main
v2 plugin structure, tested on Godot 4.2. Just for android though. If you use, please let me know.

@201949
Copy link

201949 commented Jun 11, 2024

https://github.com/dgsdestinygamestudios/godot-google-play-billing/tree/main v2 plugin structure, tested on Godot 4.2. Just for android though. If you use, please let me know.

@dgsdestinygamestudios I'm very happy for you that you managed to build the plugin for the new v2 structure. I hope you will share the source code soon so that we can see your implementation of the methods for working with the Google Play Billing Library. I hope that my solutions have also helped you in your implementation.

@dgsdestinygamestudios
Copy link

dgsdestinygamestudios commented Jun 12, 2024

@201949 thank you. Given that Billing library 6 won't be a long-term fix, I figured I should try to go for 7. I've shared java part of the things. If you see anything wrong, feel free to help. Also yes, I've extensively read your code, Remi's code and the documentation to understand what is going on, so thank you.

@code-with-max
Copy link

code-with-max commented Jun 16, 2024

I've created an new addon for the Godot 4.2 that integrates with Google Play Billing Library version 7. This module supports all the public functions provided by the library, handles all error codes, and can work with different pricing plans within subscriptions.

You can check it out here: https://github.com/code-with-max/godot-google-play-iapp

I hope this addon helps you with your projects. Feedback and contributions are welcome!

Happy coding!

@Krigu
Copy link

Krigu commented Jun 17, 2024

@code-with-max Do you plan to create a PR and merge it back with the offical plugin?

@code-with-max
Copy link

@code-with-max Do you plan to create a PR and merge it back with the offical plugin?

I'm not sure I can do this for several reasons:

@Shay-M
Copy link

Shay-M commented Jun 20, 2024

@code-with-max
Thanks for the update, but when I try to use the new version it gives me an error:
Please ensure the app is signed correctly.",
"response_code": 5

(the old version works for me)

And according to a Google search it says:
code 5: BILLING_RESPONSE_RESULT_DEVELOPER_ERROR: Invalid arguments provided to the API. This error can also indicate that the application was not correctly signed or properly set up for In-app Billing in Google Play, or does not have the necessary permissions in its manifest

I see that it gets the product names but when you click on purchase it gives this error.

@code-with-max
Copy link

code-with-max commented Jun 21, 2024

@Shay-M
Write an example of your request.

@dgsdestinygamestudios
Copy link

@code-with-max Thanks for the update, but when I try to use the new version it gives me an error: Please ensure the app is signed correctly.", "response_code": 5

(the old version works for me)

And according to a Google search it says: code 5: BILLING_RESPONSE_RESULT_DEVELOPER_ERROR: Invalid arguments provided to the API. This error can also indicate that the application was not correctly signed or properly set up for In-app Billing in Google Play, or does not have the necessary permissions in its manifest

I see that it gets the product names but when you click on purchase it gives this error.

Check your debug and release keystores.

Project > Export > select Android > scroll down until you see keystores > assign

@Shay-M
Copy link

Shay-M commented Jun 21, 2024

Thank you for the quick reply:

@dgsdestinygamestudios
In the old version I only had Release and it worked.
Now I also added it to Debug and it still doesn't work.

@code-with-max
I used the code of the example :

GooglePlayBilling.do_purchase("remove_ads")
func do_purchase(id: String, is_personalized: bool = false): billing.purchase([id], is_personalized)

And of course I changed it:
const ITEM_ACKNOWLEDGED: Array = [ "remove_ads" ]

image

AndroidIAPP singleton loaded
Billing: start connection
Billing successfully connected
"remove_ads"
"remove_ads"
{
"debug_message": "Please ensure the app is signed correctly.",
"response_code": 5
}

@dgsdestinygamestudios
Copy link

dgsdestinygamestudios commented Jun 21, 2024

Thank you for the quick reply:

@dgsdestinygamestudios In the old version I only had Release and it worked. Now I also added it to Debug and it still doesn't work.

@code-with-max I used the code of the example :

GooglePlayBilling.do_purchase("remove_ads") func do_purchase(id: String, is_personalized: bool = false): billing.purchase([id], is_personalized)

And of course I changed it: const ITEM_ACKNOWLEDGED: Array = [ "remove_ads" ]

image

AndroidIAPP singleton loaded Billing: start connection Billing successfully connected "remove_ads" "remove_ads" { "debug_message": "Please ensure the app is signed correctly.", "response_code": 5 }

Then check your AndroidManifest file and unique name. Make sure you enter the unique name of your game. example: com.example.$genname

@Shay-M
Copy link

Shay-M commented Jun 21, 2024

Yes, I have in the settings:
image

@dgsdestinygamestudios
Copy link

Did you publish an internal testing with this build? Billing library needs latest aab to work.

Yes, I have in the settings: image

@code-with-max
Copy link

@dgsdestinygamestudios
@Shay-M
I make new versions of plug-in achieve with separated "release" and "debug" versions. In fact, the differences between them are minimal, but I want to eliminate all errors.

https://github.com/code-with-max/godot-google-play-iapp/releases/tag/v1.2

@Shay-M
Copy link

Shay-M commented Jun 22, 2024

@dgsdestinygamestudios
@code-with-max
Ok, I will try and update with the new version + through internal testing

In the previous version, I did the run through godot and a physical connection of my device (this is how it worked)

@Shay-M
Copy link

Shay-M commented Jun 25, 2024

Nice it works :) But It only works for me only from the google store.
The question is what can be done that will also work in lectures with the physical connection of the device? while debugging

@code-with-max
Copy link

@Shay-M
I'm sorry, I don't really understand.
Do you want to use this plugin for an application that does not use the Google Store?

@Shay-M
Copy link

Shay-M commented Jun 25, 2024

@code-with-max Ah sorry I didn't explain myself.
When I upload the app to the store and run it from there it works.
But when I run it from godot (when I connect the device physically so I can check that everything works - debug locally) it still gives the error response_code": 5

@201949
Copy link

201949 commented Jun 25, 2024

As I understand your conversation, you need to register the payment tester in the Google Developer Console. Settings -> License testing. Otherwise, payment testing will have to be carried out in a published application with a real payment method. Or did I misunderstand the conversation?
I will add that essentially, in-app payments can only be tested using the release-signed APK file (the one we upload to the Google Play console).
https://developer.android.com/google/play/billing/test

@code-with-max
Copy link

@201949 @Shay-M
Don`t forget put license key in special field on Godot export options

@Shay-M
Copy link

Shay-M commented Jun 27, 2024

Hi, thank you for your help!
I found a solution to the problem:
"Clear you cache from the google play store account. 😶

https://stackoverflow.com/questions/73025919/google-play-billing-library-5-purchase-flow-fails-but-response-code-indicates-su

I believe that now everything will work

@davekaa
Copy link

davekaa commented Jul 27, 2024

@201949 I'm trying to use your Google Play Billing Library 6.2.1, but when I export my game and test it on device through an internal test, the app crashes after 2 seconds. In your code, the _on_connected() function first starts a 2s timer, so my guess is that whatever happens after crashes the app, I just don't know what.. Have you got any idea? I just copied your code without changes. The app seems to work fine for the first 2 seconds.

EDIT:
I think I just fixed my own issue. I noticed in Google Play Console that the app needed permission for internet. In the Godot export dialog I checked internet and now it seems to work. For if anyone stumbles on the same problem.

@davekaa
Copy link

davekaa commented Jul 28, 2024

@201949 First of all, thank you for making the Google Play Billing 6.2.1 plugin! It was really needed.

Would it be possible to add more documentation/notes it? I'm trying to work with it now but there is a lot of code that I don't know the purpose/workings of. It would be helpful to me and other people who use your code to have some sort of helping hand.

@kyoz
Copy link

kyoz commented Jul 29, 2024

@dalvaren what Godot version are you using? You should give this pr a try. Although it's still not complete but it work for me with basic using. Of course if you're upgrade from a very old version you have to update something.

These signal changed:

		payment.connect("sku_details_query_completed", self, "_on_product_details_query_completed") # SKUs (Dictionary[])
		payment.connect("sku_details_query_error", self, "_on_product_details_query_error") # Response ID (int), Debug message (string), Queried SKUs (string[]

Also replace all .id to .sku

It should work for now.

@davekaa
Copy link

davekaa commented Jul 30, 2024

@kyoz DO you know if that PR also works for Godot 3.5.3?

@kyoz
Copy link

kyoz commented Jul 30, 2024

I'm using it for all of my games now, yes of course that pr is still not completely complete, but if your usecase is simple like me, just allow user to purchase an item, it should work fine.

Here is the build for 3.5.3 which i've built and used:

GodotGooglePlayBilling-v7-3.5.3.zip

You can give it a try.

@davekaa
Copy link

davekaa commented Aug 4, 2024

@201949 Just wanted to let you know that I got everything working thanks to your plugin! Thank you so much for your effort.

I do have 1 question. Does Android/Google have something like a "Restore purchases" feature like in iOS? And if so, does your plugin support that?

EDIT: Asked if I could donate but I found the button in GitHub.

@durdenk
Copy link

durdenk commented Aug 11, 2024

I have projects using at 4.2.1 and 4.3,

How I am going to update to version Google Play Billing Library version 6.0.1 ?

Thanks

@AlecAcosta
Copy link

Starting tomorrow, our game updates will be rejected unless we update the billing plugin. Do we have any updates on when the plugin will be compatible with the new requirements?

@davekaa
Copy link

davekaa commented Aug 31, 2024

Starting tomorrow, our game updates will be rejected unless we update the billing plugin. Do we have any updates on when the plugin will be compatible with the new requirements?

I used the plugin made by @201949 and solved this problem for my game. Good luck!

@wargaming0009
Copy link

Starting tomorrow, our game updates will be rejected unless we update the billing plugin. Do we have any updates on when the plugin will be compatible with the new requirements?

I used the plugin made by @201949 and solved this problem for my game. Good luck!

Hi Is this compatible with godot 4.3?

@201949
Copy link

201949 commented Sep 26, 2024

Hi @wargaming0009,

Yes, my plugin also works in Godot 4.3, but at the moment I have not prepared a corresponding release. However, you can rebuild my plugin for the Godot 4.3 library. In this case, you will need to make some changes to your gdscript singleton to match the correct syntax of the new Godot 4.3 version.

If you need a working plugin for the Godot 4.X branch, try using the following plugin:
AndroidIAPP Godot Plugin by @code-with-max

Hope this helps you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.