iAP callback - will it always fire?

Assuming that store.init has been called and that store.isActive and that store.canMakePurchases, then if you attempt a purchase by using store.purchase,  are you guaranteed the transaction callback function will be called?

At the moment I am assuming that it will be called one way or another, either success, failure or unknown. The situation is that the user requests to use a new level of the game and if he doesn’t own it already I try to sell it to him and then if his purchase is successful I just immediately run that new level, otherwise he has to go back to the previous level.  So I am pretty much hung up if the callback never happens.  That seems a bit risky to me, but if the callback basically will always happen, it should be ok.

Any advice on this is appreciated.

Hey, @stardustJerry, I think you’ll get the callback, but it wouldn’t hurt to add some sort of timeout mechanics, and if it times out before the callback, you’d want to let the user know and return to the previous level.  If the purchase concludes successfully (but much later than normal,) you could always unlock that level and the next time the user is ready to try it, it would be available for him/her.  At least that’s how I would go about working with it.

Good luck.

Naomi

Thanks @Naomi  Yes, I think doing a timeout will work.  I did think that would be one way to do it.  it reminds me of some old-time business programming I used to do where we did record-locking and timeouts.

Now I have to decide what is a reasonable time to wait. I"m thinking if the transaction takes longer than 10 seconds I’ll just carry on with the previous level and later, if the transaction does come through, do the unlock for next time - as you say.

-Jerry

Hey, @stardustJerry, 10 seconds sounds good to me.  I usually go for 15 seconds for timeout (and sometimes longer for some events), but I do find that 15 seconds can feel like forever.

Naomi

There is a thing about 15 seconds.  When we were doing early websites in the mid 90’s if a page didn’t come up within 15 seconds, it was expected the user would leave your site.  Maybe now he/she will leave an app.

Wow, that is interesting.  Maybe I should consider reducing the timeout to 10 seconds…  but then… there are times when it takes users way more than 30 seconds to finish the task and come back to app… 

For example, (and it really kills me to think I have no other way around it, honestly,) I have a Facebook login that users would go through when connecting to FB, and unfortunately, unlike iOS version, Android version does not suspend while user is entering FB credentials.  Even when it times out in 30 seconds, I still end up seeing timeout message to popup when I return to the app after successfully logging into FB.  But then, I need this time out.  Without it, if the user simply closes the FB login screen without signing in and return to the app, the app would simply wait and wait for something to happen (with the activity indicator spinning forever) – so the timeout is necessary.  I can’t win with this one…  

Now that I think about it, I should really consider reducing it to 10 seconds anyway (because even with 30 seconds, I see the timeout message anyway…)

Naomi

Yeah, these little gotchas can eat up a lot of time. 

I’m not having users log in yet, so I have that look forward to B)

I did do facebook login for a client’s app, but that was a native IPhone/objective C project so I don’t know what I will experience with Corona.

Hey, @stardustJerry, I think you’ll get the callback, but it wouldn’t hurt to add some sort of timeout mechanics, and if it times out before the callback, you’d want to let the user know and return to the previous level.  If the purchase concludes successfully (but much later than normal,) you could always unlock that level and the next time the user is ready to try it, it would be available for him/her.  At least that’s how I would go about working with it.

Good luck.

Naomi

Thanks @Naomi  Yes, I think doing a timeout will work.  I did think that would be one way to do it.  it reminds me of some old-time business programming I used to do where we did record-locking and timeouts.

Now I have to decide what is a reasonable time to wait. I"m thinking if the transaction takes longer than 10 seconds I’ll just carry on with the previous level and later, if the transaction does come through, do the unlock for next time - as you say.

-Jerry

Hey, @stardustJerry, 10 seconds sounds good to me.  I usually go for 15 seconds for timeout (and sometimes longer for some events), but I do find that 15 seconds can feel like forever.

Naomi

There is a thing about 15 seconds.  When we were doing early websites in the mid 90’s if a page didn’t come up within 15 seconds, it was expected the user would leave your site.  Maybe now he/she will leave an app.

Wow, that is interesting.  Maybe I should consider reducing the timeout to 10 seconds…  but then… there are times when it takes users way more than 30 seconds to finish the task and come back to app… 

For example, (and it really kills me to think I have no other way around it, honestly,) I have a Facebook login that users would go through when connecting to FB, and unfortunately, unlike iOS version, Android version does not suspend while user is entering FB credentials.  Even when it times out in 30 seconds, I still end up seeing timeout message to popup when I return to the app after successfully logging into FB.  But then, I need this time out.  Without it, if the user simply closes the FB login screen without signing in and return to the app, the app would simply wait and wait for something to happen (with the activity indicator spinning forever) – so the timeout is necessary.  I can’t win with this one…  

Now that I think about it, I should really consider reducing it to 10 seconds anyway (because even with 30 seconds, I see the timeout message anyway…)

Naomi

Yeah, these little gotchas can eat up a lot of time. 

I’m not having users log in yet, so I have that look forward to B)

I did do facebook login for a client’s app, but that was a native IPhone/objective C project so I don’t know what I will experience with Corona.