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

Upgrade to Billing Library 6.0.1 #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rmoehn
Copy link

@rmoehn rmoehn commented Oct 24, 2023

It's required for Android 14. (Although 5.0.0 worked fine on my test device in a debug build. Maybe it's a restriction enforced by Google Play.) It's largely backwards-compatible. I didn't find anything in https://developer.android.com/google/play/billing/release-notes that would break this plugin. So go for it.

It's required for Android 14. (Although 5.0.0 worked fine on my test
device in a debug build. Maybe it's a restriction enforced by Google
Play.) It's largely backwards-compatible. I didn't find anything in
https://developer.android.com/google/play/billing/release-notes that
would break this plugin. So go for it.
@maroniee
Copy link

Unfortunately v5.0 is not accepted in google play store. When I update to 5.2.1 or 6.0.1 I got error like below
E Uncaught exception from plugin java.lang.IllegalStateException: Can't start async operation (launchPurchaseFlow) because another async operation(refresh inventory) is in progress. at com.alexdisler.inapppurchases.IabHelper.flagStartAsync(IabHelper.java:838) at com.alexdisler.inapppurchases.IabHelper.launchPurchaseFlow(IabHelper.java:460) at com.alexdisler.inapppurchases.InAppBillingV6.runPayment(InAppBillingV6.java:290) at com.alexdisler.inapppurchases.InAppBillingV6.buy(InAppBillingV6.java:300) at com.alexdisler.inapppurchases.InAppBillingV6.execute(InAppBillingV6.java:192) at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:100) at org.apache.cordova.PluginManager.exec(PluginManager.java:148) at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59) at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:335) at android.os.Looper.loopOnce(Looper.java:162) at android.os.Looper.loop(Looper.java:294) at android.os.HandlerThread.run(HandlerThread.java:67) I [INFO:CONSOLE(131)] "Can't start async operation (launchPurchaseFlow) because another async operation(refresh inventory) is in progress.", source: https://localhost/js/buy.js (131)

@rmoehn
Copy link
Author

rmoehn commented Oct 30, 2023

Are you sure this is caused by the upgrade? The above error message would also be a symptom of overlapping JavaScript calls. Eg. if you do:

inAppPurchase.getProducts([])
inAppPurchase.buy()

This would attempt to start the buy operation while the getProducts operation is still in progress, which would result in the above error message, I think. Rather, you have to await the result of the first operation:

await inAppPurchase.getProducts([])
await inAppPurchase.buy()

@maroniee
Copy link

Sorry I forgot about it, after many tests.
Now after call getProducts before buy there is no error, but nothing happens. Logs as below
``
google.payments Helper D onPDR: Response Code: OK, Debug Message: []
google.payments Helper D onPDR: []
google.payments Helper D listener: subs[]
google.payments Helper D oqapf onAllProcessed: true false
google.payments Helper D onPDR: Response Code: OK, Debug Message: [ProductDetails{jsonString='{"productId":"full","type":"inapp","title":"Unlock full version","name":"Unlock full version","description":"Unlock full version to complete rest of levels","localizedIn":["en-US"],"skuDetailsToken":"secret","oneTimePurchaseOfferDetails":{"priceAmountMicros":19990000,"priceCurrencyCode":"EUR","formattedPrice":"EUR 19.99"}}', parsedJson={"productId":"full","type":"inapp","title":"Unlock full version","name":"Unlock full version","description":"Unlock full version to complete rest of levels","localizedIn":["en-US"],"skuDetailsToken":"secret","oneTimePurchaseOfferDetails":{"priceAmountMicros":19990000,"priceCurrencyCode":"EUR","formattedPrice":"EUR 19.99"}}, productId='full', productType='inapp', title='Unlock full version', productDetailsToken='secret, subscriptionOfferDetails=null}]

google.payments Helper D onPDR item: ProductDetails{jsonString='{"productId":"full","type":"inapp","title":"Unlock full version","name":"Unlock full version","description":"Unlock full version to complete rest of levels","localizedIn":["en-US"],"skuDetailsToken":"secret","oneTimePurchaseOfferDetails":{"priceAmountMicros":19990000,"priceCurrencyCode":"EUR","formattedPrice":"EUR 19.99"}}', parsedJson={"productId":"full","type":"inapp","title":"Unlock full version","name":"Unlock full version","description":"Unlock full version to complete rest of levels","localizedIn":["en-US"],"skuDetailsToken":"secret","oneTimePurchaseOfferDetails":{"priceAmountMicros":19990000,"priceCurrencyCode":"EUR","formattedPrice":"EUR 19.99"}}, productId='full', productType='inapp', title='Unlock full version', productDetailsToken='secret', subscriptionOfferDetails=null}

google.payments Helper D onPDR isd origin: IabSkuDetails mSku: full mType: inapp mPrice: EUR 19.99 mPriceCurrency: EUR mPriceAsDecimal: 19.99 mPriceRaw: 19.99 mTitle: Unlock full version mDescription: Unlock full version to complete rest of levels

google.payments Helper D onPDR: [IabSkuDetails mSku: full mType: inapp mPrice: EUR 19.99 mPriceCurrency: EUR mPriceAsDecimal: 19.99 mPriceRaw: 19.99 mTitle: Unlock full version mDescription: Unlock full version to complete rest of levels
]
google.payments Helper D listener: inapp[IabSkuDetails mSku: full mType: inapp mPrice: EUR 19.99 mPriceCurrency: EUR mPriceAsDecimal: 19.99 mPriceRaw: 19.99 mTitle: Unlock full version mDescription: Unlock full version to complete rest of levels
]
google.payments Helper D isd: IabSkuDetails mSku: full mType: inapp mPrice: EUR 19.99 mPriceCurrency: EUR mPriceAsDecimal: 19.99 mPriceRaw: 19.99 mTitle: Unlock full version mDescription: Unlock full version to complete rest of levels

google.payments Helper D oqapf onAllProcessed: true true
google.payments Helper D Ending async operation: refresh inventory
google.payments D executing on androidbuy
google.payments D runPayment
google.payments D runPayment: full
google.payments D runPayment subscribe: false
google.payments Helper D Starting async operation: launchPurchaseFlow
google.payments Helper D launchPurchaseFlow:full inapp
Finsky com.android.vending I [421] lcb.a(441): : Account from first account - [secret]
Finsky com.android.vending I [421] lcb.a(1104): Billing preferred account via installer for : [secret]
``
But when actual library was 5.0 it was working
I don't know why the window from Google Play Store for charging the fee doesn't appear

@rmoehn
Copy link
Author

rmoehn commented Oct 30, 2023

I'm sorry, I don't know what is wrong based on this limited amount of information.

@maroniee
Copy link

maroniee commented Nov 1, 2023

@rmoehm take a look at https://github.com/cozycodegh/cordova-plugin-inapppurchases
It uses 6.0.1 Library and it's easy to convert. I uploaded my app to Google Play Store and it's working as before

@rmoehn
Copy link
Author

rmoehn commented Nov 1, 2023

Nice! I think I'll stick with the original as long as it's working for me.

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 this pull request may close these issues.

2 participants