Ios "cancel" State Missing, Always Returning "failed"

iOS In App Purchases:

 

According to the docs there should be a cancelled state if the user taps an in-app item, and then taps cancel on the confirmation alert. This is not working (and has not been working for at least the last 6 months) - it’s returning “failed” instead.

 

state  – A string containing the state of the transaction. Valid values are “purchased”, “restored”, “cancelled”, and “failed”.

I receive the cancelled state as I’m supposed to, not the failed state, when the user cancels the transaction from the confirmation dialogue, no problem.  I’m not sure why you aren’t… maybe it’s an issue with Enterprise specifically (which I know you use, and I don’t).

 

  • Andrew

Hi, yes you are right, I was actually writing about the wrong alert box.

 

If the user has not signed in with an appleID, an alert with 3 buttons pops up. See the image below.

 

If you hit Cancel on that alert box, the transaction event is still returned to the purchase listener, but with the state set to Failed, and not Cancelled. So the bug is for real, just in a different place than I first wrote.

 

 

local listener = function(event) local transaction = event.transaction print("STATE") print(transaction.state) -- THIS RETURNS Failed when the button pressed was Cancel if transaction.state == "purchased" then store.finishTransaction(transaction) end end store.init(listener) timer.performWithDelay(5000, function() store.purchase({"some.product"}) end, 1)

 

 

 

 

cancel.png

I receive the cancelled state as I’m supposed to, not the failed state, when the user cancels the transaction from the confirmation dialogue, no problem.  I’m not sure why you aren’t… maybe it’s an issue with Enterprise specifically (which I know you use, and I don’t).

 

  • Andrew

Hi, yes you are right, I was actually writing about the wrong alert box.

 

If the user has not signed in with an appleID, an alert with 3 buttons pops up. See the image below.

 

If you hit Cancel on that alert box, the transaction event is still returned to the purchase listener, but with the state set to Failed, and not Cancelled. So the bug is for real, just in a different place than I first wrote.

 

 

local listener = function(event) local transaction = event.transaction print("STATE") print(transaction.state) -- THIS RETURNS Failed when the button pressed was Cancel if transaction.state == "purchased" then store.finishTransaction(transaction) end end store.init(listener) timer.performWithDelay(5000, function() store.purchase({"some.product"}) end, 1)

 

 

 

 

cancel.png