question

Dada E. avatar image
Dada E. asked

Testing IAP

Hi,

We are trying to adopt the Javascript IAP API into our HTML5 application. I have a few questions about the API that I couldn't figure out from the documentation.

1. What are the targeted platforms? Does it work with any Android devices with Appstore installed or does it only work with Kindle Fire? I uploaded the sample application, 'button-clicker' into our server and tested with "Amazon WebApp Tester," but the purchase popup couldn't be displayed (Tested with Nexus 4, HTC thunderbolt; both Appstore installed) whereas those popups can be displayed in the regular Android browsers or PC browsers (tested with Chrome on MacOS). Would the result be different if we used a Kindle?

2. When the URL is displayed as the amazon webapp, does it send any parameter or a header to the URL so that the server will know where it's coming from?

Thanks,

Satoshi Mobile Developer at Buongiorno/Dada Entertainment

web apps
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dada E. avatar image
Dada E. answered
Also to test the IAP, does the application need to be submitted and approved or is there a stage that I can test before the final submission?
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered

Hi Dadamusicbox,

Thank you for posting and sorry for the delay to respond. Our IAP js sdk should work in all Amazon and non Amazon devices as well. In-App Purchasing testing tools allows you to test your IAP implementation in a production-like environment before submitting your app for publication. The tools allow you to construct test cases that cover responses generated by In-App Purchasing API for JavaScript.

In a live environment, your app makes API calls to the AmazonServices JavaScript library. The library, in turn, makes AJAX calls to the Amazon services to fulfill requests such as purchaseItem, getItemData, getPurchaseUpdates etc. Only apps that have been approved and published through the Distribution Portal can communicate with Amazon's services. The SDK Tester provides a sandbox test environment that enables you to test IAP implementation before you submit your web app to the Amazon Mobile App Distribution Portal.

In order to test the IAP in your app (Button clicker at this case) you need to follow this link : https://developer.amazon.com/sdk/webapps/iap/testing-iap.html

You can use User Agent Strings to identify the requests coming from Kindle fires. Details can be found here : https://developer.amazon.com/sdk/fire/specifications.html#UserAgentStrings

Let me know if User Agent Strings do not provide the right solution to you.

10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dada E. avatar image
Dada E. answered

Hi Sujoy,

Thanks for your reply. There are still some parts that aren't clear to me:

- The webapp needs to be distributed through the Amazon Appstore, is it correct? If it's distributed through the store, would it be wrapped in a native wrapper and users would download an apk file, or would it be displayed in a special browser?

- If not, can the webpage be accessed through non-Amazon browser such as Chrome and still able to use the IAP API?

- If being displayed in a special browser is the requirement, then does it send any information to the webapp that identifies that it's coming from the special browser/wrapper? We'll need an information through which we can identify the user can use Amazon IAP (The user-agent only tells that it's kindle or not...it cannot cover non-kindle devices: We won't know if the IAP is available for those devices; we use multiple billing methods)

Let me know.

Thanks,

Satoshi

Message was edited by: dadaentertainment

10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered

Hi Satoshi,

Yes. The app has to be distributed through Amazon Appstore. And we do wrap web app with a native wrapper developed by us. Amazon's web app runtime is built on the open-source Chromium browser and is optimized for fluid performance on Kindle Fire. You should find more information about the web app runtime here : https://developer.amazon.com/sdk/webapps/runtime-feature-support.html

For Generic Android devices the user agent string should be this "Mozilla/5.0 (Linux; U; Android 4.0.3; ; KFJWA Build/IML74K) AppleWebKit/ (KHTML, like Gecko) Version/4.0 Safari/" User agent strings for non amazon devices can be found here : https://developer.amazon.com/sdk/webapps/faq.html#distribution

IAP would be available in the devices (generic android) having App Store client installed. By using the user-agent you can put the required element/script in the pages (from server side) to enable IAP for the sessions created from the app distributed through app store.

10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dada E. avatar image
Dada E. answered

Hi Sujoy, When the app is wrapped, is there any native code being called for the IAP through a Javascript interface or using ShouldOverrideURL method? If not, does the IAP work when the webapp is being accessed from a regular browser (given the app being published on the appstore; but not accessed through appstore)?

Thanks,

Satoshi

10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered

Hi Satoshi,

Thank you for writing back. The we apps need to be distributed through Amazon App Store. It would be wrapped in a native app and user would download an apk for your web app ultimately.

In order to Amazon IAP work in your web app, the app must be wrapped with the wrapper provided with Amazon sdks environment. So for testing, the Amazon web App tester works as a wrapper (having support for IAP) and for live we make an apk for you where we display app pages in Amazon web view what is made on to of chrome client.

To identify the users requests whether they are coming from the web app distributed through Amazon store you should use the user agent information comes with the request header. Accordingly you form your pages to configure the elements to interact with Amazon IAP JS client. More information about user agent is available here : https://developer.amazon.com/sdk/webapps/faq.html#distribution

10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dada E. avatar image
Dada E. answered

Thank you so much. Our doubts are solved now.

10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.