sebastienrousseau / generator-avionic

✈ AVIONIC - A Yeoman generator using AngularJS, Express, ngCordova, Gulp and Bower that helps you kickstart highly sophisticated Ionic projects to evolve and upgrade every aspect of your development to the next moonshot.
http://avionic.io
MIT License
11 stars 2 forks source link

Implementing iOS and Android In-App Purchase module #3

Open sebastienrousseau opened 9 years ago

sebastienrousseau commented 9 years ago

Background

In-app purchases (IAP) allow users to purchase additional content from within an app. However, purchasable content cannot be delivered through a marketplace as if it were physical inventory — you must either bundle this content with your app when you build it, anticipating that it will be unlocked upon purchase, or you must download additional content into the app.

The AirFare In-App Purchase module will be created to provide purchasing functionalities that interact with both mobile applications and RESTful web services:

In-App Purchase Options

The AirFare module needs to offer IAP through the below vendors: 1) Apple’s App Store 2) Google Play 3) Amazon In-App Purchase

Purchase Types

There are generally three classes of things users can purchase: 1) One-time purchases that last the life of the app, like unlocking the full version of the app, or downloading new content once. 2) One-time purchases that get “consumed.” Once they’re used, the app user needs to buy more. This is most commonly used for in-app currency. 3) Subscriptions where the app user pays a monthly fee to receive some ongoing service. Subscriptions can be auto-renewing or non-renewing.

Each vendor uses different terminology for these purchases. Please view this chart to help translate each vendor’s language:

Title Apple Google Amazon
One Time, Lasts Forever Non-Consumable Managed Product Entitlement
One Time; Gets Used Consumable Unmanaged Product Consumable
Subscription 1. Auto-Renewable Subscription
2. Non-Renewable Subscription
Subscription Subscription

Setup

Before you can use IAP, you must set up products in each vendor’s developer portal. This topic is too complex to detail in this issue, but in general terms, you have to:

\ For all of these vendors, you can specify a unique ID. Google and Apple calls it Product ID. Amazon calls it a SKU. In all three cases, it’s recommended that you use the “reverse domain name” system that is used in your Bundle ID/App Identifiers. If you maintain consistent identifiers, it will make cross-platform implementation easier.

Plugins

Several vendors have implemented various Cordova's In-App Purchase Plugins. In this issue, we would particularly look at the following ones to develop the AirFare IAP module:

1) When iOS Setup is completed (please refer to j3k0 plugin doc) 2) When Google Play Setup is completed (please refer to poiuytrez doc) 3) When Store Functions are completed 4) When Platform Detection is completed 5) When Sample app is created 6) When Server/APIs app are created 7) When module is added to the Avionic ✈ Yeoman generator 8) When unit tests are completed 9) When errors and cache requests are handled

Expected Sample App outcome

iap