RevenueCat / purchases-android

Android in-app purchases and subscriptions made easy.
https://www.revenuecat.com/
MIT License
247 stars 50 forks source link

Getting Products causes "There was a problem with the store" after upgrading to v6 #1689

Open samuelm00 opened 5 months ago

samuelm00 commented 5 months ago

Describe the bug I'm currently trying to upgrade from v5 to v6 and then to v7. The problem is that as soon as I upgrade from v5 to v6 I get the following error:

🤖‼️ PurchasesError(code=StoreProblemError, underlyingErrorMessage=Error when fetching products - DebugMessage: Server error, please try again.. ErrorCode: 6., message='There was a problem with the store.')

the code causing the error: Purchases.sharedInstance.getProducts(productIds, ProductType.SUBS, callback);

I have been trying for quite some time but can't seem to figure out what the problem is.

  1. Environment
    1. Platform: Android target SDK 33
    2. SDK version: 6.4
    3. OS version: Mac OS
    4. How widespread is the issue. Percentage of devices affected. In production with v5 everything is running fine
RCGitBot commented 5 months ago

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

michaelAtRC commented 5 months ago

Hey @samuelm00 !

The error that you are seeing is a generic store problem error, the problems that will trigger this on iOS:

If this occurs while testing in sandbox, we recommend that you try either repeating the operation later or creating a new sandbox user on iOS.

Since this was happening during the migration, there were some bigger changes in that update from v5 to v6. Have you checked out our migration guide yet? If not, that can be found here. I recommend going through that guide as there are some code changes and changes to the product that could be causing this.

Let me know if that helps!

samuelm00 commented 5 months ago

Hey @michaelAtRC

I think there is something else going on as well.

I have 2 apps on my machine locally:

the first one is using v5 and the other one v6. For the account that already bought a subscription using v5 I always get the error as described in the issue when I try to fetch the products from the store using the app with v6. But on v5 everything is working perfectly fine. For all accounts that haven't bought a subscription yet, everything seems to be working fine in both v5 and v6.

Do you have any idea what could be the problem?

michaelAtRC commented 4 months ago

Hey @samuelm00 ,

There were some changes during this migration to purchase parameters. Are you possibly trying to make the purchase with these params on an older version?

https://github.com/RevenueCat/purchases-android/blob/main/migrations/v6-MIGRATION.md#purchasing-api-changes

samuelm00 commented 4 months ago

Hi @mikescamell thanks for you answer,

but I don't even get to the point where I'm able to purchase anything.

It already fails here:

Purchases.sharedInstance.getSubscriptionSkus(skus, callback)

I know it's deprecated but also changing it to

Purchases.sharedInstance.getProducts(skus, ProductType.SUBS, callback)

doesn't help

michaelAtRC commented 4 months ago

Hey @samuelm00 ,

Just to confirm which version of the SDK are seeing this on?

samuelm00 commented 4 months ago

@michaelAtRC I'm using 6.4.0, I also tried other versions but all have the same problem

michaelAtRC commented 4 months ago

Hey @samuelm00

Could you send debug logs that reproduce this? You can enable debug logs by following this guide. After they're enabled you'll see logs like this in the console:

[Purchases] - DEBUG: No cached entitlements, fetching [Purchases] - DEBUG: GET /v1/subscribers/ 200 [Purchases] - DEBUG: Purchaser info updated, sending to delegate

Please ensure the debug logs include the entire app life-cycle, including the messages printed during initialization of the SDK. The more information you include here, the better we'll be able to help.

Let me know if you have any questions!

samuelm00 commented 1 month ago

Hey sorry for not getting back to you, I was able to solve the issue by getting the products via the offerings:

Purchases.sharedInstance.getOfferingsWith({ error ->
    callback.onError(error)
}) { offerings ->
    val storeProducts = offerings.current?.availablePackages?.map { it.product } ?: emptyList()
    callback.onReceived(storeProducts)
}