Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

IAP restore > store.restore()
Started by dirindon Oct 21 2016 02:59 AM

5 replies to this topic
restore iap callback store.restore() store
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

dirindon

[GLOBAL: userInfoPane.html]
dirindon
  • Enthusiast

  • 47 posts
  • Corona SDK

I have new apple account, I call store.restore()

nothing was returned. 

 

Now... why I dont have a return code that indicates there are nothing to restore?

 

I have an app with subscriptions model. And well I MUST detect if user had any previous transactions and if not.

For now I was doing it with 30 second timer, so if nothing was returned from store.restore() in 30 seconds period, it would mean it was fresh account. 

 

But well this way isn't good.

 

 Is there any way to detect that user didn't purchased anything?

With actually CALLBACK or any return information?

 

Since I found out the store.restore() might not return anything at all even when I had products purchased, or with very bad network it might attempt to return values after 30 second period. And I can't allow to extend the timer to lets say 10 minutes, or 5 minutes or even by 1 second, because its totally not user friendly to lock him for 1 min so he will wait until restore is done.

 

Thanks in advance.

 

 



[TOPIC: post.html]
#2

bjsorrentino

[GLOBAL: userInfoPane.html]
bjsorrentino
  • Veteran

  • 8,506 posts
  • Corona SDK

Hi @dirindon,

The "storeTransaction" listener you set up should be called each time a product (to restore) is found. Are you not seeing that ever happen? In other words, it won't come through as one giant "batch" of products to restore, but rather one-by-one. Also, I don't believe Corona has any control over how "fast" this process occurs, or what Apple is sending back as restored... we are essentially just using Apple's IAP functionality internally.

 

Best regards,

Brent



[TOPIC: post.html]
#3

dirindon

[GLOBAL: userInfoPane.html]
dirindon
  • Enthusiast

  • 47 posts
  • Corona SDK

Well yes I know it, and yes I got reply with transaction when my account purchaed something before. My problem isn't the speed nor the thing that they return 1 by 1. My issue is that when user have account without any purchase store.restore() doesn't return anything, while it should return information it finished running. As well as it would be super easy to return all products at once. Apple have functionality that informs when restore finished running, so if Corona IAP is based on Apple's why it's not here or not avaliable?



[TOPIC: post.html]
#4

krystian6

[GLOBAL: userInfoPane.html]
krystian6
  • Contributor

  • 560 posts
  • Corona SDK

@Brent

 

What dirindon meant is that we don't get any call after the whole operation completed, and this totally sucks. We never know if we should expect more products to come or not, and this is especially irritating when dealing with subscriptions [because you get a lot of expired subscriptions].

 

We need an event sent when this:

https://developer.apple.com/reference/storekit/skpaymenttransactionobserver/1506101-paymentqueuerestorecompletedtran

or this:

https://developer.apple.com/reference/storekit/skpaymenttransactionobserver/1506063-paymentqueue

 

is called.

 

This really looks like a 3 liner "fix", and the 3 lines depends on the coding style you use.

 

Here's a link to the feature request:

http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/7237058-call-back-the-store-restore-callback-even-if-the



[TOPIC: post.html]
#5

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,683 posts
  • Enterprise

If your users need to restore purchases it's because the app has been deleted and reinstalled. If your app is reinstalled any activity that would have been previously purchased should be back to their locked state, such as turn off ads, the ads should be showing again.

 

Calling store.restore() will trigger a transaction event that you can use to unlock the app. If the user never unlocked the app, there is no reason to do any thing, so not getting an event is okay.

 

Where it comes into play is the desire to provide some feed back to the user that the restore is done, but that can be set on a timer, though it's not necessary.

 

Rob



[TOPIC: post.html]
#6

dirindon

[GLOBAL: userInfoPane.html]
dirindon
  • Enthusiast

  • 47 posts
  • Corona SDK

Rob its not quite true.

 

I used timer before, but I did notice with quite bad network its not reliable. I can't let user continue any registration steps until restore is done.

I did used 30 second timer which seemed enough, but I did notice in rare cases the last restore response came even after 37 seconds, and I can't guarantee that it won't come lets say after 60 seconds, which might bring negative response for users that they will wait 60 seconds each time I call restore (and I have to do it at least 1 a month, but usually much more often since users could switch their apple accounts). 

 

And I have no way to detect if its first time user did installed the app or did it for X th time (even If I would he could have single apple account across all devices or switch between accounts).

 

I agree with Krystian on this, it seems to be quite easy to add 1 more event being dispatched considering the fact that apple have such functionality ready.

 

So well I think it would be perfect Idea and generall benefit for all users to have small event saying lets say "restore finished" or anything actually that would be called on apple event. Anyway voted for the feature under feature requests. Thanks for your responses. 




[topic_controls]
[/topic_controls]