Google IAP - Product details for subscription is not showing up. Need little info

@Catalin8, the solution you came up with - it requires Enterprise, right? Is this something that Corona needs to fix for us non-Enterprise users?

@Rob, using loadProducts, iOS is picking my subscription product fine. But Google Play is showing it as an invalid product, even though GP is showing my new subscription product as “Active”, and I’ve been sure to upload the APK into Beta release. Is Corona SDK still supporting Google Play subscriptions as part of the loadProducts list? I had this working about 18 months ago - the same code now, isn’t and I"m experiencing exactly what @catalin8 described here. Any thoughts?

@troylyndon the subscription products are supported (this is not mentioned in the documentation), but only passing it in a different list as a second parameter with loadProducts method as i mentioned before loadProducts(managedIdsList, subscriptionIdsList, listener). You will receive the results with the managed and subscriptions in the same list of products. To purchase a subscription you must use the method purchaseSubscription instead of purchase.

For ios it’s working as expected with loadProducts(productIdsList, listener) and with the purchase method.

On the other hand we have been using Corona Enterprise, but we have moved to Corona native. We received the license for splash screen until the enterprise expire, so i think you don’t need any license for that. Maybe somebody from @corona can explain it to us. 

@catalin8, you are the man! The product is now in the list. Thank you.

@Rob, I really think you should add this point to your documentation.

Please go to the relevant documentation page and use the “Report an issue” button at the bottom. Provide details and an example if you can.

Thanks!

Rob

Until Corona updates its documention for loadProducts, which I have just reported, this solution solves this problem of loading products with subscriptions.

HOWEVER, the store.purchase does bring up the purchase dialog properly, but then the transaction fails because of something Corona needs to do. So, I would not recommend attempting this until Corona supports subscription purchases properly for Android.

SYNTAX
store.loadProducts( productIdentifiers, subscriptionIdentifiers, productListener )

subscriptionIdentifiers (optional)

Table. An array of strings indicating a list of subscription product identifiers.
 

@Rob, even though the code above does load subscription products after the consumable products in the array, when I choose store.purchase(subscriptionID) it does bring up the proper subscription to complete the purchase, but unfortunately, the transactionCallback fails

In transactionCallback    failed
state=failed
Transaction failed, type:    -1008    IAB returned null purchaseData or dataSignature (response: -1008:Unknown error)    ulmoves

(NOTE: ulmoves is my subscription ID)

How soon can Corona fix this? I can see why the subscriptionsIDs were not documented in the loadProducts function.

https://developer.android.com/google/play/billing/billing_java_kotlin

@troylyndon To achieve the purchase of a subscription you should use the method store.purchaseSubscription(subscriptionID) in Android. It’s an undocumented method, but it seems to work correctly. I have tested it last weeks and i didn’t found any issue.

@catalin8, seems to work, THANK YOU

@catalin8 @troylyndon any suggestions if the subscription products are loaded as invalidProducts using this plugin?

I have 3 subscription IAP products. Here is my setup on Google:

Screen Shot 2020-06-01 at 2.20.37 PM

Here is my code. I created a blank table of non-subscription identifiers, and a table of my subscription identifiers. I am receiving only a list of invalidProducts. The productidentifier of each invalidProduct is also returning as nil. The event.products is empty.

local productIdentifiers = {
“offer.month”,
“offer.3month”,
“offer.year”,
}

local firstIdentifiers = { }

local function productListener( event )
print(“load products”)

for i = 1,#event.products do
print( event.products[i].productIdentifier )
end

for i = 1,#event.invalidProducts do
print( event.invalidProducts[i].productIdentifier )
end
end

local function transactionListener( event )

-- Google IAP initialization event
if ( event.name == "init" ) then

print(“Google IAP initialization event”)

    if not ( event.transaction.isError ) then	-- Perform steps to enable IAP, load products, etc.
  	print("store is active: ", store.isActive)
  	if ( store.canLoadProducts ) then
  	print("can load products")
  	
  	store.loadProducts(firstIdentifiers, productIdentifiers, productListener )
  	
        else 
  	print("cant load products")

end

    else  -- Unsuccessful initialization; output error details
        print( event.transaction.errorType )
        print( event.transaction.errorString )
    end

-- Store transaction event
elseif ( event.name == "storeTransaction" ) then

    if not ( event.transaction.state == "failed" ) then  -- Successful transaction
        print( json.prettify( event ) )
        print( "event.transaction: " .. json.prettify( event.transaction ) )

    else  -- Unsuccessful transaction; output error details
        print( event.transaction.errorType )
        print( event.transaction.errorString )
    end
end

end

store.init( transactionListener )

I am getting the init event and the “store is active: true” and “can load products” but none of the product identifiers are loading.

I also tried with “com.companyName.appName.offer.month” as the product identifiers but had the same result.

Thanks so much for any suggestions!

Sorry, but I stopped using subscriptions after a few months.