Abs3akt
Abs3akt

Reputation: 397

Detect event success purchases Unity3D

My game is for IOS platform, I need close window with suggestion buy when user press ok from Success purchase Popup, but how detect this event? or maybe close this window when they press Buy ? How is correct ?

enter image description here

Upvotes: 1

Views: 113

Answers (1)

Abs3akt
Abs3akt

Reputation: 397

I detected when is success event purchased in this method -

public PurchaseProcessingResult ProcessPurchase (PurchaseEventArgs args)
    {

        if (String.Equals (args.purchasedProduct.definition.id, kProductIDSubscription, StringComparison.Ordinal)) {
            var builder = ConfigurationBuilder.Instance (StandardPurchasingModule.Instance ());
            var appleConfig = builder.Configure<IAppleConfiguration> ();
            DateTime? data = validate (appleConfig.appReceipt, kProductIDSubscription);
            if (data == null) {
                Debug.Log ("data then purchased");
            } else {
                Debug.Log ("Date: " + data);
            }
            if (data != null) {
                //Here is your code for success subscribed
                isPurchased = true;
            }
            #endif
        }   

        else {
            Debug.Log (string.Format ("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
        }
        return PurchaseProcessingResult.Complete;
    }

Upvotes: 1

Related Questions