Mobile IAP on Android not triggering success or error

  • Hi. I added the IAP plugin and exported a debug APK via built in build service.

    In first layout I used the register product and puglic key action and finished registration.

    This shows up in debug console:

    [C3 IAP] Initialising

    scripts/c3runtime.js:442 Made with Construct 3, the game and app creator :: construct.net

    scripts/c3runtime.js:442 [C3 runtime] Hosted in DOM, rendering with WebGL 2 [Mali-G72] (standard compositing)

    main.js:11 [C3 IAP] Registering product "adfree_10_2019"

    scripts/c3runtime.js:466 [C3 advert] Event (configuration complete Error () Type () Amount (0))

    main.js:11 [C3 IAP] store ready

    Then I used the IAP triggers for On Success and on Error and both call a function to load files and continue but neither one is triggered and the app does not contine to do anything.

    Is this the normal behavior for a debug APK (app is in store already) or why is nothing happening?

    /edit: PS: Can I use the register product and complete registration actions on every layout or should I use it only once on startup?

  • The app is in the store now (internal test) but its still the same. It does not trigger success or error and is stuck at the first layout. Ashley

    Not sure if I should report this as bug and I can't share my key there?

    I used on start:

    Set pub key

    register prod

    Finish regustration

    On success

    Call function, load files,

    Goto next layout

    On error

    Call function, load files,

    Goto layout

  • Any idea why console says iap ready but neither on success or on error is triggered? 🤔

    What's wrong?

    I added 1 iap item and it's active in Google Play console.

    Ashley

  • This isn't my area - tagging Nepeo . Usually these issues come down to a misconfiguration.

  • Which success handler are you registering? IAP has 3 different success handlers, none of them are called "On success".

    You should only need to register the products once, as the store exists for the duration of the session. I expect attempting registration again will simply be ignored.

  • Nepeo Sorry. Here is the code I used:

    + System: On start of layout

    -> MobileIAP: Set public key to "longstringoflettersandnumbers"

    -> MobileIAP: Add product ID "adfree_10_2019" with type Non-consumable

    -> MobileIAP: Complete product registration

    + MobileIAP: On store registration success

    -> Browser: Log in console: "IAP Registration SUCCESS"

    -> Functions: Call LoadFiles

    + MobileIAP: On store registration failed

    -> Browser: Log in console: "IAP ERROR: "&MobileIAP.ErrorMessage

    -> Functions: Call LoadFiles

    LoadFiles loads the AJAX files I use and then goes to next layout. I used it on Start of Layout before I added IAP and just added the IAP registration and then the registration success/error triggers to continue after IAP is initialized.

    But it does not continue and just stays at the first layout forever after adding the IAP part. Even after publishing it to internal test branch on Google Play (dont know if it will work on debug apk but if it doesnt work it should trigger on error?) but it's the same as in my local debug apk.

    PS: Any chance to add subscriptions to the IAP plugin? :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It might be that there's a bug, the original samples I produced actually don't wait for registration to complete so they aren't testing those triggers. I'll review the code and see if there is any obvious problems.

  • Thanks. Is there a problem with "On Pruduct Available" Triggers too? I tried to use it to show the available products on a page but nothing shows.

    I try to use this Product available and a trigger once now, but I cant use MobileIAP.ProductID cause its not in the trigger and I have to add all product strings manually.

    + MobileIAP: Product "adfree_10_2019" available for purchase

    + System: Trigger once

    -> Browser: Log in console: "Product adfree_10_2019 available!"

    ----+ StoreText: ID = "SpecialName"

    -----> StoreText: Set text to MobileIAP.ProductName("adfree_10_2019")

    ----+ StoreText: ID = "SpecialDesc"

    -----> StoreText: Set text to MobileIAP.ProductDescription("adfree_10_2019")

    ----+ StoreText: ID = "SpecialPrice"

    -----> StoreText: Set text to MobileIAP.ProductPrice("adfree_10_2019")

    ----+ PurchaseButton: ID = "adfree_10_2019"

    -----> PurchaseButton: Set Visible

  • Nepeo does the iap plugin support promo codes? Play console requires to add promotion API before I can create codes for IAP products.

    developer.android.com/google/play/billing/billing_promotions.html

  • Is the new billing library included in the iap plugin or can you add it? It says I have to add it before creating promo codes for free iap items.

    developer.android.com/google/play/billing/billing_library_overview

    And are there any plans to update it to allow rewarded items and subscriptions? Nepeo

  • We're planning to update the billing library, the cordova plugin for Mobile IAP is forked off a third party project so we have been waiting on them to complete the work. It's been a couple of weeks since I've checked, so they might have finished. I will take a look today, it would be nice to get it in place for the next stable.

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