Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5615] StoreKit - cancelled event called when user doesn't have a credit card and goes to add it.

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionNeeds more info
Resolution Date2018-03-31T23:41:04.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAppcelerator Modules
Labelsios, module
ReporterHugo Ramos Freire Neto
AssigneeShak Hossain
Created2018-02-22T18:16:48.000+0000
Updated2018-03-31T23:41:04.000+0000

Description

When the user doesn't have credit card on apple acount, when he click's on purchase inside the app, he is redirected to appstore to add a new card. At this moment, Storekit module fire's TRANSACTION_STATE_FAILED event with cancelled 'true'. When the user finish the credit card addition and confirm the purchase, purchased event is fired, but my app is not listenning to this event anymore, because the purchased was 'cancelled'.
Storekit.addEventListener('transactionState', function(evt) {
    hideLoading();
    switch (evt.state) {
        case Storekit.TRANSACTION_STATE_FAILED:
        		//second, when the user goes to add a credit card, TRANSACTION_STATE_FAILED with cancelled 'true' is called.
            break;
        case Storekit.TRANSACTION_STATE_PURCHASED:
						//third, when the user ends the credit card addition and confirms the purchase, TRANSACTION_STATE_PURCHASED is fired.
            break;
        case Storekit.TRANSACTION_STATE_PURCHASING:
          	//first, TRANSACTION_STATE_PURCHASING is fired.
            break;
		case Storekit.TRANSACTION_STATE_DEFERRED:
            break;
    }
});
To reproduce this issue, use the example of storekit module: https://github.com/appcelerator-modules/ti.storekit/blob/master/ios/example/app.js But it's only possible to reproduce on production, since it's not possible to add a credit card on sandbox environment. Sometimes when the user goes to add a new credit card, the app is restarted. In this case, TRANSACTION_STATE_PURCHASED is never called, but the purchase is completed.

Comments

  1. Rene Pot 2018-02-22

    might not be an issue based off of this comment https://forums.developer.apple.com/thread/64489
  2. David Benko 2018-02-22

    The user in the forum states > Therefore, if you wish to shut down your IAP class after a failed transaction you should wait about a second to give the system a chance to send that second transaction. But in my experience the second transaction (the successful one) can take even like 10 minutes to be sent. Because is the amount of time it can take for the user to add the credit card and make the purchase. The problem is that in this time the app can be closed by the operating system and I never receive the success transaction.
  3. Mostafizur Rahman 2018-03-22

    Hello [~hrfn],
Just passing a followup here.Are you able to get that sorted out?  Please let us know if you need more help with this issue. Regards
 Axway Appcelerator Support

JSON Source