Version 5.1

IOSInAppPurchaseManager events refactored:

  • C# Actons added for all GameCenterManager events

  • Event results unified

 

In older version, we have to listener for two events like:

PRODUCT_BOUGHT and TRANSACTION_FAILED. In the new version we can use one unified event or action, here is an example how we can subscribe on this event using FLE event system (TRANSACTION_COMPLETE event) to C# actions (OnTransactionComplete action):

 

//Event Use Examples

IOSInAppPurchaseManager.instance.addEventListener(IOSInAppPurchaseManager.TRANSACTION_COMPLETE, OnTransactionComplete);

 

//Action Use Examples

IOSInAppPurchaseManager.instance.OnTransactionComplete += OnTransactionComplete;

 

The IOSStoreKitResponse class now contains state param, with will allow us to get purchase state like:

  • Purchased

  • Restored

  • Deferred

  • Failed


 

And here is the example how we can find out the purchase state, using OnTransactionComplete action:

private static void OnTransactionComplete (IOSStoreKitResponse responce) {



       Debug.Log("OnTransactionComplete: " + responce.productIdentifier);

       Debug.Log("OnTransactionComplete: state: " + responce.state);



       switch(responce.state) {

       case InAppPurchaseState.Purchased:

       case InAppPurchaseState.Restored:

           //Our product been succsesly purchased or restored

           //So we need to provide content to our user depends on productIdentifier

           UnlockProducts(responce.productIdentifier);

           break;

       case InAppPurchaseState.Deferred:

           //iOS 8 introduces Ask to Buy, which lets parents approve any purchases initiated by children

           //You should update your UI to reflect this deferred state, and expect another Transaction Complete  to be called again with a new transaction state

           //reflecting the parent's decision or after the transaction times out. Avoid blocking your UI or gameplay while waiting for the transaction to be updated.

           break;

       case InAppPurchaseState.Failed:

           //Our purchase flow is failed.

           //We can unlock interface and report user that the purchase is failed.

           break;

       }



       IOSNativePopUpManager.showMessage("Store Kit Response", "product " + responce.productIdentifier + " state: " + responce.state.ToString());

   }

Note: So far I haven’t found any specific recommendation from apple what to do when you got Deferred purchase state.  Here is how apple recommendations looks like:

You should update your UI to reflect this deferred state, and expect another Transaction Complete  to be called again with a new transaction state reflecting the parent's decision or after the transaction times out. Avoid blocking your UI or gameplay while waiting for the transaction to be updated.

In other words:

  • keep listening for complete transaction event, you will got fail / or success depends on parents decision or request timeout

  • Make sure you are not blocking UI or gameplay while waiting parents response

  • Update your UI to inform the user that purchase is waiting for approval.


 

Updated example can be founded in PaymentManagerExample.cs script.

The new version also contains following updates:

 

IOSCamera:

Ability to choose image compression added


 

Billing PlayMaker Example scene Added

Scene Guide

 

Fixes:

Pre-loader Size for IOS8 fixed

Local Notification fixed and updated for IOS8