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

localizedPrice & price is null on Android #416

Closed
english-aha-center opened this issue Mar 27, 2023 · 17 comments
Closed

localizedPrice & price is null on Android #416

english-aha-center opened this issue Mar 27, 2023 · 17 comments

Comments

@english-aha-center
Copy link

Hi, first of all thanks for this amazing package.
I am having an issue with localizedPrice & price being null after upgrading Flutter version from 3.3.1 to 3.7.5. Prices are setup correctly in Play Store. Previous version of the app behaves correctly on production that is built with Flutter version 3.3.1

Version of flutter_inapp_purchase:

  • 5.0.4 (tried with the latest version 5.4.1, still null value)

Flutter 3.7.5 • channel stable

Platforms you faced the error:

  • Android

Expected behavior:

  • localizedPrice & price should not be null on Android

Actual behavior

  • localizedPrice & price is null on Android

Tested environment:

  • Real Device

Steps to reproduce the behavior:

FlutterInappPurchase.instance.getProducts(_productLists)

@edscodeblenders
Copy link

I'm having the same issue, any news about this?

@xalikoutis
Copy link

Same here please advise

@deakjahn
Copy link
Contributor

deakjahn commented Apr 27, 2023

Probably this error? #392

@KzumO36
Copy link

KzumO36 commented Apr 29, 2023

Any assistance? This is a breaking issue guys, help would be appreciated. Tried to downgrade down to 4.0.0 but still, its all null now.

@deakjahn
Copy link
Contributor

@KzumO36 not really. It would be nice to have it fixed, sure, but you can simply use:

var price = product.localizedPrice ?? product.introductoryPrice;

@KzumO36
Copy link

KzumO36 commented Apr 29, 2023

No, theres still an exception then. It's showing the price yes but if you tap on an item to buy it, theres still an error.

E/flutter (17774): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(InappPurchasePlugin, buyItemByType, null, null) E/flutter (17774): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653:7) E/flutter (17774): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:315:18) E/flutter (17774): <asynchronous suspension> E/flutter (17774): #2 FlutterInappPurchase.requestPurchase (package:flutter_inapp_purchase/flutter_inapp_purchase.dart:278:14) E/flutter (17774): <asynchronous suspension>

@deakjahn
Copy link
Contributor

@KzumO36 That's a different problem, unrelated to the price display. I happened to have fixed it a few days ago. :-) See #423, it will be merged soon, hopefully, but until then, just fix it for yourself. It works, I already have my modified app in the store successfully.

@edscodeblenders
Copy link

In order to avoid this breaking issue, I finally migrated my app to use the official plugin from flutter.dev:
https://pub.dev/packages/in_app_purchase

The interface is very similar, so the adjustments took me less than an hour to do and test. It's also supported by Google.

@KzumO36
Copy link

KzumO36 commented May 2, 2023

Im not feeling good with cloning the reposity etc, why does it take that long to accept the pull request? I dont know if it takes time to get approved or something but it would be better to just use the original package instead of messing around with it yourself.

@edscodeblenders ive had issues with purchase history / pending purchases on the "official" one, thats why im still here. This one worked for years now but is now broken.

@deakjahn
Copy link
Contributor

deakjahn commented May 2, 2023

@KzumO36 Probably because, in addition to being developers, we're also all humans, with families, sometimes problems, other jobs to do and cannot always jump immediately to do everything at the same time? :-))

You can also patch your own copy in your local cache, or you can temporarily point your pubspec to my github repo, it'll stay there until the PR is finally accepted.

@edscodeblenders A possibility but before anybody does it, note that the packages are not equivalent. The official package provides no way to check if your app (or in-app product) has actually been purchased already when you start your app (or a part that you only want to provide to paid users). So, this package has its rather important merits.

@KzumO36
Copy link

KzumO36 commented May 2, 2023

@deakjahn I have used your repo now and it works, thank you!

@pabbathiharish
Copy link

@KzumO36 I am also getting same Exception , Any Update on this.

@92sajid110
Copy link

any update

@moodstubos
Copy link

this seems to be related: #430

Workaround works for me.

@github-actions
Copy link

This issue is stale because it has been open 90 days with no activity. Leave a comment or this will be closed in 7 days.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 21, 2023
@RomanSoviak
Copy link

RomanSoviak commented Feb 17, 2024

Issue is still exists! I think this is the best solution:
#416 (comment)

@deakjahn
Copy link
Contributor

@RomanSoviak Your decision, but 1) the other plugin is far from being equivalent, it lacks important features that this one supports, 2) this error has already been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants