Forum Discussion
alkashebat
2 years agoProtege
IAPs Not working second time
I have a consumable item setup in my Meta Dashboard and have it implemented in my game. When you go buy it in-game for the first time, the pop ups to purchase appears and you can purchase it. Then the next time you try to purchase, there's no popup. But the purchase is successful and the currency is being given.
Support saying "go on forums" but no one ever answers me.
Can anybody help me? im pretty sure my script IS okay.
Unity 2021.3.19f1
After you call the checkout flow and successfully make the purchase, you dispense currency in your game. Ideally, what you should do after that is to call Platform.IAP.ConsumePurchase() to notify the API that you have successfully dispensed the currency. Kinda like this:
Platform.IAP.ConsumePurchase([your_SKU_here]).OnComplete([newVariable] => { if ([newVariable].IsError) { // Insert whatever bit of code to execute here if ConsumePurchase fails. } else { // Insert whatever bit of code to execute here if ConsumePurchase is successful. // You can use [newVariable].Data to access any other data that was fetched // when ConsumePurchase was executed. } });AFAIK, this only works for consumables. It should make the purchase popup prompt show up again.
15 Replies
- onenightblitzProtege
Did you call ConsumePurchase() after dispensing your currency? That should clear the product from the user's purchases.
- alkashebatProtege
No, i didnt
- onenightblitzProtege
After you call the checkout flow and successfully make the purchase, you dispense currency in your game. Ideally, what you should do after that is to call Platform.IAP.ConsumePurchase() to notify the API that you have successfully dispensed the currency. Kinda like this:
Platform.IAP.ConsumePurchase([your_SKU_here]).OnComplete([newVariable] => { if ([newVariable].IsError) { // Insert whatever bit of code to execute here if ConsumePurchase fails. } else { // Insert whatever bit of code to execute here if ConsumePurchase is successful. // You can use [newVariable].Data to access any other data that was fetched // when ConsumePurchase was executed. } });AFAIK, this only works for consumables. It should make the purchase popup prompt show up again.
- alkashebatProtege
okay i just tried, didnt work even for Durable item. How can we or i invite Oculus (Meta) Employee here? it seems to be their bug, not mine.
- onenightblitzProtege
normally i'd use msg.Data to get the purchase list but if msg.GetPurchaseList() does the same thing with minimal performance impact then you should be ok
- alkashebatProtege
Thanks! Also idrk if you can help me, but i have 2 problems in following post:
https://communityforums.atmeta.com/t5/Unity-VR-Development/1-Game-says-to-set-Oculus-App-Id-when-its-already-set-2-Game/m-p/1048582#M22010 - clrkeHonored Guest
Help! GetPurchaseList() returns zero results even though I have the durable item purchased 😞
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 1 month ago
- 5 years ago