Purchases work fine for both Android and iOS so I know the setup is correct for everything in general.
The problem is with restore. It works for iOS with “restored” state.
For android im using the “purchased” state to do the same.
Issue is store.restore() just does not get any response from google for me for v2 , do I need to migrate to v3 to get it working or is there something else that im missing? Below are code excerpts
if store.availableStores.apple then store.init("apple", transactionCallback2) print("Using Apple's in-app purchase system.") elseif store.availableStores.google then store.init("google", transactionCallback) print("Using Google's Android In-App Billing system.") purchaseID = string.lower(purchaseID) else print("In-app purchases is not supported on this system/device.") end store.purchase( {purchaseID} )
function transactionCallback( event ) local transaction = event.transaction if ( transaction.state == "purchased" or transaction.state == "restored" ) then --handle a successful transaction here print( "productIdentifier", transaction.productIdentifier ) print( "receipt:", transaction.receipt ) print( "signature:", transaction.signature ) print( "transactionIdentifier", transaction.identifier ) print( "date", transaction.date ) elseif ( transaction.state == "cancelled" ) then --handle a failed transaction here end store.finishTransaction( event.transaction ) end
if store.availableStores.apple then store.init("apple", transactionCallback2) print("Using Apple's in-app purchase system.") elseif store.availableStores.google then store.init("google", transactionCallback) print("Using Google's Android In-App Billing system.") else print("In-app purchases is not supported on this system/device.") end store.restore();