private void processPurchaseSuccess ( final String purchaseData ) { Logger . i ( "NokiaStoreHelper.processPurchaseSuccess" ) ; Logger . d ( "purchaseData = " , purchaseData ) ; Purchase purchase ; try { final JSONObject obj = new JSONObject ( purchaseData ) ; final String sku = SkuManager . getInstance ( ) . getSku ( OpenIabHelper . NAME_NOKIA , obj . getString ( "productId" ) ) ; Logger . d ( "sku = " , sku ) ; purchase = new Purchase ( OpenIabHelper . NAME_NOKIA ) ; purchase . setItemType ( IabHelper . ITEM_TYPE_INAPP ) ; purchase . setOrderId ( obj . getString ( "orderId" ) ) ; purchase . setPackageName ( obj . getString ( "packageName" ) ) ; purchase . setSku ( sku ) ; purchase . setToken ( obj . getString ( "purchaseToken" ) ) ; purchase . setDeveloperPayload ( obj . getString ( "developerPayload" ) ) ; } catch ( JSONException e ) { Logger . e ( e , "JSONException: " , e ) ; final IabResult result = new NokiaResult ( IabHelper . IABHELPER_BAD_RESPONSE , "Failed to parse purchase data." ) ; if ( mPurchaseListener != null ) { mPurchaseListener . onIabPurchaseFinished ( result , null ) ; } return ; } if ( mPurchaseListener != null ) { mPurchaseListener . onIabPurchaseFinished ( new NokiaResult ( RESULT_OK , "Success" ) , purchase ) ; } }
Called if purchase has been successful