public static void onIntentFinished(Activity sourceActivity, int requestCode, int resultCode, Intent data, String devPayload) {
		InAppPurchaseExtension.logToAS("Intent finished");

		sourceActivity.finish();
		sourceActivity = null;
		
		if(requestCode == BUY_REQUEST_CODE) {
			
			if(resultCode == Activity.RESULT_CANCELED) {
				InAppPurchaseExtension.logToAS("Purchase has been cancelled!");
				context.dispatchStatusEventAsync(InAppPurchaseMessages.PURCHASE_CANCELED, "");
			}
			else {
				int responseCode = data.getIntExtra("RESPONSE_CODE", 0);
			    String purchaseData = data.getStringExtra("INAPP_PURCHASE_DATA");
			    String dataSignature = data.getStringExtra("INAPP_DATA_SIGNATURE");
			    
			    if(responseCode == BILLING_RESPONSE_RESULT_OK) {
			    	JSONObject item = null;
			    	Boolean hasSimilarPayload = false;
			    	try {
			    		item = new JSONObject(purchaseData);
			    		hasSimilarPayload = devPayload.equals(item.getString("developerPayload"));
			    	}
			    	catch(Exception e) {context.dispatchStatusEventAsync(InAppPurchaseMessages.PURCHASE_FAILURE, "Error while converting the bought product data to JSONObject!");  return;}
			    
			    	
		    		if(!hasSimilarPayload) {
		    			onPurchaseVerificationFailed(item, context.getActivity().getPackageName());
		    			return;
		    		}
		    		
		    		JSONObject jsonObject = new JSONObject();
		    		try{
			    		jsonObject.put("productId", item.getString("productId"));
			    		jsonObject.put("transactionTimestamp", item.getInt("purchaseTime"));
			    		jsonObject.put("developerPayload", item.get("developerPayload"));
			    		jsonObject.put("purchaseToken", item.get("purchaseToken"));
			    		jsonObject.put("orderId", item.get("orderId"));
			    		jsonObject.put("signature", dataSignature);
			    		jsonObject.put("playStoreResponse", purchaseData);
		    		}
		    		catch(Exception e) {context.dispatchStatusEventAsync(InAppPurchaseMessages.PURCHASE_FAILURE, "Error while creating the returned JSONObject!");  return;}
					
					InAppPurchaseExtension.logToAS("The product has been successfully bought! returning it with the event ...");
					context.dispatchStatusEventAsync(InAppPurchaseMessages.PURCHASE_SUCCESS, jsonObject.toString());
			    	
			    }
			    else if(responseCode == BILLING_RESPONSE_RESULT_USER_CANCELED) {
			    	InAppPurchaseExtension.logToAS("Purchase has been cancelled!");
					context.dispatchStatusEventAsync(InAppPurchaseMessages.PURCHASE_CANCELED, "");
			    }
			    else {
			    	InAppPurchaseExtension.logToAS("The purchase failed! " + ERRORS_MESSAGES.get(responseCode));
					context.dispatchStatusEventAsync(InAppPurchaseMessages.PURCHASE_FAILURE, ERRORS_MESSAGES.get(responseCode));
			    }
			}
		}
	}