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

Not found error for PAID_SUBSCRIPTION, CONSUMABLE works fine (Google Play) #1499

Closed
graemian opened this issue Nov 15, 2023 · 4 comments
Closed

Comments

@graemian
Copy link

graemian commented Nov 15, 2023

Observed behavior

Logs show CONSUMABLE is loaded:

[CdvPurchase.GooglePlay] DEBUG: Loaded: [{"productId":"test2","title":"Test (Bomad kids money tracker)","name":"Test","description":"Test","product_type":"inapp","product_format":"v11.0","formatted_price":"$0.99","price_amount_micros":990000,"price_currency_code":"USD"}]

But PAID_SUBSCRIPTION not found:

[CdvPurchase.Adapters] INFO: GooglePlay products loaded: [{"isError":true,"code":6777012,"message":"Product with id supporter_1m not found.","platform":"android-playstore","productId":"supporter_1m"}

Code to load PAID_SUBSCRIPTION looks like this:

store.register([{

        type: CdvPurchase.PAID_SUBSCRIPTION,
        id: "supporter_1m",
        platform: Platform.GOOGLE_PLAY

    } ...

It definitely exists in Google Play. I don't think there's any problem with the config since RevenueCat manages to successfully import it:

image

Full logs:

Create CdvPurchase...
[CdvPurchase] INFO: initialize()
[CdvPurchase.Adapters] INFO: Adding platforms: [{"platform":"android-playstore"}]
[CdvPurchase.Adapters] INFO: 
[CdvPurchase.Adapters] INFO: GooglePlay initializing...
[CdvPurchase.GooglePlay] INFO: Initialize
[CdvPurchase.GooglePlay.Bridge] INFO: setup ok
[CdvPurchase.GooglePlay.Bridge] INFO: listener: {"type":"ready","data":{}}
[CdvPurchase.GooglePlay] DEBUG: Ready
[CdvPurchase.Adapters] INFO: GooglePlay initialized. 
[CdvPurchase.Adapters] INFO: GooglePlay products: [{"id":"supporter_1m","platform":"android-playstore"},{"id":"supporter-1m","platform":"android-playstore"},{"id":"test","platform":"android-playstore"},{"id":"test2","platform":"android-playstore"},{"id":"test3","platform":"android-playstore"}]
[CdvPurchase.GooglePlay] DEBUG: Load: [{"id":"supporter_1m","platform":"android-playstore"},{"id":"supporter-1m","platform":"android-playstore"},{"id":"test","platform":"android-playstore"},{"id":"test2","platform":"android-playstore"},{"id":"test3","platform":"android-playstore"}]
[CdvPurchase.GooglePlay] DEBUG: getAvailableProducts: ["supporter_1m","supporter-1m","test","test2","test3"] | []
[CdvPurchase.GooglePlay.Bridge] INFO: getAvailableProducts()
[CdvPurchase.GooglePlay] DEBUG: Loaded: [{"productId":"test2","title":"Test (Bomad kids money tracker)","name":"Test","description":"Test","product_type":"inapp","product_format":"v11.0","formatted_price":"$0.99","price_amount_micros":990000,"price_currency_code":"USD"}]
[CdvPurchase.GooglePlay] DEBUG: getPurchases
[CdvPurchase.GooglePlay.Bridge] INFO: getPurchases()
[CdvPurchase.GooglePlay.Bridge] INFO: listener: {"type":"setPurchases","data":{"purchases":[]}}
[CdvPurchase.GooglePlay] DEBUG: onSetPurchases: []
[CdvPurchase.GooglePlay] DEBUG: onPurchaseUpdated: 
[CdvPurchase.AdapterListener] DEBUG: receiptsReady: android-playstore (1/0)
[CdvPurchase.GooglePlay] DEBUG: getPurchases success
[CdvPurchase.Adapters] INFO: GooglePlay products loaded: [{"isError":true,"code":6777012,"message":"Product with id supporter_1m not found.","platform":"android-playstore","productId":"supporter_1m"},{"isError":true,"code":6777012,"message":"Product with id supporter-1m not found.","platform":"android-playstore","productId":"supporter-1m"},{"isError":true,"code":6777012,"message":"Product with id test not found.","platform":"android-playstore","productId":"test"},{"className":"Product","title":"Test","description":"Test","platform":"android-playstore","id":"test2","offers":[{"className":"Offer","id":"test2","pricingPhases":[{"price":"$0.99","priceMicros":990000,"currency":"USD","recurrenceMode":"NON_RECURRING"}],"productId":"test2","platform":"android-playstore","type":"inapp"}]},{"isError":true,"code":6777012,"message":"Product with id test3 not found.","platform":"android-playstore","productId":"test3"}]
[CdvPurchase.Adapters] INFO: GooglePlay receipts loaded: []
[CdvPurchase.AdapterListener] DEBUG: setSupportedPlatforms: android-playstore (1 have their receipts ready)
[CdvPurchase.AdapterListener] DEBUG: triggering receiptsReady()
[CdvPurchase] DEBUG: Calling callback: type=receiptsReady() name=#15659ee54654cd3de0a0225d90426d46
[CdvPurchase.ReceiptsMonitor] DEBUG: receiptsReady...
[CdvPurchase.ReceiptsMonitor] DEBUG: check(0/0)
[CdvPurchase.ReceiptsMonitor] INFO: receiptsVerified()

Expected behavior

The PAID_SUBSCRIPTION should load successfully, just like the CONSUMABLE

System Info

I'm using Meteor (https://guide.meteor.com/cordova), so I can't run cordova info directly. I will try to find a way. In the meantime, here's the contents of .meteor/cordova-plugins:

cordova-plugin-camera@https://github.com/felicienfrancois/cordova-plugin-camera.git#e6e49b85b59263fc5782e835160d01a8932e3690
cordova-plugin-device@2.1.0
cordova-plugin-file@7.0.0
cordova-plugin-inappbrowser@5.0.0
cordova-plugin-network-information@3.0.0
cordova-plugin-purchase@13.9.0
cordova-plugin-qrscanner-11@3.0.5
onesignal-cordova-plugin@3.3.1
cordova-plugin-advanced-http@3.3.1

Any help would be very much appreciated. I've got subscriptions working for Apple, but I'm really struggling with Android.

@graemian
Copy link
Author

Aaaaargh, the problem was caused by

type: CdvPurchase.PAID_SUBSCRIPTION

instead of

type: CdvPurchase.ProductType.PAID_SUBSCRIPTION

Geez, this one really had me pulling my hair out

@graemian
Copy link
Author

graemian commented Nov 16, 2023

What really misled me was that CdvPurchase.PAID_SUBSCRIPTION works for Apple, but not for Google 😂

@graemian
Copy link
Author

graemian commented Nov 16, 2023

Aaaargh, maybe I picked up the wrong syntax from https://purchase.cordova.fovea.cc/discover/micro-example. It uses CdvPurchase.CONSUMABLE instead of CdvPurchase. ProductType .CONSUMABLE

@j3k0
Copy link
Owner

j3k0 commented Nov 21, 2023

What really misled me was that CdvPurchase.PAID_SUBSCRIPTION works for Apple, but not for Google 😂

Loading subscriptions info is a different low-level API on Android, so this needs to be correctly defined. On iOS it's the same API calls for subscriptions and other in-app purchase products. I will fix the guide.

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

No branches or pull requests

2 participants