Prices that are higher than a few thousands are incorrectly fetched by Unreal Engine. In this example, I set the price to “4000.00 TRY”. However, it shows to user “-294.97 TRY”. Of course “4000.00 TRY” is very high and for only testing purpose, but “4000 KRW” and “4000 IDR” are normal prices but because of this bug, we belie our customers by showing a value seems like “294.97 KRW” or “294.97 IDR”. This bug is critical for end-user satisfaction.
Address of the bug: Engine\Build\Android\Java\src\com\epicgames\ue4\GooglePlayStoreHelper.java:163
Float priceRaw = (float) object.getInt("price_amount_micros") / 1000000.0f;
pricesRaw.add(priceRaw);
Log.debug("[GooglePlayStoreHelper] - price_amount_micros: " + priceRaw.toString());
Instead of int, long must be used.
To repeat this in a clean java project, use this code:
public class Main {
public static void main(String[] args) {
int price = (int)4000000000L;
Float priceRaw = (float) price / 1000000.0f;
System.out.println(priceRaw);
}
}
Output is -294.9673 instead of 4000