Cancelled purchases through Amazon plugin return 'failed' event response.

In our app, which is currently live on Google and Apple stores, our in-app purchases are processed through Corona’s store API. The following problem only occurs on Amazon devices, which use this Amazon in-app purchase plugin.

When attempting an in-app purchase through our app, if the user exits the purchase process before finalizing the purchase, an event type of ‘failed’ is returned to our ‘transaction callback’ function associated with the store init. With the other stores, this action normally returns a ‘cancelled’ event response.

Finalized purchases are successful as expected.

This problem is keeping us from publishing to Amazon, because our app traps failed transaction results and posts an error message to our users. Amazon rejects our app with a message that we should not post an error on a cancelled purchase. I agree.

Please advise,

Thank you.

Why not simply say “if I’m an amazon store, treat failed like cancelled”.    The documentation states this:

http://docs.coronalabs.com/daily/plugin/amazon.iap/index.html

Transaction objects in the purchase callback will never be in the state
“cancelled”. The state will be “failed” if the user canceled the
transaction.

Rob

Rob,

I missed that in the documentation, thank you for pointing it out. It doesn’t solve my problem, but merely states my problem is by Corona’s or Amazon’s design.

Why not indeed. In our case, a we ignore cancelled payments but alert our customers when a payment fails. With Google and Apple stores posting appropriate cancelled vs. failed responses, this works nicely and provides a clear user experience around our purchase system. Treating ‘cancelled’ transactions as ‘failed’ transactions in our system would confuse our customers. Relying on the store’s dialogs to alert our customers has historically been hit or miss. Sometimes they don’t even pay attention to them and I cannot control the store’s alerts, only my own. In my perspective, the less calls or emails of confusion from our customers the better.

Is the root of this problem in Amazon or Corona?

First, I wouldn’t call this a problem.  Every vendor builds the system they need and when doing Cross-platform work like we do, we can only hope to minimize differences.  There are differences between Apple and Google Play with regards to this, like there is no “restore” state for Google Play, they come in as purchases.   You had to program around that.  This is no different.  Amazon doesn’t have a cancelled stated, it is “failed” to them.

For Apple and Google, by all means show your dialog on failed.  But if your on Amazon, silently move on.

But to answer your question Amazon built their plugin.

Why not simply say “if I’m an amazon store, treat failed like cancelled”.    The documentation states this:

http://docs.coronalabs.com/daily/plugin/amazon.iap/index.html

Transaction objects in the purchase callback will never be in the state
“cancelled”. The state will be “failed” if the user canceled the
transaction.

Rob

Rob,

I missed that in the documentation, thank you for pointing it out. It doesn’t solve my problem, but merely states my problem is by Corona’s or Amazon’s design.

Why not indeed. In our case, a we ignore cancelled payments but alert our customers when a payment fails. With Google and Apple stores posting appropriate cancelled vs. failed responses, this works nicely and provides a clear user experience around our purchase system. Treating ‘cancelled’ transactions as ‘failed’ transactions in our system would confuse our customers. Relying on the store’s dialogs to alert our customers has historically been hit or miss. Sometimes they don’t even pay attention to them and I cannot control the store’s alerts, only my own. In my perspective, the less calls or emails of confusion from our customers the better.

Is the root of this problem in Amazon or Corona?

First, I wouldn’t call this a problem.  Every vendor builds the system they need and when doing Cross-platform work like we do, we can only hope to minimize differences.  There are differences between Apple and Google Play with regards to this, like there is no “restore” state for Google Play, they come in as purchases.   You had to program around that.  This is no different.  Amazon doesn’t have a cancelled stated, it is “failed” to them.

For Apple and Google, by all means show your dialog on failed.  But if your on Amazon, silently move on.

But to answer your question Amazon built their plugin.

I guess the question I have with this is that on the Google Play and iTunes stores, purchases and restores can fail for other reasons.  Do Amazon AppStore purchases not fail for any other reason?  And if they do fail for other reasons, the Amazon expected behavior is just not to display anything? 

I assume that they will display messaging instead?

Hi thegdog,

Refer to  the end of this page to the flow chart.

https://developer.amazon.com/public/apis/earn/in-app-purchasing/docs/flowchart

The Amazon Client will indicate that the purchase has failed.

-Preston

