"on product owned" doesn't trigger when a promo code is used for an IAP on Android

0 favourites
  • 7 posts
From the Asset Store
a ready made template of Mobile Advert, Google Play and Mobile IAP Plugin,
  • Hi,

    When a user attempts to purchase an IAP, I make the purchase button spin and stop it either when "on product owned" or "on product purchase failed" triggers.

    I tried entering an IAP promo code as payment method and the icon kept spinning.

    So it looks like "on product owned" doesn't trigger when a promo code is used (like it does when using a credit card or if the user is a licenced tester) - is this a bug?

    I'm working on a workaround where:

    1. User clicks the button (and I make it spin)
    2. Set a "purchaseAttemptInProgress" bool = TRUE
    3. Every tick and if that bool = TRUE, check "has product"
    4. If "has product" = TRUE, then register the IAP and set that bool = FALSE
    5. If "on product owned" triggers, then I can do the same.
    6. If "on product purchase failed" set the bool to FALSE and stop the icon spinning
    7. If the user closes the window with the IAP button, then also set it to FALSE and stop the button spinning.

    Also, does anyone know what can cause "on product purchase failed" to trigger? Specifically, does "purchase product" ever time out?

    As it stands, the button will keep spinning unless one of the above conditions is met - although I don't think this will be a problem.

  • Hi. You say the product is "non-consumable", so you don't want the player to try to buy it twice?

    I'll tell you that the plugin works correctly, you need to look at your logic.

    I recommend not to activate/display the buy buttons until you get a signal that purchases are registered.

    If the user has already bought such a product, Google simply will not let him buy a second one.

  • The problem is that "on product" owned doesn't appear to trigger if a promo code was used for the purchase but does if a normal payment method is used.

    I don't wait for "on store registration success" before showing the "buy" button but when it's clicked, I do check whether the IAP is available for purchase - if it's not, I prompt the user to check their network connection and I also attempt registration again.

    The IAP is non-consumable, and Google does stop me from buying it twice, but I don't think that's related to this problem.

  • I only use the promo for consumable purchases, so I can't say for sure if it's a bug or a feature.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Does "on product owned" trigger for you or do you check "has product" manually?

  • -I have a product to disable advertising, if a player bought it I store this value in local storage and load it every time I play. When a player enters the store if he has disabled advertising he is not shown this offer.

    -In the situation when a player deleted the game and then installed it again as soon as he enters the store he automatically activates the purchase of disabling advertising (it already does the plugin itself).

  • Just an update on this in case anyone else runs into the same problem:

    I'm sure purchasing an IAP (from within the Android) app using a promo code DOESN'T trigger "on product owned" (like it does when using a card) but it does trigger "on purchase success". Neither trigger sets "has product" = TRUE though.

    Using the promo code in the Google Play Store app (or Apple App Store) works fine.

    As a workaround, I've swapped "on product owned" out for "on purchase success" and am now using that to determine whether the user has just bought the IAP or not.

    If the user already has the product (i.e. if they've redeemed a promo code in the Store or have previously bought it and have reinstalled) it looks like "has product" = TRUE only if "complete product registration" has successfully completed (Android), and for iOS, "restore product" has also been called. (Not totally related to this issue, but I've used the above info to change my app to automatically restore purchases for both Android and iOS.)

    Of course, testing this has been a pain - partly because the app (and each build for Android) needs to have been approved by Apple/Google before IAPs can be tested completely, but mostly because, once a user has the IAP, they can't test purchasing the IAP again. I now have 14 Google accounts!!!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)