mujpir / zarinpal_unity_plugin

Implement Zarinpal Iab for unity3d
The Unlicense
5 stars 1 forks source link

Zarinpal Unity plugin

Verion 1.2 beta changelogs

How to make zarinpal work in unity:

1. Import the plugin into your project.

Import zarinpal_unity.unitypackage 1.2 to your project.

2. Change zarinpal setting.

After importing , click on Zarinpal/Setting menu to setup the plugin. Settings you can change :

3. Update manifest and files.

Click on "update manifest and files" button to update your manifest and copy required files into your project.

4. Initialize the plugin fisrt.

Use method

 Zarinpal.Initialize() 
at the start of your game to makes zarinpal initialized. Please note to call it once. You can take a look at zarinpal example scene and scripts to see how to use the plugin in your code..

5. make your purchase.

Use

 Zarinpal.Purchase(int amount,string productID , string desc) 
to make a purchase .

6. Use callbacks to get purchase result.

Use Callback to be aware when a purchase is succeed or failed For example subscribe to event Zarinpal.PurchaseSucceed using this line of code :


Zarinpal.PurchaseSucceed+=(string productID,string authority)=>
{
  Debug.Log("purchase succeed with authority : "+authority);
}

On Android : If you wish to change the way Zarinpal activity work or applying your style to the activity , you can go and do it here : https://github.com/mujpir/UnityZarinpalPurchaseAndroidStudio After customizing android part of the plugin , then come back here and change the c# code in unity to make plugin works with the way you have changed.

Happy making games.

Mojtaba Pirveisi Game developer at Darbache Studio.