question

bfg-wb avatar image
bfg-wb asked

Get at price as a Double from In-App Purchasing SDK v2.0.61

Is there any possibility to get at the price of the SKU as a Double. It looks like now, in the amazon.sdktester json that's generated, there is a currencyPriceMap that's generated. Here's an example:

"currencyPriceMap":{"BR":2.33,"DE":0.77,"AU":1.1,"IN":60.31,"JP":107.0,"GB":0.61,"IT":0.77,"CN":6.0,"FR":0.77,"ES":0.77,"US":0.99,"CA":1.09}}}

Is that data exposed by the SDK at all? Better yet, is that exposed when just making a purchase on a device, NOT just using the Amazon App Tester. Ideally I'd be able to get at that data at the time of purchase, but right now all that is exposed is the getPrice which only returns a string which does not work for me -- handling multiple currencies and trying to get out the Double is not a good option. Google's solution is to send along a "priceMicros" value:

price_amount_microsPrice in micro-units, where 1,000,000 micro-units equal one unit of the currency. For example, if price is "€7.99", price_amount_micros is "7990000". This value represents the localized, rounded price for a particular currency.

Is this something that's on your roadmap? Appreciate your time. Thank you.

iapprice
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jamie Grossman avatar image
Jamie Grossman answered

I've passed this on to the relevant team as a feature request who will investigate and prioritise as needed.

Thanks,

Jamie

2 comments
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Is there any good and correct official solution how can we parse formatted strings like "€7.99" returned by your SDK and get price in Double.

0 Likes 0 ·

Unfortunately not. You'd have to most likely parse the string for the time being.

0 Likes 0 ·
Andrey Maklakov avatar image
Andrey Maklakov answered

Is there any good and correct official solution how can we parse formatted strings like "€7.99" returned by your SDK and get price in Double.

1 comment
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi Andrey,

Could you please describe your use case in more detail, so we could better understand the context -- why are you parsing prices in the client (that is, inside your app?). Prices are normally being set in the Dev Portal, and if you need anything for reporting purposes, it's best to use the Reporting tools there. Any details are appreciated to understand your situation. Thanks!

0 Likes 0 ·
Oleksandr avatar image
Oleksandr answered

My use case:

I want to log purchases with fabric. So I will collect data about revenue from both stores.

Answers.getInstance().logPurchase(new PurchaseEvent()
      .putItemPrice(BigDecimal.valueOf(13.50))
      .putCurrency(Currency.getInstance("USD"))
      .putItemName("Answers Shirt")
      .putItemType("Apparel")
      .putItemId("sku-350")
      .putSuccess(true));
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

newuser-e2de8edd-9f7d-46c2-8229-a8bb44bc31c9 avatar image
newuser-e2de8edd-9f7d-46c2-8229-a8bb44bc31c9 answered

Hi!

Any updates on this issue? Is there an opportunity to get a price without a currency?

1 comment
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi there,

Not yet, regrettably. This feature request is in the backlog of the IAP team. There have been some changes with how the currency is formatted when you download the CSV file from your Developer Portal account, the prices in it are formatted as micro-units, for example a base price of 0.99 USD would be returned in the CSV file as:

US;990000;BR;4050000;GB;810000;AU;1470000;JP;106000000;FR;900000;DE;900000;ES;900000;IN;70320000;IT;900000;CA;1320000

The JSON file that you use with the App Tester companion app still displays prices as it did originally:

{"test_entitlement":
  {
    "smallIconUrl":"http://",
    "title":"Test Entitlement",
    "itemType":"ENTITLED",
    "price":0.99,
    "description":"—",
    "languageTitleMap":{"US":"—"},
    "languageDescriptionMap":{"US":"—"},
    "currencyPriceMap":
      {
        "BR":4.05,
        "DE":0.9,
        "AU":1.47,
        "IN":70.32,
        "JP":106.0,
        "GB":0.81,
        "IT":0.9,
        "FR":0.9,
        "US":0.99,
        "ES":0.9,
        "CA":1.32
      }
}
0 Likes 0 ·
newuser-11aaaf82-c3a1-42d4-9999-17912b32bf06 avatar image
newuser-11aaaf82-c3a1-42d4-9999-17912b32bf06 answered

Hey, the post is from 2017 and we are almost into 2021. Yet Amazon still returns only localized prices, so basically if you wish to do any calculations on your part (ex. monthly cost of your annual subscription) or special formatting, you are out of luck.

Please start returning decimal prices and currencies as ISO codes, this is really needed!

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Seunghun Choe avatar image
Seunghun Choe answered

Any update?

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.