03-16-2023 11:52 PM
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
Solved! Go to Solution.
03-17-2023 03:23 AM
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.
03-17-2023 01:12 AM
Did you call ConsumePurchase() after dispensing your currency? That should clear the product from the user's purchases.
03-17-2023 02:39 AM
No, i didnt
03-17-2023 02:58 AM
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.
03-17-2023 03:23 AM
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.
03-17-2023 04:29 AM
should i put it inside LaunchCheckoutFlowCallback after the purchase is complete? or it should be a void?
03-17-2023 05:33 AM
IAP.ConsumePurchase(FiveThousandDabloonString).OnComplete(msg =>
{
if (msg.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.
}
});
can the NewVariable be a msg? or no?
03-17-2023 05:35 AM
03-17-2023 06:22 AM
ITS WORKING! THANKS! ITS BEEN 2 WEEKS!
03-17-2023 07:31 AM
Do you know anything like that but for Durable items?