{"id":1048,"date":"2023-01-26T17:38:00","date_gmt":"2023-01-26T17:38:00","guid":{"rendered":"https:\/\/www.kolkataonweb.com\/code-bank\/?p=1048"},"modified":"2025-02-09T20:00:48","modified_gmt":"2025-02-09T20:00:48","slug":"state-changes-during-an-in-app-purchase-in-ionic-cordova","status":"publish","type":"post","link":"https:\/\/www.kolkataonweb.com\/code-bank\/miscellaneous\/state-changes-during-an-in-app-purchase-in-ionic-cordova\/","title":{"rendered":"State changes during an in-app purchase in Ionic Cordova"},"content":{"rendered":"<p>Here is a cleaner and summarized version of the data\/state changes that are crucial for recording the transaction.<\/p>\n<p>For raw dumps view this article &#8211; <a title=\"Ionic Cordova In-App Purchase Plugin Events Data Dumps\" href=\"https:\/\/www.kolkataonweb.com\/code-bank\/miscellaneous\/ionic-cordova-in-app-purchase-event-data-dumps\/\">Ionic Cordova In-App Purchase Plugin Events Data Dumps<\/a><\/p>\n<pre class='wp-code-highlight prettyprint'>---------------------------------\r\nSTART OF NEW PURCHASE \r\n---------------------------------\r\nstate:requested\r\ncanPurchase: false\r\nowned: false\r\n\r\nstate:initiated\r\ncanPurchase: false\r\nowned: false\r\n\r\nstate:initiated\r\ncanPurchase: false\r\nowned: false\r\n\r\nstate:approved\r\ncanPurchase: false\r\nowned: false\r\n\r\nstate:approved\r\ncanPurchase: false\r\nowned: false\r\n\r\nstate:approved\r\ncanPurchase: false\r\nowned: false\r\n\r\nstate:approved\r\ncanPurchase: false\r\nowned: false\r\n\r\nstate:finished\r\ncanPurchase: false\r\nowned: false\r\n\r\nAT THIS POINT - OWNED event listener is fired\r\n\r\n\"state\":\"owned\"\r\n\"canPurchase\":false\r\n\"owned\":true\r\n\r\nstate:owned\r\ncanPurchase: false\r\nowned: true\r\n\r\n\r\n-----------------------------------------\r\nAFTER CANCELLED AND CANCELLATION COMPLETE\r\n-----------------------------------------\r\nstate:valid\r\nowned:false\r\ncanPurchase:true\r\n\r\nstate:valid\r\nowned:false\r\ncanPurchase:true\r\n\r\n\r\nPURCHASE CANCELLED is called when the \r\n\tPopup is cancelled\r\n\tWhen an expired Subscription is removed from Google Play\r\n\r\n\r\n-----------------------------------------------------------------------------------------\r\nWHEN THE SUBSCRIPTION IS VALID IT IS GIVING the below on screen change or app open\r\n-----------------------------------------------------------------------------------------\r\nstate:valid\r\nowned:false\r\ncanPurchase:true\r\n\r\nstate:valid\r\nowned:false\r\ncanPurchase:true\r\n\r\nstate:approved\r\ncanPurchase: false\r\nowned: false\r\n\r\nstate:approved\r\ncanPurchase: false\r\nowned: false\r\n\r\nstate:approved\r\ncanPurchase: false\r\nowned: false\r\n\r\nstate:approved\r\ncanPurchase: false\r\nowned: false\r\n\r\nAT THIS POINT - OWNED event listener is fired\r\n\r\nstate:owned\r\ncanPurchase: false\r\nowned: true\r\n\r\nstate:owned\r\ncanPurchase: false\r\nowned: true\r\n\r\n\r\nThe Transaction ID (GPA.3341-6605-8567-18617) changes after new purchases are made\r\nThe Purchase Token (cpfjfhlbkagpjhgcoejgmajg.AO-J1Oxa8jFURcHtEBngM5zuU...) changes after new purchases are taken. \r\n\r\n<\/pre>\n<p>Please note the purchase token will remain same as long the Subscription doesn&#8217;t fail or cancelled. The subscription auto-renews and will have the same &#8220;<span style=\"color: #0000ff;\">Purchase Token<\/span>&#8220;. But if the renewal fails and the grace period is over or the subscription is cancelled and re-subscribed, a new &#8220;<span style=\"color: #0000ff;\">Purchase Token<\/span>&#8221; will be generated.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &#8211; Ionic Cordova In-App Purchase Plugin Events Data Dumps &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; START OF NEW PURCHASE &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; state:requested canPurchase: false owned: false state:initiated canPurchase: false owned: false state:initiated canPurchase: false owned: false state:approved&hellip; <a class=\"more-link\" href=\"https:\/\/www.kolkataonweb.com\/code-bank\/miscellaneous\/state-changes-during-an-in-app-purchase-in-ionic-cordova\/\">Continue reading <span class=\"screen-reader-text\">State changes during an in-app purchase in Ionic Cordova<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,3],"tags":[397,290,402,403,396,408],"class_list":["post-1048","post","type-post","status-publish","format-standard","hentry","category-miscellaneous","category-php","tag-cordova","tag-in-app-purchase","tag-in-app-pucrchase","tag-in-app-pucrchase2","tag-ionic","tag-ionic-play-store-subscription","entry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts\/1048","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/comments?post=1048"}],"version-history":[{"count":5,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts\/1048\/revisions"}],"predecessor-version":[{"id":1068,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts\/1048\/revisions\/1068"}],"wp:attachment":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/media?parent=1048"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/categories?post=1048"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/tags?post=1048"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}