How do I test Cordova iAP?

0 favourites
  • 2 posts
From the Asset Store
Soldiers` Test
$12.99 USD
A Construct version 2 & 3 "Stand-alone" RPG game with "In-Game Module" (IGM) integration.
  • Im trying to set up an in-app purchase to remove ads using Cranberry's Cordova iAP.. Does anyone have experience with this?

    I'm most of the way there, but I can't figure out how to enable a test mode. Ive tested the purchase once, but it doesn't reset after restarting the app.. am I able to test the in-app purchase more than once? I want to test it a few times to make sure it works properly..

    Or alternatively do I need to actually publish it to production and make it public for it to work? Im pretty stuck on this.. would totally appreciate any help.

    Things Ive done:

    -Set up a 'managed' in-app product in Dev Console (ProductID = removeads)

    -Uploaded my test apk to both Alpha and Beta.

    The event system in my project looks like this:

    (Im using a value loaded from localstorage into a dictionary to turn the ad system on and off.)

    title screen eventsheet

    On Start of Layout

    CordovaiAP > Add Product IDs "removeads"

    CordovaiAP > Request Store listing

    On request store listing Succeeded

    CordovaiAP > Restore purchases (tag"removeads")

    On Start of Layout

    LocalStorage > Check item "removeads" exists

    LocalStorage On item "removeads" exists

    Dictionary > Add key "removeads" with value LocalStorage.Item.Value

    LocalStorage On item "removeads" missing

    Dictionary > Add key "removeads" with value=0

    menu event sheet

    On Start of Layout

    +Has product "remove" ads

    Dictionary > Add key "removeads" with value=1

    Button(purchase button) > Set invisible

    On touched Button(purchase button)

    CordovaiAP > Purchase product "removeads"

    On purchase product "removeads" success

    Dictionary > Add key "removeads" value =1

    Button(purchase button) > Set invisible

    On purchase product "removeads" fail

    Dictionary > Add key "removeads" value=0

    On end of Layout

    LocalStorage > Set item "removeads" to Dictionary.Get("removeads")

    Main game eventsheet

    On start of layout

    +Dictionary "removeads" = 0 > enable ads group

    +Dictionary "removeads" = 1 > disable ads group

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I can actually answer this myself now. AndreasR helped me out with a work around.

    Basically you can just make a button (sprite) which on touch calls the iAP Consume action to 'consume' your product. That clears it, allowing you to test the purchase again. Very useful trick.

    "On touch Button" -> "Cordova IAP" -> "Consume Product" ->"Your Product ID".

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