@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 @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:
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 )
endfor i = 1,#event.invalidProducts do
print( event.invalidProducts[i].productIdentifier )
end
endlocal 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.