Search code examples
androidgoogle-playin-app-billing

Get purchased price using OpenIAB


Is there any chances to get price of purchased item?

When I use Google trivialdrivesample sources I process Purchase entity in such way:

public class Purchase {
    long mPrice;

    public Purchase(String itemType, String jsonPurchaseInfo, String signature) throws JSONException {
        mItemType = itemType;
        mOriginalJson = jsonPurchaseInfo;
        JSONObject o = new JSONObject(mOriginalJson);
        mPrice = o.optLong("price");
        . . . . 
    } 
    . . . .
}

Solution

  • Here is a sample json:

    {"orderId":"1234567890.098876565434321","packageName":"com.bla.bla","productId":"blabla","purchaseTime":1393827852653,"purchaseState":0,"purchaseToken":"alot of bla bla bla"}
    

    Sorry but there is no price in the purchase object.

    but you can start a getSkuDetails() request and you will get the price from that.