Ruzard
Ruzard

Reputation: 1359

Testing in-app purchases in Kindle Fire application

I am not able to test in app purchases even with Amazon Appstore SDK Tester.

public void onPurchaseResponse(final PurchaseResponse purchaseResponse)

purchaseResponse always has "INVALID_SKU" even if I have amazon.sdktester.json file with fake JSON.

file content: { "test" : { "itemType": "CONSUMABLE", "price": 0.99, "title": "More Clicks!", "description": "Click your button ten more times!", "smallIconUrl": "http://www.google.com/images/srpr/logo3w.png" },

"com.amazon.buttonclicker.ten_clicks" : {
    "itemType": "CONSUMABLE",
    "price": 0.99,
    "title": "More Clicks!",
    "description": "Click your button ten more times!",
    "smallIconUrl": "http://www.google.com/images/srpr/logo3w.png"
  },

  "com.amazon.buttonclicker.blue_button" : {
    "itemType": "ENTITLED",
    "price": 0.99,
    "title": "Blue Button",
    "description": "Button Clicker - Now in Blue!",
    "smallIconUrl": "http://www.google.com/images/srpr/logo3w.png"
  }
}

Even sample application does not work. Do you have any suggestions how to test application? It seems that Amazon SDK Tester does not intercept requests.

Upvotes: 4

Views: 4203

Answers (5)

Justin
Justin

Reputation: 4520

I have faced with the issue that the same as your, the key is: in your java code, your item id must equal to your SKU in json file, in this case, it must be: com.amazon.buttonclicker.ten_clicks or com.amazon.buttonclicker.blue_button Here is the example json file for SampleIAPConsumablesApp and SampleIAPEntitlementsApp sample project provied by Amazon:

{
"com.amazon.sample.iap.consumable.orange" : {

    "itemType": "CONSUMABLE",

    "price": 0.99,

    "title": "More Clicks!",

    "description": "Click your button ten more times!",

    "smallIconUrl": "http://some/image.jpg"

  },

  "com.amazon.sample.iap.entitlement.level2" : {

    "itemType": "ENTITLED",

    "price": 0.99,

    "title": "Blue Button",

    "description": "Button Clicker - Now in Blue!",

    "smallIconUrl": "http://some/image.jpg"

  }
}  

Goodluck!

Upvotes: 0

Roshan
Roshan

Reputation: 111

Here's how I got the In App purchases to work on Kindle Fire (after several hrs of struggle...)

  1. adb install AmazonSDKTester.apk (Install SDKTester on Kindle Fire)
  2. Create a file amazon.sdktester.json in the SDCARD directory (The connected KF shows up as SDCARD in Finder on ur Mac)
  3. Contents of amazon.sdktester.json - { "com.yourcompany.yourpkgname.200_coins" : { "itemType": "CONSUMABLE", "price": 0.99, "title": "200 COINS", "description": "2 COINS", "smallIconUrl": "http://www.yourcompany.com/icon.png" } }
  4. Press the power button on KF & press "Disconnect" button - Now KF is no longer a mounted drive on ur Mac.
  5. Run the AmazonSDKTester app on KF.
  6. Run your app from Eclipse. Make sure the package name in the JSON matches the In App Item SKU on Amazon's website & in the PurchasingManager.initiatePurchaseRequest("com.yourcompany.yourpkgname.200_coins");
  7. Now you should see the In App interstitials showing up.
  8. Still doesn't work - Force Close both your app & AmazonSDKTester on KF; Hard Reset KF ; Restart Eclipse & Restart from Step 1

Upvotes: 4

jaysquared.com
jaysquared.com

Reputation: 216

Don't forget the outer enclosing {} braces in your json. It took me 3 hours until I figured that out...

Upvotes: 2

Ryan Routon
Ryan Routon

Reputation: 86

Make sure to hit the disconnect button after you connect the usb cable to your pc, otherewise the SDK tester will not be able to read the JSON file you moved over since the device is mounted at that point. Found this out the hard way.

Upvotes: 1

Ruzard
Ruzard

Reputation: 1359

It looks like magic but hard reset resolved all my problems.

Upvotes: 1

Related Questions