# Initializing Ad Unit

Before ad loading, initialize Mint Mediation SDK by calling Mint.Agent.init ("appKey") with your AppKey. You had better complete this operation when the app starts. It only needs to be performed once. This is an example describing how to call Init( ) within the Start( ) method of the script attached to GameObject.

public void Start(){
  Mint.Agent.init("Your AppKey");
} 

The Mint Unity widget will trigger the initialization event to inform you of SDK initialization results. Add the following code to register to the event:

public class InitScript : MonoBehaviour {
  void Start() 
  {
MintEvents.onSdkInitSuccessEvent += SdkInitSuccessEvent;
  MintEvents.onSdkInitFailedEvent += SdkInitFailedEvent;
} }

# Is It Initialized?

After you call the init () method, you can use the following code to determine whether SDK has been initialized successfully.

// To determine the result of init()
Mint.Agent.isInitialized()

# Reporting IAP Data (Optional)

IAP is the abbreviation of in-App Purchase, which means the cost of virtual goods purchased in the app by users of this device.You can report the amount of virtual goods purchased by users through the setIAP interface of SDK. These IAP data can help us to advertise to your users more accurately, so as to obtain more ad revenue.

Mint.Agent.setIap(float count, String currency); 

Currency is a string type parameter representing currency code, which is defined in accordance with ISO 4217:2008. You can report the IAP data at any time after SDK initialization, such as processing in the onSuccess method of InitCallback. When the user's IAP behavior occurs, you can call this method to update the IAP data in a timely manner.

Mint.Agent.setIap(12.30, 'USD');