Skip to content

[in_app_purchase_storekit] Product display price with wrong precision using StoreKit 2 #159080

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

Closed
Tracked by #157558
remi-denele opened this issue Nov 18, 2024 · 2 comments · Fixed by flutter/packages#8127
Labels
p: in_app_purchase Plugin for in-app purchase P2 Important issues not at the top of the work list team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team

Comments

@remi-denele
Copy link

What package does this bug report belong to?

in_app_purchase

What target platforms are you seeing this bug on?

iOS

Have you already upgraded your packages?

Yes

Dependency versions

pubspec.yaml
in_app_purchase: 3.2.0
in_app_purchase_android: 0.3.6+12
in_app_purchase_platform_interface: 1.4.0
in_app_purchase_storekit: 0.3.20

Steps to reproduce

  1. Pre-requisites: have your products defined in App Store Connect or a local StoreKit config with your products
  2. Enable StoreKit 2
  3. Query your products details

Expected results

@LouiseHsu Based on comment #116383 (comment) (and because we have an issue with StoreKit 1 where failed transactions can never be completed when testing as per #98484), we wanted to try StoreKit 2.

We expected the formatted localized string of a product price to be displayable as this to the user, like it was with StoreKit 1.
If the defined price is 24.99 in US Dollar, ProductDetails.price should contains "$24.99" for US locale.

Actual results

We currently have 6 prices defined in App Store Connect and only 2 are displayed as expected with StoreKit 2:

✅ 0.99 -> "$0.99"
❌ 2.99 -> "$2.9899999999999998"
❌ 3.99 -> "$3.9899999999999998"
✅ 8.99 ->"$8.99"
❌ 17.99 -> "$17.990000000000002"
❌ 24.99 -> "$24.990000000000002"

This is the value returned by ProductDetails.price.
The value from (productDetails as AppStoreProduct2Details).sk2Product.displayPrice seems correct.

We found a similar issue discussed in RevenueCat: RevenueCat/purchases-ios#2207

Code sample

Code sample
InAppPurchaseStoreKitPlatform.registerPlatform();
final iapStoreKitPlatform = InAppPurchasePlatform.instance as InAppPurchaseStoreKitPlatform;
iapStoreKitPlatform.enableStoreKit2();

final storeResponse = await InAppPurchase.instance.queryProductDetails({'your_product_id'});

Screenshots or Videos

Screenshots / Video demonstration

Simulator Screenshot - iPhone 16 Pro - 2024-11-18 at 16 02 11
Capture d’écran 2024-11-18 à 15 53 07

Logs

No response

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.4, on macOS 14.6.1 23G93 darwin-arm64, locale fr-FR)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.1)
[✓] Connected device (4 available)
[✓] Network resources

• No issues found!
@LouiseHsu
Copy link
Contributor

Ah, thanks for filing this!! I'll take a look.

@LouiseHsu LouiseHsu added p: in_app_purchase Plugin for in-app purchase P2 Important issues not at the top of the work list team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team labels Nov 18, 2024
Copy link

github-actions bot commented Dec 5, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p: in_app_purchase Plugin for in-app purchase P2 Important issues not at the top of the work list team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy