- Home /
U3DXT from App store to players in-app wallet?
so i've watched the five minute video you guys posted on how to get in app purchases to work and i THINK i've got it all incorporated into my in app purchase GUI Button script . But heres my question say i have an IAP for 100 coins. in my if (GUI.Button ... ) bit i have IAPXT.Buy(coinsProductID, 100); how then do i move those coins from there to the players wallet? do i just go
if (GUI.Button(new Rect(row1,coll1,iconSize.x,iconSize.y),purchase1,noGuiStyle))
{
IAPXT.Buy(coinsProductID, 100);
currentCoins = currentCoins + 100;
}
because i feel like that would give the player coins successful purchase or not. any help you guys can offer would be GREATLY appreciated.
not sure if it notifies you when i comment to your comments so i'm gonna post this here. sorry if it emails you twice..
so e. quantity is that value at the end correct ( IAPXT.Buy(coinsProductID, 100); )?
thanks for being patient with me. I'm pretty new at the program$$anonymous$$g side of stuff and i'd like to understand as much as i can with out just coping and pasting.
Answer by u3dxt · Jul 01, 2014 at 07:26 AM
Please take a look at the sample code here: http://unity3d.tutsmobile.com/5-minute-guide-to-inapp-purchases-for-ios/
The highlight is the subscribe events function, specifically:
IAPXT.TransactionCompleted += delegate(object sender, TransactionEventArgs e) {
Log("TransactionCompleted: " + e.productID + ", " + e.quantity);
// add the coins here
};
You may also want to handle the TransactionFailed delegate by showing a message to the player.
so e. quantity is that value at the end correct ( IAPXT.Buy(coinsProductID, 100); )?
thanks for being patient with me. I'm pretty new at the program$$anonymous$$g side of stuff and i'd like to understand as much as i can with out just coping and pasting.
Answer by Saint34x · Jul 01, 2014 at 05:43 PM
so could i do something like ` coinsProductID
IAPXT.TransactionCompleted += delegate(object sender, TransactionEventArgs e) {
Log("TransactionCompleted: " + e.productID + ", " + e.quantity);
if ( e.productID == coinsProductID)
{
currentCoins = currentCoins + 100;
} else if ( e.productID == coins2ProductID)(
)
};
and so on? sorry I'm sure this is crazy simple i just can't seem to crack it. i really appreciate the help tho.
That's close, you should the quality into consideration: currentCoins = currentCoins + (100*e. quantity)
If the transaction is successful, you should see the log message on the screen.
Also, be sure to log out of your real itunes account and use the test accounts created in itunesconnect.apple.com.
Let us know if you have other questions.
Your answer
![](https://koobas.hobune.stream/wayback/20220613152916im_/https://answers.unity.com/themes/thub/images/avi.jpg)