Is Unity IAP correct?

when clicked buy in Fake Store.

when clicked Cancle in Fake Store

IAP Button’s Component’s On Purchase Complete (product) use below function Purchase()
and On Purchase Failed use Failed()

public class PurchaseManager : MonoBehaviour
{

    public void Purchase()
    {
        print("success");
    }

    public void Failed()
    {
        print("Failed");
    }
}

Is this right?
warning or error are showing, but the function is working properly. can i just do it?