Callback on confirmed order

📘

Steps described on this page assume that you have followed previous steps and installed Unity plugin.

It is possible to receive a C# callback on a successful order. This method works with big picture, Android with UGUI, and iOS with native plugin views (current recommended configuration). For iOS, the callback is not called if web checkout was used. The callback delegate provides product information as a parameter (Monetizr.Product).

To use the callback, subscribe to MonetizrClient.Instance.MonetizrOrderConfirmed.

Code example

An example implementation is provided below.

using Monetizr;

public void MonetizrPurchaseCallback(Product p) {
    Debug.Log($"Purchase successful - {p.Tag}");
}

private void Start() {
    MonetizrClient.Instance.MonetizrOrderConfirmed += MonetizrPurchaseCallback;
}

private void OnDestroy() {
    MonetizrClient.Instance.MonetizrOrderConfirmed -= MonetizrPurchaseCallback;
}

Did this page help you?