@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 228) { // часть отвечающая за приём данных о платеже try { Bundle response = mService.getBuyIntent(3, getPackageName(), lastSku, "inapp", security); //lastSku - имя (id) продаваемого элемента { //эту часть добавил в фигурные скобки, т.к. она мне не нужна (оставил лишь чтоб посмотреть что она даёт) Bundle ownedItems = mService.getPurchases(3, getPackageName(), "inapp", null); int responseCode = ownedItems.getInt("RESPONSE_CODE"); //==0 if (responseCode == 0) { ArrayList<String> ownedSkus = ownedItems.getStringArrayList("INAPP_PURCHASE_ITEM_LIST"); // в нём 0 элементов ArrayList<String> purchaseDataList = ownedItems.getStringArrayList("INAPP_PURCHASE_DATA_LIST"); // тоже 0 ArrayList<String> signatureList = ownedItems.getStringArrayList("INAPP_DATA_SIGNATURE"); // тоже 0 String continuationToken = ownedItems.getString("INAPP_CONTINUATION_TOKEN"); //==null for (int i = 0; i < purchaseDataList.size(); ++i) { //не срабатывает из-за нуля String purchaseData = purchaseDataList.get(i); String signature = signatureList.get(i); String sku = ownedSkus.get(i); // do something with this purchase information // eg display the updated list of products owned by user } // if continuationToken != null, call getPurchases again // and pass in the token to retrieve more items } } int code = response.getInt("RESPONSE_CODE");//==0 if (code == 0) { String signature = response.getString("INAPP_DATA_SIGNATURE"); //==null String s = response.getString("INAPP_PURCHASE_DATA"); //==null JSONObject purchaseData = new JSONObject(s); //здесь он вылетает с NullPointerException purchaseData.getString("orderId"); purchaseData.getString("packageName"); purchaseData.getString("productId"); purchaseData.getString("purchaseTime"); purchaseData.getString("purchaseState"); purchaseData.getString("developerPayload"); purchaseData.getString("purchaseToken"); } else if (code != 1) { //сюда он не попадал Toast.makeText(this,"IAP ERROR " + response, Toast.LENGTH_SHORT).show(); } } catch (RemoteException e) { //сюда он не попадал Toast.makeText(this,"Connection error",Toast.LENGTH_SHORT).show(); } catch (JSONException e) { //сюда он не попадал Toast.makeText(this,"Response parse error",Toast.LENGTH_SHORT).show(); } } simpleFacebook.onActivityResult(this, requestCode, resultCode, data); //у меня ещё авторизация в фейсбук в этом окошке подключена super.onActivityResult(requestCode, resultCode, data); } Launched on the phone, where the main Google Account is the seller's account. In the developer console in the settings -> account information -> testers accounts, I also registered it and set it to give LICENSED.
Writes "Publisher can not buy this product."
PS By the way, in those cases when “check the connection to the Internet” falls out, it also gives out zeros and nulls. That is how it should be?