I'm trying to implement a non-consumable in-app purchase.
Purchase sequence:
mobileStoreEnablePurchaseUpdates
mobileStoreSetProductType "com.runrev.sampleapp.nonconsumable", "inapp"
mobileStoreMakePurchase "com.runrev.sampleapp.nonconsumable", "1", "This belongs to me"
The purchase sequence successfully triggers a "purchaseStateUpdate" event, with a pState of "paymentReceived".
Restore sequence:
mobileStoreEnablePurchaseUpdates
mobileStoreRestorePurchases
The restore sequence does NOT trigger a "purchaseStateUpdate" event.
Because of this, I'm running into problems with two use cases:
1) User installs app, user purchases non-consumable, user deletes app, user re-installs app. The user then cannot re-purchase the non-consumable, as they get an "alreadyEntitled" pState.
2) User installs app on one device, user purchases non-consumable, user installs app on 2nd device. I thought that in this situation the user should be automatically entitled to receive the non-consumable on the 2nd device.
I realise that a work around would be to treat a "alreadyEntitled" pState in the same way that I treat a "paymentReceived" pState, but it does leave the user having to re-push the purchase button - without knowing that they will NOT be charged - which if I was the user I'd probably be too annoyed to do.
Note - I have read the following in the dictionary entry for mobileStoreRestorePurchases -
Consumable products cannot be restored, except when interacting with the Google Play Store in-app purchasing API... Which left me with some existential questions about this command
Any advice on how to get mobileStoreRestorePurchases to work for non-consumables on Google Play?
Thanks in advance
Kim
Solved - mobileStoreRestorePurchases on Google Play
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Solved - mobileStoreRestorePurchases on Google Play
Last edited by KimD on Sat Apr 08, 2017 4:51 am, edited 1 time in total.
-
- Livecode Staff Member
- Posts: 818
- Joined: Fri Feb 06, 2015 4:03 pm
Re: mobileStoreRestorePurchases - on Google Play
Hi Kim,
Calling "mobileStoreRestorePurchases" triggers a "purchaseStateUpdate" msg with status="restored". So you have to handle this case in the "purchaseStateUpdate" handler. The user will not be asked to re-purchase the item in this case.
See this lesson for more details:
http://lessons.livecode.com/m/4069/l/18 ... play-store
Best regards,
Panos
--
Calling "mobileStoreRestorePurchases" triggers a "purchaseStateUpdate" msg with status="restored". So you have to handle this case in the "purchaseStateUpdate" handler. The user will not be asked to re-purchase the item in this case.
See this lesson for more details:
http://lessons.livecode.com/m/4069/l/18 ... play-store
Best regards,
Panos
--
Re: mobileStoreRestorePurchases - on Google Play
Thanks Panos
I've spent a few hours playing around with this. What I'm seeing is that:
mobileStoreRestorePurchases works if it is called in a script that is located on a button.
mobileStoreRestorePurchases does not work if it is called in a script that is located in the OpenCard handler of my first card. I had been trying to implement it this way so that my app would automatically restore purchases.
In both cases my code was -
if environment() is "mobile" then
mobileStoreEnablePurchaseUpdates
mobileStoreRestorePurchases
end if
Regards
Kim
LC 8.1.2 rc3 on Windows 7.
I've spent a few hours playing around with this. What I'm seeing is that:
mobileStoreRestorePurchases works if it is called in a script that is located on a button.
mobileStoreRestorePurchases does not work if it is called in a script that is located in the OpenCard handler of my first card. I had been trying to implement it this way so that my app would automatically restore purchases.
In both cases my code was -
if environment() is "mobile" then
mobileStoreEnablePurchaseUpdates
mobileStoreRestorePurchases
end if
Regards
Kim
LC 8.1.2 rc3 on Windows 7.
-
- Livecode Staff Member
- Posts: 818
- Joined: Fri Feb 06, 2015 4:03 pm
Re: mobileStoreRestorePurchases - on Google Play
Hi Kim,
hmm interesting. What happens if you try this:
Best,
Panos
--
hmm interesting. What happens if you try this:
Code: Select all
on preopenstack
if environment() is "mobile" then
mobileStoreEnablePurchaseUpdates
send "restorePurchases" to me in 100 milliseconds
end if
end preopenstack
on restorePurchases
mobileStoreRestorePurchases
end restorePurchases
Panos
--
Re: Solved - mobileStoreRestorePurchases on Google Play
Thanks Panos
Getting it to execute outside of the OpenCard handler makes all of the difference.
On OpenCard // the first card in my stack
if environment() is "mobile" then
mobileStoreEnablePurchaseUpdates
mobileStoreRestorePurchases // Does NOT work
send "mobileStoreRestorePurchases" to me in 100 milliseconds // Does work
end if
end OpenCard
Weird
Kim
Getting it to execute outside of the OpenCard handler makes all of the difference.
On OpenCard // the first card in my stack
if environment() is "mobile" then
mobileStoreEnablePurchaseUpdates
mobileStoreRestorePurchases // Does NOT work
send "mobileStoreRestorePurchases" to me in 100 milliseconds // Does work
end if
end OpenCard
Weird
Kim