IAP sometimes fails. iOS

IAP sometimes fails. iOS
0

#1

Hi! I just release a game and a tiny percent of the buyers through the IAP(non-consumable) are telling me that Apple charges the purchase, but the game doesn´t unlock the free version.

First, the game load the StartScene where I check this flags:

  if (UserDefault::getInstance()->getBoolForKey("GameBuyed") == true) {
        UserDefault::getInstance()->setBoolForKey("DemoVersion", false);
    }else{
         UserDefault::getInstance()->setBoolForKey("DemoVersion", true);
    }

This scene has a button to load the BuyScene where all the code for the IAP is set. Then in the “onSuccess” callback i use this to store that the player complete the purchase:

UserDefault::getInstance()->setBoolForKey("GameBuyed", true);
changeScene();`

When the purchase is complete the game loads again the StartScene with the button to buy the game removed.

This users are telling me that after have completed the purchase the buy button is still in the StartScene and if they try to restore the purchase, a message box appears telling them that there is nothing to restore. Also, If they try to buy the game again a messageBox tells them that the IAP was already buyed and ask if they want to buy it again for free. When the user accept this messageBox. The game stuck like is waiting for the onSuccess callback. (I think this because here is the call to changeScene)

I recommend the users to delete the game from their devices and reinstall it to reset the flags but they are still facing the problem.

Maybe is not correct use the UserDefault instances or check for the free or paid version in a different scene where the IAP is set.

Do you have any advise for this?


#2

how do you use the IAP::setLisnter() ?

is the listener binding to a node?


#3

Yes, i followed the same structure as the sample project so the listener is in the init of the BuyScene like this:

 sdkbox::IAP::setDebug(false);
 sdkbox::IAP::setListener(this);
 sdkbox::IAP::init();
 sdkbox::IAP::refresh();
 sdkbox::IAP::enableUserSideVerification(true);

#4

because of my bad english i didn´t found this before:
https://discuss.cocos2d-x.org/t/iap-ios-some-user-fail-to-trigger-onsuccess-listener-but-get-charged/

Seems like the problem is because Apple verified that the transaction exist but something go wrong on the system Payment has been charged but status remain in “Pending”
After Apple canceled the transaction, users success to complete the IAP

I also found this: