I have problems with the way IAPs work on iOS. I get that last year something changed in the way apple does IAPs. I know there is a new IAP plugin, to be used with solar2d aimed at apple IAPs. However, the documentation we have (especially the guide here - [https://docs.coronalabs.com/guide/monetization/IAP/index.html]
) seems to be out of date. Do we have a current guide on how to properly use the IAP plugin for apple?
My concrete problem right now is that all products I have listed are returned as invalidProducts when calling store.loadProducts
, and the event.products table is empty, while they are listed and approved by apple (and the app is build with the correct development certificate)…
Hey!
I’ll suggest you to use the IAP Badger plugin for both iOS and Android IAP…
This is a great plugin that simplifies the process of IAP implementation, it has good explanation and it works great, I’ve just used it a month ago…
plugin website: http://www.happymongoosegames.co.uk/iapbadger.php
github: https://github.com/happymongoose/iap_badger
Thanks for the answer. I was actually using IAP Badger, and it is working well on Android, however it did not on iOS, (used to work without a hitch last year). That’s why I tried to use the new solar2d plugin, but alas to no avail. Actually this is why I was asking for a current guide… there is something I don’t get, and I am not sure why…
If you will share your code with more details It will be easier for us to help
Thanks for your time. Here is an extremely simple code I’ve created for testing purposes, still building with correct development certificate, and testing on a device (as per IAP badger instructions) :
--Load IAP Badger
--Include the plugin
local iap = require 'plugin.iap_badger'
--Create the catalogue
local catalogue = {
--Information about the product on the app stores
products = {
--removeAds is the product identifier.
speakingmodule = {
--A list of product names or identifiers specific to apple's App Store or Google Play.
productNames = {
apple= "com.istudybg.speakingmodule20201008",
google= "speakingmodule",
},
--The product type
productType = "non-consumable"
}
}
}
--This table contains all of the options we need to specify in this example program.
local iapOptions = {
--The catalogue generated above
catalogue=catalogue,
}
--Initialise IAP badger
iap.init(iapOptions)
--Called when the relevant app store has completed the purchase
--Make a record of the purchase using whatever method you like
local function loadProductsListener( )
local products=iap.getLoadProductsCatalogue()
local alert = native.showAlert( "test", "Prooduct price is".. products.speakingmodule.localizedPrice, { "OK"} )
end
local function purchase()
--iap.purchase("speakingmodule", purchaseListener)
--Load the product catalogue from the relevant app store - when this is complete, print out a sample message
iap.loadProducts(loadProductsListener)
end
timer.performWithDelay(5000, purchase)
This code returns error, saying that products.speakingmodule is a nil value (or as far as I understand it, the product table is empty).
P.S. the apple code is the real one for the purchase, approved by apple: apple= “com.istudybg.speakingmodule20201008”,
P.P.S. This works with the Google IAPs.
P.P.P.S just in case loading screenshots from apple’s App Store connect: