@@ -55,6 +55,7 @@ public class RNIapModule extends ReactContextBaseJavaModule {
5555 private static final String E_REMOTE_ERROR = "E_REMOTE_ERROR" ;
5656 private static final String E_USER_ERROR = "E_USER_ERROR" ;
5757 private static final String E_DEVELOPER_ERROR = "E_DEVELOPER_ERROR" ;
58+ private static final String E_BILLING_RESPONSE_JSON_PARSE_ERROR = "E_BILLING_RESPONSE_JSON_PARSE_ERROR" ;
5859
5960 private static final String PROMISE_PREPARE = "PROMISE_PREPARE" ;
6061 private static final String PROMISE_BUY_ITEM = "PROMISE_BUY_ITEM" ;
@@ -244,7 +245,7 @@ public void getAvailableItemsByType(String type, final Promise promise) {
244245
245246 WritableMap item = Arguments .createMap ();
246247 item .putString ("productId" , json .getString ("productId" ));
247- item .putString ("transactionId" , json .getString ("orderId" ));
248+ item .putString ("transactionId" , json .optString ("orderId" ));
248249 item .putString ("transactionDate" , String .valueOf (json .getLong ("purchaseTime" )));
249250 item .putString ("transactionReceipt" , json .getString ("purchaseToken" ));
250251 item .putString ("data" , data );
@@ -257,7 +258,8 @@ public void getAvailableItemsByType(String type, final Promise promise) {
257258
258259 items .pushMap (item );
259260 } catch (JSONException e ) {
260- e .printStackTrace ();
261+ promise .reject (E_BILLING_RESPONSE_JSON_PARSE_ERROR , e .getMessage ());
262+ return ;
261263 }
262264 }
263265
0 commit comments