1 Reply Latest reply: Sep 27, 2014 5:55 PM by dsgVajra RSS

    productStore.restoreTransactions() - doesn't return the transaction and productStore.makePurchaseTransaction(PRODUCT_ID) - nothing happens when trying to purchase purchased product

    yx Community Member

      Hi!

       

      I have the a non-consumable in-app purchase product in my app. I use Adobe ProductStore ANE (com.adobe.ane.productStore) to work with Apple AppStore.

       

      The whole flow is:

       

      1. I call productStore.restoreTransactions() to check if the user have purchased the product already

      2. If RESTORE_TRANSACTION_SUCCESS fires I check if there's my PRODUCT_ID (product id of my in-app product) is in e.transactions

      3. If RESTORE_TRANSACTION_COMPLETE fires without RESTORE_TRANSACTION_SUCCESS I check productStore.pendingTransactions if there's a transaction with precept and my PRODUCT_ID

      4. If I have a pending transaction with my PRODUCT_ID and receipt != null  I call productStore.finishTransaction(pendingTransactionID)

      4. If I didn't find get the transaction neither with productStore.restoreTransactions() nor with productStore.pendingTransactions then I decide that the user didn't purchase my in-app product, so I show him the LOCK_SCREEN when he can buy the product

      5. If the user decides to but my product I call productStore.makePurchaseTransaction(PRODUCT_ID) (listening to PURCHASE_TRANSACTION_CANCEL, PURCHASE_TRANSACTION_FAIL, PURCHASE_TRANSACTION_SUCCESS events)

       

      My flow doesn't works well.


      1. I've created a test user in iTunesConnect

      2. I have number of devices for the test.

      3. When I run my app very first time in a device I get the LOCK_SCREEN and when I tap the lock I get the iOS popup with confirm purchase, I confirm my purchase with the test user credits and get the PURCHASE_TRANSACTION_SUCCESS event

      4. When I remove my app from the device and run it I can see in the debugger that I get a transaction with my PRODUCT_ID and receipt != null so I know the I've already purchased the app, I call productStore.finishTransaction(pendingTransactionID) (Maybe I don't have to do this?) and then I get RESTORE_TRANSACTION_SUCCESS event and I can continue the game.

      5. When I remove my app from the device again and install it again, I don't get any transaction when I call productStore.restoreTransactions() and I don't have any ransaction with my PRODICT_ID and receipt != null in  productStore.pendingTransactions. So I decide that I didn't purchase the product, show me the LOCK_SCREEN, and when I call  productStore.makePurchaseTransaction(PRODUCT_ID), nothing happens. No popup with confirmation appears, no event fires, nothing. My app stacks.


      6. When I install the app in the second device and use the same credits that I've used in the first device I get the transaction in productStore.restoreTransactions()

      7. When I remove the app from the second device, install it there again and run it I got the same that in point 5.

       

      What do I do wrong?

       

      Thank you in advance,

      Olga