Repository navigation
Parse StoreProduct prices culture-invariantly (Android sent 199.99 as 19999 on pt-BR devices) - #11
Merged
ianrumac merged 1 commit intoSep 9, 2026
Conversation
The Android bridge sends price and trialPeriodPrice as strings (BigDecimal.toString()), and Convert.ToDouble(object) parses strings with the device culture, so "199.99" became 19999 on pt-BR / de-DE devices. Parse with the invariant culture and accept both the JSON number the iOS bridge sends and the string the Android bridge sends.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DeserializeStoreProductparsespriceandtrialPeriodPricewithConvert.ToDouble(object). The iOSbridge sends those as JSON numbers, but the Android bridge sends
product.price.toString(), a string such as"199.99".Convert.ToDouble(string)uses the device's current culture, so on any device whose localetreats
.as a grouping separator (pt-BR, de-DE, es-ES, fr-FR, ...)"199.99"parses as 19999.Observed on a Moto G24 Power set to Portuguese (Brazil):
StoreProduct.Pricecame back as19999for aR$ 199,99 yearly subscription, and every consumer that reports the numeric price (revenue analytics,
present/future value fields) inherited the 100x error. iOS on the same product returned
199.9.Fix
A small
ToDoubleInvariant(object)helper: JSON numbers pass through, strings parse withNumberStyles.FloatandCultureInfo.InvariantCulture, anything else falls back toConvert.ToDouble(value, InvariantCulture). Both price fields use it. No bridge change is required, so thefix also applies to apps that do not rebuild the Android library.
Verification
Device (Android, pt-BR locale):
StoreProduct.Priceis199.99after the change. iOS unaffected (numberpath). The integer fields (
periodDays,trialPeriodDays, ...) are untouched: integers have no decimalseparator to misread.
Checked against superwall-android 2.7.23 (
SuperwallUnityBridge.ktserializeStoreProduct) andSuperwallKit 4.16.3.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LTHPGB4qyAwDVYmQHW87ex