adaptyteam / AdaptySDK-Flutter

SDK for growing mobile in-app purchases
https://docs.adapty.io/docs/quickstart
MIT License
88 stars 15 forks source link

AdaptyError (code 2003) Bad request. #76

Closed furkancetintass closed 1 year ago

furkancetintass commented 1 year ago

I see this error in Sentry issues while getPaywallProducts running adapty_flutter: ^2.2.4

adapty_flutter.dart in Adapty._invokeMethodHandlingErrors at line 241 within adapty_flutter
Called from: <asynchronous suspension>
adapty_flutter.dart in Adapty.logShowPaywall at line 114 within adapty_flutter
Called from: <asynchronous suspension>
adapty_service.dart in AdaptyService.getProducts at line 67 within uppy
Called from: <asynchronous suspension>
premium_viewmodel.dart in PremiumViewModel.getProductsFromAdapty at line 779 within uppy
Called from: <asynchronous suspension>
premium_viewmodel.dart in PremiumViewModel.createAppSubscriptionOptions at line 215 within uppy
furkancetintass commented 1 year ago

(code: 2003, message: Request is unsuccessful. https://api.adapty.io/api/v1/sdk/in-apps/google/token/restore/ Code: 400, Response: {"errors":[{"detail":"GoogleError Bad Request <HttpError 400 when requesting https://androidpublisher.googleapis.com/androidpublisher/v3/applications/com.dusyeri.uppy/purchases/subscriptions/uppy_test_premium_subscription_12m_and/tokens/chcjndimfodikdagegapnbon.AO-J1OxjLfjGo6Ddw3druuGWFG392fUYLpA0_RZ2hteXDU3FXq4I_2-9L-t8I8YRqt73RaAFHxG6FjUcx8ulequR6DVCm0WjaorL4-JHwj14ueB5yOj9LLY?alt=json returned \"The purchase token does not match the package name.\">","status":"400","source":{"pointer":"/data"},"code":"GOOGLE_RECEIPT_VALIDATION_ERROR"}]}, detail: null)

I recently caught this error.

We get this error log when we download the application via Google Play Internal test @vladd-g

adapty.dart in Adapty._invokeMethodHandlingErrors at line 266 within adapty_flutter
Called from: <asynchronous suspension>
adapty.dart in Adapty.getPaywall at line 97 within adapty_flutter
Called from: <asynchronous suspension>
adapty_service.dart in AdaptyService.getPaywall at line 50 within uppy
Called from: <asynchronous suspension>
premium_viewmodel.dart in PremiumViewModel.getProductsFromAdapty at line 785 within uppy
Called from: <asynchronous suspension>
premium_viewmodel.dart in PremiumViewModel.createAppSubscriptionOptions at line 217 within uppy

also I am using flavor

vladd-g commented 1 year ago

@furkancetintass Does your flavor's applicationId differ from the one you added to the Adapty Console and the one you uploaded Service Account Key for?

furkancetintass commented 1 year ago

@vladd-g Yes they are different

vladd-g commented 1 year ago

@furkancetintass This is the reason for the errors like this, your build's applicationId needs to match the one in Adapty Console, and so does Service Account Key

furkancetintass commented 1 year ago

I was using the same service account key before. I separated this for test and prod just now. But I still get the same error in the prod app @vladd-g

vladd-g commented 1 year ago

@furkancetintass is the appKey you're using in the prod app associated with the prod app in the Adapty console?

furkancetintass commented 1 year ago

Yes, absolutely @vladd-g

vladd-g commented 1 year ago

@furkancetintass We can see your message in the Intercom chat and will respond there since this issue isn't related to the SDK directly. Thanks!

furkancetintass commented 1 year ago

@vladd-g Ok. Thanks