# In-app Products - Wrong Price (Google Play)

**URL:** <https://forums.unrealengine.com/t/in-app-products-wrong-price-google-play/394762>\
**Category:** Mobile\
**Tags:** Google-Play, wrong, in-app-purchase, unreal-engine, question\
**Created:** [May 27, 2017, 1:38am UTC](https://forums.unrealengine.com/t/in-app-products-wrong-price-google-play/394762 "2017-05-27T01:38:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_089a4978](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_089a4978](https://forums.unrealengine.com/u/anonymous_user_089a4978)\
**Post date:** [May 27, 2017, 1:38am UTC](https://forums.unrealengine.com/t/in-app-products-wrong-price-google-play/394762/1 "2017-05-27T01:38:52Z")

</div>

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.

 ![139361-screenshot_2017-05-27-04-30-52.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/8/8/088c6b2beee7ca4d64bbe32a95099505fe50611f.jpeg)

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**

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_089a4978](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_089a4978](https://forums.unrealengine.com/u/anonymous_user_089a4978)\
**Post date:** [June 3, 2017, 10:42am UTC](https://forums.unrealengine.com/t/in-app-products-wrong-price-google-play/394762/2 "2017-06-03T10:42:44Z")

</div>

Today this bug showed someone 1,705.03 VND of price tag, yes, this time positive. But when he bought, we received 6,000.00 VND. This is considered as fraud in many countries including mine.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d317706b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d317706b](https://forums.unrealengine.com/u/anonymous_user_d317706b)\
**Post date:** [June 3, 2017, 6:29pm UTC](https://forums.unrealengine.com/t/in-app-products-wrong-price-google-play/394762/3 "2017-06-03T18:29:16Z")

</div>

Forgive me if i’m missing something…but why are you initializing the int with such a large number(too large for int)… just to later reduce it anyway?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_089a4978](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_089a4978](https://forums.unrealengine.com/u/anonymous_user_089a4978)\
**Post date:** [June 4, 2017, 12:41pm UTC](https://forums.unrealengine.com/t/in-app-products-wrong-price-google-play/394762/4 "2017-06-04T12:41:48Z")

</div>

This is how Google Play sends price data, in micro currency units. They send it as long but Unreal tries to convert it to int, here is the problem.

To fix this you may change this line:

```
Float priceRaw = (float) object.getInt("price_amount_micros") / 1000000.0f;

```

into this line:

```
Float priceRaw = (float) object.getLong("price_amount_micros") / 1000000.0f;

```
