Skip to content

mujpir/zarinpal_unity_plugin

Repository files navigation

Zarinpal Unity plugin

Verion 1.2 beta changelogs

  • Add support iOS platform : you can now make purchasing on iOS Devices version 8 or higher.
  • Fix error when copying android manifest to plugins folder in Mac OS.
  • Fix a few bugs

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 :

  • MercantID : Set your MerchantID that you get from zarinpal.
  • Auto Verify : If you want to verify pucrahse in client automatically , then select this option.
  • Scheme/Host : Choose a unique scheme and host. for example : if you set "gt-club" as scheme and "zarinpal_result" as host , Then zarinpal uses "gt-club://zarinpal_result" uri to return the purchase result to your unity game.

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.

About

Implement Zarinpal Iab for unity3d

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published