How do I make a consumable purchase. CocoonJS, Google Play

  • Hey Guys!

    I've tried making a consumable type of purchase on a Construct2 game exported via CocoonJS but it's not working on Google Play.

    The action called "on product consumed" asks for transaction ID, but how do i know it if the purchase isn't made yet?

    [attachment=1:1l2mbgud][/attachment:1l2mbgud]

    [attachment=0:1l2mbgud][/attachment:1l2mbgud]

    THANKS!

  • ludei

  • Hello,

    In this .capx provided with the latest plugin you will find an example about it.

    The expressions showed in the following picture are those ones you are missing:

    Expressions:

    CocoonJSAds.PurchaseProductId
    CocoonJSAds.PurchaseTransactionId[/code:1mwl8usn]
    However, it is up to you to keep them in memory if you want to consume them later. 
    
    Here is the link to the complete example: 
    [url]https://github.com/ludei/Construct-2-plugin/tree/master/capx[/url]
    
    Cheers.
  • ludei Thanks for the reply!

    So in the screenshot below, the item should be consumed correctly, right?

    So the code will recognize the itemID and transactionID that way, because it's an action after "purchase complete" event?

    [attachment=0:2zppj1g7][/attachment:2zppj1g7]

    Or i am wrong? (sorry for my poor programming knowledge but that's why many of us use C2 )

    P.S. IMPORTANT: I am using an outdated version of C2 because exported C2 project via CocoonJS doesn't work on iPhone 5 CocoonJS launcher. The debug shows that there are some kind of legal issues.

    We really love CocoonJS and we don't really want to see it out of Construct2! Please agree you two! Scirra

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello,

    You are writing them as Strings, delete the two " " and leave just the expressions .

    Just in case, you wrote them in the wrong box, exchange them .

    Cheers.

  • Ohh. Great!

    Thank you very much for your quick replies!

    Cheers!

  • Thank You

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