Thanks, tamkinp.  That is very helpful.

Do you have a flowchart for the restore procedure as well?  I am curious if there is a problem during restore, do you also handle messaging the user?

Since the iTunes and Google Play stores don’t enter the callback if there are no products to restore, I have a timeout period where if nothing happens after a certain number of seconds, I notify the user that they have no purchases to restore.  Is that something that should also happen for the Amazon AppStore?  Or will you tell the user that they have no purchases to restore?

Does doing a restore issue any Amazon log-in screen by default (like iTunes) or does it not require a login (like Google Play)?  For iTunes, I also trap that the user entered the wrong password and the restore failed.  Not sure if I need to do that for the Amazon AppStore as well.

And I apologize if this is on your site, but I did a search for “restore” and “restore purchases”, but no results were found.

Hi thegdog,

Great questions.

You will not get a callback if there are no products to restore to match the other store types in the Corona API.

The native Android Amazon SDK does make this call back, but the plugin does not pass this on, again to stay consistent with the other stores.

This is my understanding of the Amazon Appstore simply from my own experiences. Users will not see a login screen in normal operation. It is possible for them to see a login screen under certain circumstances. I think this happens if the data for the Appstore itself is cleared on the device and similar sorts of circumstances. In any case, this has nothing to do with the IAP plugin and everything to do with Amazon DRM that is added to your app. I do not think your code will even run(none of it) until after the login screen appears.

I would advise you contact Amazon support to understand this more(https://developer.amazon.com/public/support/contact/contact-us).

I do not think the user will be able to even use your app if they don’t login correctly(as Appstore and apps installed by it are strongly coupled to a user), but again, you can contact Amazon support for more.

I hope this helps.

-Preston

Thank you, Preston.

And sorry for assuming that you worked for Amazon.  Just seen you answering a lot of Amazon IAP questions, so thought maybe you did.   :slight_smile:

Definitely appreciate the information.

I guess the question I have with this is that on the Google Play and iTunes stores, purchases and restores can fail for other reasons.  Do Amazon AppStore purchases not fail for any other reason?  And if they do fail for other reasons, the Amazon expected behavior is just not to display anything? 

I assume that they will display messaging instead?

Hi thegdog,

Refer to  the end of this page to the flow chart.

https://developer.amazon.com/public/apis/earn/in-app-purchasing/docs/flowchart

The Amazon Client will indicate that the purchase has failed.

-Preston

Thanks, tamkinp.  That is very helpful.

Do you have a flowchart for the restore procedure as well?  I am curious if there is a problem during restore, do you also handle messaging the user?

Since the iTunes and Google Play stores don’t enter the callback if there are no products to restore, I have a timeout period where if nothing happens after a certain number of seconds, I notify the user that they have no purchases to restore.  Is that something that should also happen for the Amazon AppStore?  Or will you tell the user that they have no purchases to restore?

Does doing a restore issue any Amazon log-in screen by default (like iTunes) or does it not require a login (like Google Play)?  For iTunes, I also trap that the user entered the wrong password and the restore failed.  Not sure if I need to do that for the Amazon AppStore as well.

And I apologize if this is on your site, but I did a search for “restore” and “restore purchases”, but no results were found.

Hi thegdog,

Great questions.

You will not get a callback if there are no products to restore to match the other store types in the Corona API.

The native Android Amazon SDK does make this call back, but the plugin does not pass this on, again to stay consistent with the other stores.

This is my understanding of the Amazon Appstore simply from my own experiences. Users will not see a login screen in normal operation. It is possible for them to see a login screen under certain circumstances. I think this happens if the data for the Appstore itself is cleared on the device and similar sorts of circumstances. In any case, this has nothing to do with the IAP plugin and everything to do with Amazon DRM that is added to your app. I do not think your code will even run(none of it) until after the login screen appears.

I would advise you contact Amazon support to understand this more(https://developer.amazon.com/public/support/contact/contact-us).

I do not think the user will be able to even use your app if they don’t login correctly(as Appstore and apps installed by it are strongly coupled to a user), but again, you can contact Amazon support for more.

I hope this helps.

-Preston

Thank you, Preston.

And sorry for assuming that you worked for Amazon.  Just seen you answering a lot of Amazon IAP questions, so thought maybe you did.   :slight_smile:

Definitely appreciate the information.