RestoreTransactions not updating subscription state

Hello
In Sandbox, I was able to test subscription purchase. Opening the mail from Google for managing subscription, I’ve completely unsubscribed to the subscription and waited couple of minutes until the subscription disappear from the list in order to make sure I won’t have some timing issue between the moment I’ve clicked on unsubscribed and the moment I’m really unsubscribed.

My issue is that in this state, if I call RestoreTransactions from either IOS or Google extension, my subscription is still in subscribed state and I have to restart the application in order to have the actual state.

Is this a known issue? Is there a way to fix this issue?

below is the code I’m using

    public void RestorePurchasedProduct()
    {
#if UNITY_IOS
        if (m_AppleExtensions != null)
        {
            m_AppleExtensions.RestoreTransactions(OnRestore);
        }

#elif UNITY_ANDROID
        if (m_GooglePlayStoreExtensions != null)
        {
            m_GooglePlayStoreExtensions.RestoreTransactions(OnRestore);
        } 
#endif
    }
	void OnRestore(bool success, string error)
	{
		//success is True
		if (success)
		{
		}
		else
		{
		}
		//check if product is subscribed
		bool bSubscribed = IsItemPurchased("");// <- return true until I restart teh app
	}
	public bool IsItemPurchased(UnityEngine.Purchasing.Product TargetProduct)
	{
		if (m_StoreController == null)
		{
			return false;
		}

		// If the product doesn't have a receipt, then it wasn't purchased and the user is therefore not subscribed.
		if (TargetProduct.receipt == null)
		{
			return false;
		}


		if (TargetProduct.definition.type == ProductType.NonConsumable)
		{
			return true;
		}

		var subscriptionManager = new SubscriptionManager(TargetProduct, null);
		var info = subscriptionManager.getSubscriptionInfo();
		return info.isSubscribed() == Result.True;
	}

I thank you in advance for your help

Best regards

Unfortunately this is a known issue in 4.12 but 5.x versions of IAP resolve this issue. Any real refunds should still be handled correctly in 4.12 because the client will receive a notification from the store.

Thank you for your reply.
How Can I upgrade the package to 5.X? In the package manager I’m stuck in version 4.12.2.

You should be able to add the package by name.

thank you for the screenshot. I saw yesterday this version on the documentation but because it is a preview version I’m a bit worry to use it in production.
Is it fine to release my ios/android app using this version?