I am trying to setup Google Play InApp Purchase.
I setup 2 “In-app products” -> “Subscriptions” on google play as below. And there is no error message on google play and I can release the app without issue.
ID: monthly
Name: Monthly Subscription
ID: yearly
Name: Yearly Subscription
However, when I tried the following code. It always return me “Number of products: 0”
local function onLoadProducts(event) alert('Number of products: '..#event.products) for i = 1,#event.products do alert('productIdentifier: '..event.products[i].productIdentifier) alert('title: '..event.products[i].title) alert('description: '..event.products[i].description) alert('localizedPrice: '..event.products[i].localizedPrice) end end store.loadProducts( {"monthly", "yearly"}, onLoadProducts )
I tried to replace the product identifier to “com.domain.myapp.monthly”. It has the same result.
I tried to get the value of “store.isActive” and “store.canLoadProducts”. They both return true. I have added the License key to config.lua and added the setting and permission to build.settings as well. I also testing the inapp purchase by using the “Internal Test” build from google play.
I am not sure if I am setting the right product identifier or not. Or anything I have missed? Can someone help?
Thanks,
Alex