Tag Archives: in-app purchase

State changes during an in-app purchase in Ionic Cordova

Here is a cleaner and summarized version of the data/state changes that are crucial for recording the transaction.

For raw dumps view this article – Ionic Cordova In-App Purchase Plugin Events Data Dumps

---------------------------------
START OF NEW PURCHASE 
---------------------------------
state:requested
canPurchase: false
owned: false

state:initiated
canPurchase: false
owned: false

state:initiated
canPurchase: false
owned: false

state:approved
canPurchase: false
owned: false

state:approved
canPurchase: false
owned: false

state:approved
canPurchase: false
owned: false

state:approved
canPurchase: false
owned: false

state:finished
canPurchase: false
owned: false

AT THIS POINT - OWNED event listener is fired

"state":"owned"
"canPurchase":false
"owned":true

state:owned
canPurchase: false
owned: true


-----------------------------------------
AFTER CANCELLED AND CANCELLATION COMPLETE
-----------------------------------------
state:valid
owned:false
canPurchase:true

state:valid
owned:false
canPurchase:true


PURCHASE CANCELLED is called when the 
	Popup is cancelled
	When an expired Subscription is removed from Google Play


-----------------------------------------------------------------------------------------
WHEN THE SUBSCRIPTION IS VALID IT IS GIVING the below on screen change or app open
-----------------------------------------------------------------------------------------
state:valid
owned:false
canPurchase:true

state:valid
owned:false
canPurchase:true

state:approved
canPurchase: false
owned: false

state:approved
canPurchase: false
owned: false

state:approved
canPurchase: false
owned: false

state:approved
canPurchase: false
owned: false

AT THIS POINT - OWNED event listener is fired

state:owned
canPurchase: false
owned: true

state:owned
canPurchase: false
owned: true


The Transaction ID (GPA.3341-6605-8567-18617) changes after new purchases are made
The Purchase Token (cpfjfhlbkagpjhgcoejgmajg.AO-J1Oxa8jFURcHtEBngM5zuU...) changes after new purchases are taken. 

Please note the purchase token will remain same as long the Subscription doesn’t fail or cancelled. The subscription auto-renews and will have the same “Purchase Token“. But if the renewal fails and the grace period is over or the subscription is cancelled and re-subscribed, a new “Purchase Token” will be generated.

Apple In-app Purchase and App Rejections

Developers and app owners often have doesn’t have clear view on where in-app purchase is must and when other payment gateways are allowed in their iOS App. Confusions often lead to app rejection.

Apple has clear guidelines (read rules) on when in-app purchase is must and when other payment gateways are allowed.

Here I am putting which kind of payments can be taken through third party gateways. It is an exact excerpt from the full Apple guidelines

3.1.3 Other Purchase Methods: The following apps may use purchase methods other than in-app purchase. Apps in this section cannot, either within the app or through communications sent to points of contact obtained from account registration within the app (like email or text), encourage users to use a purchasing method other than in-app purchase.

3.1.3(a) “Reader” Apps: Apps may allow a user to access previously purchased content or content subscriptions (specifically: magazines, newspapers, books, audio, music, and video). Reader apps may offer account creation for free tiers, and account management functionality for existing customers.

3.1.3(b) Multiplatform Services: Apps that operate across multiple platforms may allow users to access content, subscriptions, or features they have acquired in your app on other platforms or your web site, including consumable items in multi-platform games, provided those items are also available as in-app purchases within the app.

3.1.3(c) Enterprise Services: If your app is only sold directly by you to organizations or groups for their employees or students (for example professional databases and classroom management tools), you may allow enterprise users to access previously-purchased content or subscriptions. Consumer, single user, or family sales must use in-app purchase.

3.1.3(d) Person-to-Person Services: If your app enables the purchase of realtime person-to-person services between two individuals (for example tutoring students, medical consultations, real estate tours, or fitness training), you may use purchase methods other than in-app purchase to collect those payments. One-to-few and one-to-many realtime services must use in-app purchase.

3.1.3(e) Goods and Services Outside of the App: If your app enables people to purchase physical goods or services that will be consumed outside of the app, you must use purchase methods other than in-app purchase to collect those payments, such as Apple Pay or traditional credit card entry.

3.1.3(f) Free Stand-alone Apps: Free apps acting as a stand-alone companion to a paid web based tool (eg. VOIP, Cloud Storage, Email Services, Web Hosting) do not need to use in-app purchase, provided there is no purchasing inside the app, or calls to action for purchase outside of the app.

Except the above mentioned cases all other payments will have to be in-app purchases.

A few more things on in-app purchases

  1. The purchase screen, must have the Item Name, Description, Benefits and Price clearly mentioned.
  2. In case of subscriptions the time duration must be clearly mentioned.
  3. The Item Name and Price must match with that defined in the app store.
  4. On the screen where the Payment button is there, or before the user can initiate the payment process, he/she should be shown a few texts. Below are some guidelines only, it should be properly phrased
    1. Payment will be charged to iTunes account
    2. The purchase will renew or not
      Example text for auto renewal subscriptions – Subscription will automatically renew for the same time length for the same price until it is cancelled in iTunes store at least 24 hours prior to the end of the current period.

      Example text for Consumables – This is a consumable product and doesn’t require any renewal.
    3. When the account will be charged
      Account will be charged for renewal of Subscriptions within 24 hours prior to the end of the current period with the same price 
      – this is required in case of auto renewing subscriptions.
      This consumable doesn’t have any validity period or expiry date — For Consumables.
    4. Links to app’s Privacy Policy and Terms & Conditions.

Submit the in-app items while submitting the app for review.

Here is the full guidelines of Apple – https://developer.apple.com/app-store/review/guidelines/#in-app-purchase . Somehow this link is not returned in searches easily.

The above thing can be done for the Android version also.