[Resolved] storeListener (transactionCallback) isn't getting any event back...

I’m not getting any event response after store.purchase(“my_sku”) is called.  I’m not getting any errors or anything.  It’s just waiting for the event response.

I’m testing this on Kindle Fire (original) with:

AmazonSDKTester installed

amazon.sdktester.json installed

I do the following in main.lua

store.init( transactionCallback )  print("The currently logged in user is: ", store.getUserId()) store.restore() if store.canLoadProducts == true then     store.loadProducts( myProductTable, loadProductsCallback ) end

The #event.products upon loadProductsCallback is 12, and it lists out all the IAP products.  I have a print statement to indicate that store.purchase(“my_sku”) is being called, and “my_sku” matches with what I want to purchase.

The my_sku is formatted like this:  com.mycompany.mygame.product1

My store.purchase function works fine with iOS IAP as well as GooglePlay In-App Billing.  I just don’t understand why I’m not getting any event response.  Any idea why?  I’m totally stumped and don’t know what I should do.

Naomi

Hi Naomi,

Just to be clear: store.getUserId(), store.restore(), store.canLoadProducts and store.loadProducts() are behaving as you expect them to? Can you include all your code including the ‘require’ statement and the ‘purchase’ statement?

If the callbacks for restore() and loadProducts() are correctly working with the Amazon IAP Plugin than I know of no reason why purchase will not operate correctly. Can you see the response from the Amazon SDK Tester in your adb logcat?

-Preston

Hi Preston, thank you for your response.  Distilling the relevant code is quit a bit involved because I use single code base to cover both Apple, Google Play and Amazon.  But here are answers to your more specific question:

store.getUserId() returns DefaultTestUser

store.restore() does nothing (because there’s nothing to restore, I suppose)

store.canLoadProducts is true because it calls store.loadProducts( myProductTable, loadProductsCallback ) without fail.

store.loadProducts works as expected because I see the list of products being printed out on terminal as expected.

For require statement, I do:  store = require(“plugin.amazon.iap”)

For purchase, all I do is something like:

local buyThis = “com.mycompany.mygame.product1”

store.purchase( buythis )

I’m not sure what you mean by seeing the response from the Amazon SDK Tester in my adb logcat.  What do I look for to spot it?  (BTW, I do  ./adb logcat Corona:V *:S , and maybe that’s why I don’t see the response from the Amazon SDK Tester?  I’ll see if I see anything by doing  ./adb logcat instead.)

Naomi

Here are amazon related log that I see on logcat:

V/Corona  ( 6348): > Class.forName: plugin.amazon.iap.LuaLoader

V/Corona  ( 6348): < Class.forName: plugin.amazon.iap.LuaLoader

V/Corona  ( 6348): Loading via reflection: plugin.amazon.iap.LuaLoader

D/PurchasingManager( 6348): In App Purchasing SDK - Sandbox Mode: PurchasingObserver registered: plugin.amazon.iap.CoronaPurchasingObserver@406f2830

D/SandboxRequestHandler( 6348): In App Purchasing SDK - Sandbox Mode: sendGetUserIdRequest

I/AmazonSDKTester( 6367): Sending UserId Response Broadcast ({“status”:“SUCCESSFUL”,“requestId”:“d568e62e-366c-4d7e-8b6b-8d96825f0575”,“userId”:“DefaultTestUser”})

D/SandboxResponseHandler( 6348): In App Purchasing SDK - Sandbox Mode: handleResponse

D/SandboxResponseHandler( 6348): In App Purchasing SDK - Sandbox Mode: Running Runnable for userIdResponse with requestId: d568e62e-366c-4d7e-8b6b-8d96825f0575

I/Corona  ( 6348): The currently logged in user is:     DefaultTestUser

D/SandboxRequestHandler( 6348): In App Purchasing SDK - Sandbox Mode: sendPurchaseUpdatesRequest

I/AmazonSDKTester( 6367): Sending Purchase Updates Response Broadcast ({“offset”:“1375838559789”,“status”:“SUCCESSFUL”,“requestId”:“224dea3e-53f3-4957-85e0-9cc0573e1779”,“isMore”:false,“userId”:“DefaultTestUser”})

D/SandboxRequestHandler( 6348): In App Purchasing SDK - Sandbox Mode: sendItemDataRequest

D/SandboxResponseHandler( 6348): In App Purchasing SDK - Sandbox Mode: handleResponse

D/SandboxResponseHandler( 6348): In App Purchasing SDK - Sandbox Mode: Running Runnable for purchaseUpdatesResponse with requestId: 224dea3e-53f3-4957-85e0-9cc0573e1779

