j3k0 / cordova-plugin-purchase

In-App Purchase for Cordova on iOS, Android and Windows
https://purchase.cordova.fovea.cc
1.3k stars 537 forks source link

[Android] Unable to consume product: No virtual method setDeveloperPayload #1128

Closed jorisbertomeu closed 1 year ago

jorisbertomeu commented 3 years ago

system info

Ionic:
   Ionic CLI                     : 6.11.8 (~/.nvm/versions/node/v12.18.4/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.3.3
   @angular-devkit/build-angular : 0.1000.8
   @angular-devkit/schematics    : 10.0.8
   @angular/cli                  : 10.0.8
   @ionic/angular-toolkit        : 2.3.3
Plugin:
   cordova-plugin-purchase      :  10.4.0
   @ionic-native/in-app-purchase-2   :   5.29.0

Capacitor:
   Capacitor CLI   : 2.4.1
   @capacitor/core : 2.4.2
Utility:
   cordova-res (update available: 0.15.2) : 0.15.1
   native-run (update available: 1.2.2)   : 1.1.0
System:
   NodeJS : v12.18.4 (~/.nvm/versions/node/v12.18.4/bin/node)
   npm    : 6.14.6
   OS     : macOS Big Sur 11.0.1
   Android Studio : 4.0.1
   Hardware : Samsung SM-T510
   Android : 10, September 1st 2020 Security update

Expected behavior

Simple order product process ..

Observed behavior

When I consume a product, popup for payment is opening, I pay with success then Gpay popup closes itself and an error popup with a syntax error is shown : https://www.icloud.com/photos/#0dZT5ktO3hhkNOa0FsY-qRSzg

I have following logs when issue happen:

W/BillingHelper: Couldn't find purchase lists, trying to find single data.
D/CordovaPurchase: onPurchasesUpdated() -> Success
D/CordovaPurchase: sendToListener() -> purchasesUpdated
D/CordovaPurchase:             data -> {"purchases":[{"orderId":"GPA.3300-8647-6799-79803","packageName":"fr.ics.edl.jbertomeu","productId":"edls_pack_1","purchaseTime":1605609558987,"purchaseState":0,"purchaseToken":"fibibcopioifhgocogdikdcf.AO-J1OwzMwDhKtS5c6iGRvJEBg6_vS_bDc0Gk47_L94Pgt_MzhBpOs5KLChyEBxlnGSShhKBdjmD0c3M_xFsGAprPEUehxuncw","acknowledged":false,"getPurchaseState":1,"autoRenewing":false,"signature":"gFMk+FH6\/HZNTSyaeM3WVJOCj0sjghT4UWbWuTxFn1cqXwj6OWzexsg89uDLz+gNtV\/L9cFgJur3Sh4ADFxXWKethfEk7S3jP2POfeODd\/vEdjdGzIELDPDxjhJ6H0pztskqaGL3ED5wCCJzJfmsk2kUe125w5R4J+f\/FRR3r\/uE1LZ9T0oSyFSdrG\/fPOgoN\/vMLUzK6amShnnlAFISlA84iId3w0UiBxkdAHW39qTW2gLSjYt2g6yS2WX9uDw3d05TcCbUpyjWwSOnHMANEs6qISRhrAteaPPBXjYVJ5ihzYL9ke0xp8MaWEQk+doJq+NeKPjUtSJi5bezUW2Xzg==","receipt":"{\"orderId\":\"GPA.3300-8647-6799-79803\",\"packageName\":\"fr.ics.edl.jbertomeu\",\"productId\":\"edls_pack_1\",\"purchaseTime\":1605609558987,\"purchaseState\":0,\"purchaseToken\":\"fibibcopioifhgocogdikdcf.AO-J1OwzMwDhKtS5c6iGRvJEBg6_vS_bDc0Gk47_L94Pgt_MzhBpOs5KLChyEBxlnGSShhKBdjmD0c3M_xFsGAprPEUehxuncw\",\"acknowledged\":false}"}]}
I/Capacitor/Console: File: capacitor-runtime.js - Line 11108 - Msg: [store.js] DEBUG: product data -> for edls_pack_1
I/Capacitor/Console: File: capacitor-runtime.js - Line 11108 - Msg: [store.js] DEBUG:              -> "OK"
I/Capacitor/Console: File: capacitor-runtime.js - Line 11888 - Msg: InAppBilling[js]: listener: {"type":"purchasesUpdated","data":{"purchases":[{"orderId":"GPA.3300-8647-6799-79803","packageName":"fr.ics.edl.jbertomeu","productId":"edls_pack_1","purchaseTime":1605609558987,"purchaseState":0,"purchaseToken":"fibibcopioifhgocogdikdcf.AO-J1OwzMwDhKtS5c6iGRvJEBg6_vS_bDc0Gk47_L94Pgt_MzhBpOs5KLChyEBxlnGSShhKBdjmD0c3M_xFsGAprPEUehxuncw","acknowledged":false,"getPurchaseState":1,"autoRenewing":false,"signature":"gFMk+FH6/HZNTSyaeM3WVJOCj0sjghT4UWbWuTxFn1cqXwj6OWzexsg89uDLz+gNtV/L9cFgJur3Sh4ADFxXWKethfEk7S3jP2POfeODd/vEdjdGzIELDPDxjhJ6H0pztskqaGL3ED5wCCJzJfmsk2kUe125w5R4J+f/FRR3r/uE1LZ9T0oSyFSdrG/fPOgoN/vMLUzK6amShnnlAFISlA84iId3w0UiBxkdAHW39qTW2gLSjYt2g6yS2WX9uDw3d05TcCbUpyjWwSOnHMANEs6qISRhrAteaPPBXjYVJ5ihzYL9ke0xp8MaWEQk+doJq+NeKPjUtSJi5bezUW2Xzg==","receipt":"{\"orderId\":\"GPA.3300-8647-6799-79803\",\"packageName\":\"fr.ics.edl.jbertomeu\",\"productId\":\"edls_pack_1\",\"purchaseTime\":1605609558987,\"purchaseState\":0,\"purchaseToken\":\"fibibcopioifhgocogdikdcf.AO-J1OwzMwDhKtS5c6iGRvJEBg6_vS_bDc0Gk47_L94Pgt_MzhBpOs5KLChyEBxlnGSShhKBdjmD0c3M_xFsGAprPEUehxuncw\",\"acknowledged\":false}"}]}}
I/Capacitor/Console: File: capacitor-runtime.js - Line 11108 - Msg: [store.js] DEBUG: iabPurchasesUpdated: [{"orderId":"GPA.3300-8647-6799-79803","packageName":"fr.ics.edl.jbertomeu","productId":"edls_pack_1","purchaseTime":1605609558987,"purchaseState":0,"purchaseToken":"fibibcopioifhgocogdikdcf.AO-J1OwzMwDhKtS5c6iGRvJEBg6_vS_bDc0Gk47_L94Pgt_MzhBpOs5KLChyEBxlnGSShhKBdjmD0c3M_xFsGAprPEUehxuncw","acknowledged":false,"getPurchaseState":1,"autoRenewing":false,"signature":"gFMk+FH6/HZNTSyaeM3WVJOCj0sjghT4UWbWuTxFn1cqXwj6OWzexsg89uDLz+gNtV/L9cFgJur3Sh4ADFxXWKethfEk7S3jP2POfeODd/vEdjdGzIELDPDxjhJ6H0pztskqaGL3ED5wCCJzJfmsk2kUe125w5R4J+f/FRR3r/uE1LZ9T0oSyFSdrG/fPOgoN/vMLUzK6amShnnlAFISlA84iId3w0UiBxkdAHW39qTW2gLSjYt2g6yS2WX9uDw3d05TcCbUpyjWwSOnHMANEs6qISRhrAteaPPBXjYVJ5ihzYL9ke0xp8MaWEQk+doJq+NeKPjUtSJi5bezUW2Xzg==","receipt":"{\"orderId\":\"GPA.3300-8647-6799-79803\",\"packageName\":\"fr.ics.edl.jbertomeu\",\"productId\":\"edls_pack_1\",\"purchaseTime\":1605609558987,\"purchaseState\":0,\"purchaseToken\":\"fibibcopioifhgocogdikdcf.AO-J1OwzMwDhKtS5c6iGRvJEBg6_vS_bDc0Gk47_L94Pgt_MzhBpOs5KLChyEBxlnGSShhKBdjmD0c3M_xFsGAprPEUehxuncw\",\"acknowledged\":false}"}]
I/Capacitor/Console: File: capacitor-runtime.js - Line 11108 - Msg: [store.js] DEBUG: iabUpdatePurchases: [{"orderId":"GPA.3300-8647-6799-79803","packageName":"fr.ics.edl.jbertomeu","productId":"edls_pack_1","purchaseTime":1605609558987,"purchaseState":0,"purchaseToken":"fibibcopioifhgocogdikdcf.AO-J1OwzMwDhKtS5c6iGRvJEBg6_vS_bDc0Gk47_L94Pgt_MzhBpOs5KLChyEBxlnGSShhKBdjmD0c3M_xFsGAprPEUehxuncw","acknowledged":false,"getPurchaseState":1,"autoRenewing":false,"signature":"gFMk+FH6/HZNTSyaeM3WVJOCj0sjghT4UWbWuTxFn1cqXwj6OWzexsg89uDLz+gNtV/L9cFgJur3Sh4ADFxXWKethfEk7S3jP2POfeODd/vEdjdGzIELDPDxjhJ6H0pztskqaGL3ED5wCCJzJfmsk2kUe125w5R4J+f/FRR3r/uE1LZ9T0oSyFSdrG/fPOgoN/vMLUzK6amShnnlAFISlA84iId3w0UiBxkdAHW39qTW2gLSjYt2g6yS2WX9uDw3d05TcCbUpyjWwSOnHMANEs6qISRhrAteaPPBXjYVJ5ihzYL9ke0xp8MaWEQk+doJq+NeKPjUtSJi5bezUW2Xzg==","receipt":"{\"orderId\":\"GPA.3300-8647-6799-79803\",\"packageName\":\"fr.ics.edl.jbertomeu\",\"productId\":\"edls_pack_1\",\"purchaseTime\":1605609558987,\"purchaseState\":0,\"purchaseToken\":\"fibibcopioifhgocogdikdcf.AO-J1OwzMwDhKtS5c6iGRvJEBg6_vS_bDc0Gk47_L94Pgt_MzhBpOs5KLChyEBxlnGSShhKBdjmD0c3M_xFsGAprPEUehxuncw\",\"acknowledged\":false}"}]
I/Capacitor/Console: File: capacitor-runtime.js - Line 11108 - Msg: [store.js] DEBUG: product data -> for edls_pack_1
I/Capacitor/Console: File: capacitor-runtime.js - Line 11108 - Msg: [store.js] DEBUG:              -> {"orderId":"GPA.3300-8647-6799-79803","packageName":"fr.ics.edl.jbertomeu","productId":"edls_pack_1","purchaseTime":1605609558987,"purchaseState":0,"purchaseToken":"fibibcopioifhgocogdikdcf.AO-J1OwzMwDhKtS5c6iGRvJEBg6_vS_bDc0Gk47_L94Pgt_MzhBpOs5KLChyEBxlnGSShhKBdjmD0c3M_xFsGAprPEUehxuncw","acknowledged":false,"getPurchaseState":1,"autoRenewing":false,"signature":"gFMk+FH6/HZNTSyaeM3WVJOCj0sjghT4UWbWuTxFn1cqXwj6OWzexsg89uDLz+gNtV/L9cFgJur3Sh4ADFxXWKethfEk7S3jP2POfeODd/vEdjdGzIELDPDxjhJ6H0pztskqaGL3ED5wCCJzJfmsk2kUe125w5R4J+f/FRR3r/uE1LZ9T0oSyFSdrG/fPOgoN/vMLUzK6amShnnlAFISlA84iId3w0UiBxkdAHW39qTW2gLSjYt2g6yS2WX9uDw3d05TcCbUpyjWwSOnHMANEs6qISRhrAteaPPBXjYVJ5ihzYL9ke0xp8MaWEQk+doJq+NeKPjUtSJi5bezUW2Xzg==","receipt":"{\"orderId\":\"GPA.3300-8647-6799-79803\",\"packageName\":\"fr.ics.edl.jbertomeu\",\"productId\":\"edls_pack_1\",\"purchaseTime\":1605609558987,\"purchaseState\":0,\"purchaseToken\":\"fibibcopioifhgocogdikdcf.AO-J1OwzMwDhKtS5c6iGRvJEBg6_vS_bDc0Gk47_L94Pgt_MzhBpOs5KLChyEBxlnGSShhKBdjmD0c3M_xFsGAprPEUehxuncw\",\"acknowledged\":false}"}
I/Capacitor/Console: File: capacitor-runtime.js - Line 11108 - Msg: [store.js] DEBUG: state: edls_pack_1 -> approved
I/Capacitor/Console: File: http://192.168.0.47:8100/main.js - Line 2062 - Msg: Store producted approved {"id":"edls_pack_1","alias":"edls_pack_1","type":"consumable","group":"","state":"approved","title":"1 EDL","description":"1 EDL à l'unité","priceMicros":1290000,"price":"1,29 €","currency":"EUR","countryCode":null,"loaded":true,"canPurchase":false,"owned":false,"introPrice":"","introPriceMicros":"","introPricePeriod":null,"introPriceNumberOfPeriods":null,"introPricePeriodUnit":null,"introPriceSubscriptionPeriod":null,"introPricePaymentMode":null,"ineligibleForIntroPrice":null,"discounts":[],"downloading":false,"downloaded":false,"additionalData":{"applicationUsername":""},"transaction":{"type":"android-playstore","id":"GPA.3300-8647-6799-79803","purchaseToken":"fibibcopioifhgocogdikdcf.AO-J1OwzMwDhKtS5c6iGRvJEBg6_vS_bDc0Gk47_L94Pgt_MzhBpOs5KLChyEBxlnGSShhKBdjmD0c3M_xFsGAprPEUehxuncw","purchaseState":0,"receipt":"{\"orderId\":\"GPA.3300-8647-6799-79803\",\"packageName\":\"fr.ics.edl.jbertomeu\",\"productId\":\"edls_pack_1\",\"purchaseTime\":1605609558987,\"purchaseState\":0,\"purchaseToken\":\"fibibcopioifhgocogdikdcf.AO-J1OwzMwDhKtS5c6iGRvJEBg6_vS_bDc0Gk47_L94Pgt_MzhBpOs5KLChyEBxlnGSShhKBdjmD0c3M_xFsGAprPEUehxuncw\",\"acknowledged\":false}","signature":"gFMk+FH6/HZNTSyaeM3WVJOCj0sjghT4UWbWuTxFn1cqXwj6OWzexsg89uDLz+gNtV/L9cFgJur3Sh4ADFxXWKethfEk7S3jP2POfeODd/vEdjdGzIELDPDxjhJ6H0pztskqaGL3ED5wCCJzJfmsk2kUe125w5R4J+f/FRR3r/uE1LZ9T0oSyFSdrG/fPOgoN/vMLUzK6amShnnlAFISlA84iId3w0UiBxkdAHW39qTW2gLSjYt2g6yS2WX9uDw3d05TcCbUpyjWwSOnHMANEs6qISRhrAteaPPBXjYVJ5ihzYL9ke0xp8MaWEQk+doJq+NeKPjUtSJi5bezUW2Xzg=="},"trialPeriod":null,"trialPeriodUnit":null,"billingPeriod":null,"billingPeriodUnit":null,"valid":true}
V/Capacitor/Plugin: To native (Cordova plugin): callbackId: InAppBillingPlugin1523768843, service: InAppBillingPlugin, action: consumePurchase, actionArgs: ["edls_pack_1","GPA.3300-8647-6799-79803",""]
D/CordovaPurchase: consumePurchase(edls_pack_1)
I/Capacitor/Console: File: capacitor-runtime.js - Line 11108 - Msg: [store.js] DEBUG: product -> defer finishing edls_pack_1
D/CordovaPurchase: executeServiceRequest() -> OK
I/Capacitor/Console: File: capacitor-runtime.js - Line 11108 - Msg: [store.js] DEBUG: product -> finishing edls_pack_1
I/Capacitor/Console: File: capacitor-runtime.js - Line 11108 - Msg: [store.js] DEBUG: state: edls_pack_1 -> finished
I/Capacitor/Console: File: capacitor-runtime.js - Line 11108 - Msg: [store.js] DEBUG: plugin -> consumable finished
I/Capacitor/Console: File: capacitor-runtime.js - Line 11888 - Msg: InAppBilling[js]: consumePurchase()
W/System.err: java.lang.NoSuchMethodError: No virtual method setDeveloperPayload(Ljava/lang/String;)Lcom/android/billingclient/api/ConsumeParams$Builder; in class Lcom/android/billingclient/api/ConsumeParams$Builder; or its super classes (declaration of 'com.android.billingclient.api.ConsumeParams$Builder' appears in /data/app/fr.ics.edl.jbertomeu-CAdz-GG1XBhJa6ZG6v8ToQ==/base.apk)
D/ViewRootImpl@3820984[MainActivity]: stopped(false) old=false
W/System.err:     at cc.fovea.PurchasePlugin.lambda$consumePurchase$3$PurchasePlugin(PurchasePlugin.java:645)
        at cc.fovea.-$$Lambda$PurchasePlugin$Jcqz4c5r0Gni6p30bgnPft9F0ZE.run(Unknown Source:6)
        at cc.fovea.PurchasePlugin.executeServiceRequest(PurchasePlugin.java:870)
        at cc.fovea.PurchasePlugin.consumePurchase(PurchasePlugin.java:642)
        at cc.fovea.PurchasePlugin.execute(PurchasePlugin.java:154)
        at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
W/System.err:     at org.apache.cordova.PluginManager.exec(PluginManager.java:132)
        at com.getcapacitor.MessageHandler.callCordovaPluginMethod(MessageHandler.java:107)
        at com.getcapacitor.MessageHandler.postMessage(MessageHandler.java:51)
        at android.os.MessageQueue.nativePollOnce(Native Method)
        at android.os.MessageQueue.next(MessageQueue.java:336)
        at android.os.Looper.loop(Looper.java:197)
        at android.os.HandlerThread.run(HandlerThread.java:67)
D/Capacitor/App: Firing change: true
V/Capacitor/App: Notifying listeners for event appStateChange
D/Capacitor: App resumed
I/Capacitor/Console: File: capacitor-runtime.js - Line 11108 - Msg: [store.js] WARNING: A callback in 'finished' failed with an exception.
I/Capacitor/Console: File: capacitor-runtime.js - Line 11108 - Msg: [store.js] WARNING:            Java exception was raised during method invocation
I/Capacitor/Console: File: capacitor-runtime.js - Line 11108 - Msg: [store.js] WARNING:            Error: Java exception was raised during method invocation
        at capacitorExec (capacitor-runtime.js:2005:38)
        at Object.execProxy [as exec] (capacitor-runtime.js:2115:27)
        at InAppBilling.consumePurchase (capacitor-runtime.js:12000:17)
        at Object.<anonymous> (capacitor-runtime.js:12352:28)
        at Object.triggerWhenProduct (capacitor-runtime.js:11552:35)
        at Object.store.trigger (capacitor-runtime.js:11628:20)
        at store.Product.trigger (capacitor-runtime.js:11400:11)
        at store.Product.stateChanged (capacitor-runtime.js:11386:14)
        at store.Product.set (capacitor-runtime.js:11321:18)
        at store.Product.<anonymous> (capacitor-runtime.js:9541:18)
        at capacitor-runtime.js:9360:12
        at ZoneDelegate.invokeTask (http://192.168.0.47:8100/polyfills.js:3586:173)
        at Zone.runTask (http://192.168.0.47:8100/polyfills.js:3336:39)
        at ZoneTask.invokeTask (http://192.168.0.47:8100/polyfills.js:3681:28)
        at ZoneTask.invoke (http://192.168.0.47:8100/polyfills.js:3667:40)
        at timer (http://192.168.0.47:8100/polyfills.js:6676:23)

Steps to reproduce

I don't know, maybe same config/env as mine ?

It works great with iOS ! Thanks

j3k0 commented 3 years ago

You report using the plugin at version 10.4.0 -- but all calls to setDeveloperPayload have been remove since version 10.3.0 (see 676b6d6).

Can you try again upgrading to the latest version of the plugin?

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.