Codeless IAP and subscriptions

I am using the codeless IAP for a simple app.

It has a subscription purchase.

This works and I am very happy with it.

My question is how does it handle subscriptions that have either expired or cancelled?

Thanks

See Unity - Manual: Subscription Product support

Codeless support for subscriptions is limited, there currently isn’t a way to get this information. You would need to use scripted IAP

Thanks for the reply, ive used the scripted IAP in the past but would prefer to use the codeless iap if possible.

So what would happen in the following situations:

  • If they have subscribed and cancelled during a trial, i would expect it to return FALSE.

  • If they have subscribed but cancelled, id expect it to return TRUE until the expiration date and then return FALSE.

Also on a side not, is the SubscriptionManager partially populated via the codeless iap?

What are you expecting to be TRUE or FALSE? To use SubscriptionManager, you would need to use Scripted IAP.

Sorry not true or false, but the IAP Listener would call the On Purchase Complete method if the subscription is valid and not call it if it is not valid.

So if the user subscribes and later cancels, does the IAPListener continue to OnPurchaseComplete until the expiration date?

If the the user subscribes and cancels during the trial, does the IAPListener still call the OnPurchaseComplete? I would expect it not to.

The IAP Listener only triggers on the initial purchase and subsequent Restore operations. But not on each game start.

thanks @JeffDUnity3D .

I know you always recommend the coded api but do you know if there are any plans to improve the CodlessIAP system. It seems to do almost everything that is needed apart from validation.

Thanks.

Yes, I brought this very topic up with the engineering team today! It will take some time though, perhaps even a few months as we might want to make overall improvements.

Hi @aholla .

We have a sort of workaround within our test project, where we use Codeless IAP, but you’ll need to add some code yourself into another class.

You can check for a valid receipt for a given subscription

First, you can get the list of products from Codeless IAP:

var products = CodelessIAPStoreListener.Instance?.StoreController?.products;

Then get your product:

var product = products.WithID(productId);

Then use the SubscriptionManager to check its status

var subscriptionManager = new SubscriptionManager(product, null);
var isSubscribed = subscriptionManager.getSubscriptionInfo()?.isSubscribed();

You can then do what you want with isSubscribed.

2 Likes

Be sure to track your changes if you update the codeless files as suggested or they will be overwritten during an upgrade. Source control is best for this.

Hmmm… great point Jeff,

I will need to look into a workaround for pending purchases and receipt validation without modifying our API directly. There may be a solution, but maybe not.

“Be sure to track your changes if you update the codeless files as suggested or they will be overwritten during an upgrade. Source control is best for this.” - or you can actually make the methods virtual and protected (in IAPButton, IAPListener etc.) so we can add implementation properly (by inheriting and thus not overwrite). I thought I could save some time by using Codeless IAP but I regret deeply that I added this to our project.

Understood, we have some work to do on Codeless, we were suggesting sub-optimum work-arounds.

1 Like

I am also interested in using the codeless api. Would these improvements consist of:

  • Implementation into UIToolkit.

  • Receipt validation on startup so I can check if the IAP item was purchsed?

Thanks!

No specific integration into UIToolKit. And yes, we are looking into receipt validation for Codeless as a high priority improvement, but likely not until early next year.

1 Like

@JeffDUnity3D Thanks for looking into that and thanks @John_Corbett for your suggestion, this was actually something I was thinking about doing, I was just a little scared of the “dont mix the codeless with the coded api” posts :slight_smile:

Thanks for all of your work on this, its really great and I will look forward to hearing about future developments.

To be clear, the other posts about not “mixing” was due to incorrect coding. People were placing a ProcessPurchase callback as their “successful purchase” method in Codeless which is incorrect. The documentation correctly uses a method you write would yourself like “GrantCredits”

1 Like

So just one more question…

I remember from my logs that my app retrieves the purchase history when it loads. My question is, is this invoked via the IAPListener or doesn’t just happen.

What I’m wondering, is if I can use the IAPListener to retrieve the products the user has purchased when the open the app. OR does this only get called when the products are initially purchased?

Perhaps this is not necessary…

I would like to do something like @John_Corbett suggested when the app has loaded, I could then check the subscription state and enable the relevant content in the app.

ALSO, is there a way to know that the codelessIAPListerner singleton has received data so I can check the status?

Thanks.

Sadly the CodelessIAPListener isn’t that robust. You’d need to modify it.