Reputation: 1548
My cross-platform (iOS and Android) application includes one in-app purchase. The algorithm is as follows:
Performing initialization when start the application:
if store.target == "apple" then
store.init( "apple", transactionListener)
elseif store.target == "google" then
store.init( "google", transactionListener )
restoring = true
timer.performWithDelay( 1000, restore() )
else
print("In-app purchases are not supported on this system/device.")
end
When you click «Buy» the purchase is made, but transactionCallback returns no status.
store.restore()
does not work at all!All of the above works fine on iOS!!!
What is the problem?
Upvotes: 0
Views: 990
Reputation: 416
Please make sure that you have added proper settings in build.settings file.
settings =
{
android =
{
usesPermissions =
{
"com.android.vending.BILLING",
},
},
}
If your application is in sandbox mode then you should have to test IAP by android product provide by them. Please see below product id's for your different transaction and check with purchased, canceled and item_unavailable conditions. After successful testing just replace your products with dummy ones.
-- Product IDs for the "google" Android Marketplace store.
local googleProductList =
{
-- These product IDs are used for testing and is supported by all Android apps.
-- Purchasing these products will not bill your account.
"android.test.purchased", -- Marketplace will always successfully purchase this product ID.
"android.test.canceled", -- Marketplace will always cancel a purchase of this product ID.
"android.test.item_unavailable", -- Marketplace will always indicate this product ID as unavailable.
}
Second thing is that: In the Google Play Marketplace, there is no "restored" state for items. All purchased items will be grouped under the "purchased" state. When you do a restore, you should clear all purchases saved to file/database — except for consumable purchases — and treat the returned restored purchases as normal purchases.
Please check.
Upvotes: 1