I have tried the last two weeks to get this working using multiple plugins.
I am using Prime 31 as the pluging now and here is the rundown.
I have a sprite acting like a button, when someone presses this texture, I want the google payment screen to pop up (which it does) and when the payment succeeds, add 500 coins to the player pref?
Here is my code
using UnityEngine;
using System.Collections;
public class coins500 : MonoBehaviour {
static int coins01;
static int bought;
void OnEnable(){
IABAndroidManager.purchaseSucceededEvent += purchaseSucceededEvent;
}
// Use this for initialization
void Start () {
var key = "etc";
IABAndroid.init( key );
IABAndroid.startCheckBillingAvailableRequest();
}
void purchaseSucceededEvent( string productId )
{
coins01 = 500 + PlayerPrefs.GetInt ("Coins");
PlayerPrefs.SetInt ("Coins", + coins01);
PlayerPrefs.Save ();
}
void OnMouseDown () {
IABAndroid.purchaseProduct ("android.test.purchased");
}
}
}
It wont give the player the 500 coins when the purchase works? what im I missing???