question

fuchsiagroan avatar image
fuchsiagroan asked

Use Web App JS API in phonegap HTML5 app?

We have a HTML5 app packaged up for Android in PhoneGap. We need in-app purchasing. If we sell the app via Amazon's store, can we include and use the javascript in-app purchasing API for "Hosted Apps" from inside the packaged app?
iap
10 |5000

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 Fuchsiagroan, Thank you for writing to us. Unfortunately you can not use JS API for Amazon IAP in your app since your app is a native android app which uses phonegap framework internally to provide native support from the html pages. In order to use Amazon IAP js sdk, your map must be defined as web app in Amazon Distribution Portal and there you are supposed to define only the launch page url of your app. We wrap your app pages in a native app (having activity and Amazon webview) and provide support for Amazon IAP JS sdk. The solution I can suggest you is, since your app is a hybrid app, you can use our IAP SDK for Android ( https://developer.amazon.com/sdk/in-app-purchasing.html) in your app. At that case you would need a javascript interface to talk to native android from your apps js script.
10 |5000

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

fuchsiagroan avatar image
fuchsiagroan answered
Thanks Sujoy. (iOS7 problems have delayed me getting back to you. :roll: ) I think I've misunderstood how web apps works. You say, [i]"We wrap your app pages in a native app (having activity and Amazon webview) and provide support for Amazon IAP"[/i]. Can you confirm that Amazon produce a native app from our web page, and that every time the user launches the app, it won't be downloaded from our server? Because that would be fine.
10 |5000

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 Fuchsiagroan, Thank you for writing back. Yes, we do prepare a native app (apk) contains Amazon web view and we launch the startup page of a html5 app (by loading it from server) in it. The apk would be downloaded in users device once he purchases the app. But when the app would launch in the device, it would fetch all the web app resources from the server (the path of what you have defined already in the app settings in portal). Amazon web tester is made with the same wrapper and its given for testing the html5 app to show the developers how their app would look like.
10 |5000

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

Marcus Weil avatar image
Marcus Weil answered
We had to implement Amazon IAP in our own app. There's PhoneGap / Cordova plugin that can help you to achieve this: https://github.com/zoxxx/cordova-plugin-amazon-in-app-purchasing
10 |5000

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