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

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

Play Billing Library plugin 1.1 patch for PBL v4 #25

Closed natetrost closed 3 years ago

natetrost commented 3 years ago

Play Billing Library plugin 1.1 patch notes

This patch updates the plugin to use the latest 4.0 release of the Play Billing Library. It includes adjustments to account for API changes and adds some missing functionality to the plugin.

API Changes

The Play Billing Library has deprecated the queryPurchases function and replaced it with queryPurchasesAsync. The queryPurchases method of the plugin has changed as a result. Instead of directly returning the Dictionary purchases object, it is now sent as a parameter of the query_purchases_response signal which fires when queryPurchasesAsync completes.

Feature additions

Purchase Dictionary

The Purchase dictionary contains two new keys:

Obfuscated id parameters

Methods to set obfuscated profile and account id information have been added: setObfuscatedAccountId setObfuscatedProfileId Both take a single string parameter that may not be greater than 64 characters. If set, the obfuscated data will be attached to the purchase parameter data.

Billing resume

The plugin now sends a billing_resume signal when the plugin receives a resume event. Best practice is to recheck for purchases on a resume to handle purchases that may have occurred or changed from pending while outside the app.

Connection state

A getConnectionState method has been added to retrieve the ConnectionState value of the Play Billing Library.

Update subscriptions

An updateSubscription method has been added to launch the subscription flow to upgrade or downgrade an existing subscription. The method returns a status dictionary matching the format returned by `purchase. The method takes three parameters:

Subscription price change confirmation

A confirmPriceChange method has been added to launch the subscription price change confirmation flow. It takes a single parameter: the Sku (product ID) of the affected subscription. The method returns a status dictionary that matches the format used by purchase. The result of the confirmation is sent using the price_change_acknowledged signal which returns the BillingResult.getResponseCode() result as a parameter.

timoschwarzer commented 3 years ago

cc @m4gr3d