I/AmazonSDKTester( 6367): Sending Item Data Response Broadcast ({“items”:{" <<— and it lists out IAP products here

Ugh, and I just realized I don’t require the right store in shop module.  I mean, I require regular store, rather than plugin store, in this particular module.  Yikes.  

That’s probably why nothing is happening with store.purchase.  This is what happens with single code base.  

Preston, I’m so sorry about troubling you with this.

Naomi

Edit:  And yes, it worked!  Whew.

Hi Naomi,

I am happy to help and I am glad you found your issue. Please feel free to post another topic if you have anymore questions.

-Preston

Hi Naomi,

Just to be clear: store.getUserId(), store.restore(), store.canLoadProducts and store.loadProducts() are behaving as you expect them to? Can you include all your code including the ‘require’ statement and the ‘purchase’ statement?

If the callbacks for restore() and loadProducts() are correctly working with the Amazon IAP Plugin than I know of no reason why purchase will not operate correctly. Can you see the response from the Amazon SDK Tester in your adb logcat?

-Preston

Hi Preston, thank you for your response.  Distilling the relevant code is quit a bit involved because I use single code base to cover both Apple, Google Play and Amazon.  But here are answers to your more specific question:

store.getUserId() returns DefaultTestUser

store.restore() does nothing (because there’s nothing to restore, I suppose)

store.canLoadProducts is true because it calls store.loadProducts( myProductTable, loadProductsCallback ) without fail.

store.loadProducts works as expected because I see the list of products being printed out on terminal as expected.

For require statement, I do:  store = require(“plugin.amazon.iap”)

For purchase, all I do is something like:

local buyThis = “com.mycompany.mygame.product1”

store.purchase( buythis )

I’m not sure what you mean by seeing the response from the Amazon SDK Tester in my adb logcat.  What do I look for to spot it?  (BTW, I do  ./adb logcat Corona:V *:S , and maybe that’s why I don’t see the response from the Amazon SDK Tester?  I’ll see if I see anything by doing  ./adb logcat instead.)

Naomi

Here are amazon related log that I see on logcat:

V/Corona  ( 6348): > Class.forName: plugin.amazon.iap.LuaLoader

V/Corona  ( 6348): < Class.forName: plugin.amazon.iap.LuaLoader

V/Corona  ( 6348): Loading via reflection: plugin.amazon.iap.LuaLoader

D/PurchasingManager( 6348): In App Purchasing SDK - Sandbox Mode: PurchasingObserver registered: plugin.amazon.iap.CoronaPurchasingObserver@406f2830

D/SandboxRequestHandler( 6348): In App Purchasing SDK - Sandbox Mode: sendGetUserIdRequest

I/AmazonSDKTester( 6367): Sending UserId Response Broadcast ({“status”:“SUCCESSFUL”,“requestId”:“d568e62e-366c-4d7e-8b6b-8d96825f0575”,“userId”:“DefaultTestUser”})

D/SandboxResponseHandler( 6348): In App Purchasing SDK - Sandbox Mode: handleResponse

D/SandboxResponseHandler( 6348): In App Purchasing SDK - Sandbox Mode: Running Runnable for userIdResponse with requestId: d568e62e-366c-4d7e-8b6b-8d96825f0575

I/Corona  ( 6348): The currently logged in user is:     DefaultTestUser

D/SandboxRequestHandler( 6348): In App Purchasing SDK - Sandbox Mode: sendPurchaseUpdatesRequest

I/AmazonSDKTester( 6367): Sending Purchase Updates Response Broadcast ({“offset”:“1375838559789”,“status”:“SUCCESSFUL”,“requestId”:“224dea3e-53f3-4957-85e0-9cc0573e1779”,“isMore”:false,“userId”:“DefaultTestUser”})

D/SandboxRequestHandler( 6348): In App Purchasing SDK - Sandbox Mode: sendItemDataRequest

D/SandboxResponseHandler( 6348): In App Purchasing SDK - Sandbox Mode: handleResponse

D/SandboxResponseHandler( 6348): In App Purchasing SDK - Sandbox Mode: Running Runnable for purchaseUpdatesResponse with requestId: 224dea3e-53f3-4957-85e0-9cc0573e1779

I/AmazonSDKTester( 6367): Sending Item Data Response Broadcast ({“items”:{" <<— and it lists out IAP products here

Ugh, and I just realized I don’t require the right store in shop module.  I mean, I require regular store, rather than plugin store, in this particular module.  Yikes.  

That’s probably why nothing is happening with store.purchase.  This is what happens with single code base.  

Preston, I’m so sorry about troubling you with this.

Naomi

Edit:  And yes, it worked!  Whew.

Hi Naomi,

I am happy to help and I am glad you found your issue. Please feel free to post another topic if you have anymore questions.

-Preston