Mobile IAP "On product owned" clarification.

0 favourites
  • 9 posts
From the Asset Store
A simple fun and stylish endless scroller game ready to be customized and published.
  • Hi,

    From the manual:

    On Product Owned

    Triggers when a specific product becomes owned. This triggers both after a first purchase for it, and on startup when the product was previously purchased, allowing easily identifying if the purchased product can be made use of.

    Where is the "owned" state stored? I was expecting to have to store it myself.

    Does the device need to be online?

    Thanks.

  • It's stored on the servers of the marketplace (Google Play or Appstore). I don't know if the device needs to be online.

    You can store the purchases in the app, but you still need to check if the product is owned when the app is launched for the first time - in case the product has been purchased before on a different device, or the app was re-installed.

    Also, people can refund the purchase. So it's still recommended to check if the product is owned occasionally.

  • It's stored on the servers of the marketplace (Google Play or Appstore). I don't know if the device needs to be online.

    You can store the purchases in the app, but you still need to check if the product is owned when the app is launched for the first time - in case the product has been purchased before on a different device, or the app was re-installed.

    Also, people can refund the purchase. So it's still recommended to check if the product is owned occasionally.

    Thanks for the clarification - I'd completely missed the case where a purchase had been made on another device! I'll store it locally to enable offline play but also try to check on every session.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have another question!

    In the manual for MobileIAP, it lists "Restore Purchases" as one of the plugin's actions. But what does that actually do?

    As I started working through implementing IAP's, the obvious (at least to me) way to implement restoring purchases was simply by checking "Product Owned". But then I noticed that entry in the manual.

  • Quick update to this:

    I looks like MobileIAP.Restore purchases causes "On product owned" to trigger.

    So the issue I have now is how to detect when the user clicks on "Restore purchases" but doesn't have the IAP (I only have one IAP)?

    Current flow:

    1. User clicks "Restore purchases"
    2. MobileIAP.Restore Purchases called
    3. If "Has product xxx" = true, then set global variable "IAPPurchased" = TRUE & alert user "Restore successful"
    4. If "Has product xxx" = false, alert user "Nothing to restore"
    5. "On product xxx owned", then set global variable "IAPPurchased" = TRUE & alert user "Purchase successful"

    The problem is that steps 1 to 4 all happen BEFORE "On product xxx owned" so that step 3 is never TRUE and "Nothing to restore" is always displayed.

    ("On product xxx owned" triggers either after a purchase or restore.)

    Another minor issue is distinguishing in step 4 whether the user has just purchased or restored the IAP. I can either change "Purchase successful" to just "Success" or store in a variable whether the last button pressed was "Purchase IAP" or "Restore Purchases" then set the message to be either "Purchase successful" or "Restore successful" accordingly.

  • Just looked at how some other games handle "Restore Purchase" when there's nothing to restore:

    1 of them did absolutely nothing

    4 of them do nothin except animate the "Restore Purchase" button to give some confirmation that it's been tapped.

    2 of them said "Restore successful" even though nothing was restored

    1 of them actually reported "Nothing to restore"

    I wondering whether that last one just waits for a few seconds before checking whether the product is owned?

  • I went down this route:

    Click "Restore Purchases" button - call "Restore purchases"

    Wait for 2 seconds (might need to increase this)

    I then check "is product owned"

    It's now working in Xcode using a Local StoreKit Configuration file

    Next step is to upload a new version to TestFlight and test it there

    (I'm skipping testing it in the Sandbox - not think that's necessary - mine is a very simple case with just one non-consumable IAP).

    This guide on testing IAPs on iOS was invaluable:

    medium.com/@Sergey.Zhuravel/in-app-purchases-in-ios-part-3-testing-purchases-in-testflight-sandbox-and-locally-in-xcode-3dec999986e1

  • Tested an IAP in TestFlight last night but it didn’t work. A quick Google suggested it was because I’d not provided my tax and banking details to Apple which I then did. Checked this morning to confirm they’d been accepted then tried the IAP again and it worked. Deleted and reinstalled the app, tried the IAP again and it said I already own it and asked if I wanted to apply it again. That also worked. Reinstalled again but this time tried to restore the purchase - that also worked. There’s a delay of a few seconds when purchasing so just want to animate the IAP button to reassure the user that something’s happening. Also just want to check all the alerts are triggering at the right time and with the right text. So I’m fairly close to start opening it up for beta testing. Now need to do similar for the Google Play store.

  • Hi, thanks for sharing your findings, I haven't published games yet, but I hope to be able to do so one day, the fact that there are no complete and detailed guides on what to do when publishing and how to manage purchases, advertising and more scares me a bit

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