Why doesn't this work? (IAP / Play Store / Local Storage )

Get help using Construct 2

Post » Thu Feb 18, 2016 3:56 pm

I want players to be able to purchase the product 'pro', have a localstorage value 'IsPro' set to '1' and set the global variable 'IsPro' to 1 also. When the layout starts it will check the localstorage value, and check the store at the same time. This way the player will also be able to use Pro features when the store listing is not accessible if they've previously purchased.

So... why doesn't it work? And I mean none of it - people can purchase, but the localstorage and global variables never set :(

Image
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 242
Reputation: 2,308

Post » Thu Feb 18, 2016 9:24 pm

Hi. I think that you need to set the local.storage (isPro key) value to the variable (isPro).
B
74
S
13
G
4
Posts: 1,006
Reputation: 8,060

Post » Thu Feb 18, 2016 10:10 pm

RBuster wrote:set the local.storage (isPro key) value to the variable (isPro).


Can you explain? That doesn't actually change anything I/O as far as I can tell....

I'd love to take it on faith but the only way of testing this is a 3-hour round-trip uploading and downloading to Intel/Google :P
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 242
Reputation: 2,308

Post » Fri Feb 19, 2016 3:59 pm

Potential solution - I'd missed 'Getting' the value after checking if it exists. Extra step provided by Ciprian Amarendei on facebook.

Image

Still waiting for the upload/build/download/upload/process saga to finish - but potentially could be the fix. It's been days puzzling over it now! Will mark solved if solved.
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 242
Reputation: 2,308

Post » Fri Feb 19, 2016 4:58 pm

To check if product has been purchased in the past you need to call "Restore puchases". With "Request store listing" you grab only products data, like product name, price etc.

However in my case "Has product" action did not work with C2 IAP plugin at all. Normally you would expect "On restore purchases complete" condition, but there is no such in C2 IAP plugin. I've switched to Cordova IAP plugin and everything worked like a charm.
ImageImageImage
B
28
S
16
G
82
Posts: 1,030
Reputation: 45,804

Post » Fri Feb 19, 2016 7:05 pm

BackendFreak wrote:To check if product has been purchased in the past you need to call "Restore puchases". With "Request store listing" you grab only products data


Frustrating to learn this, as this isn't how the manual describes its usage:
"When On store listing success triggers, the product names and prices are available, and purchases can start being made or checked with the Has product condition."

BackendFreak wrote:I've switched to Cordova IAP plugin and everything worked like a charm.


Can you provide a link to the Cordova IAP plugin? Or do you mean the Cranberrygame IAP plugin?
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 242
Reputation: 2,308

Post » Fri Feb 19, 2016 7:57 pm

You can see I had similar problem recently: viewtopic.php?f=147&t=168431

Phonegap IAP is deprecated now and no longer supported by cranberrygame. Instead he provides Cordova IAP. I don't know where can it be found for free. I have bought all his plugins here https://www.scirra.com/store/construct2 ... ugins-1662
ImageImageImage
B
28
S
16
G
82
Posts: 1,030
Reputation: 45,804

Post » Fri Feb 19, 2016 8:28 pm

Yeah I just found them on the asset store when I went looking for alternate sources (I don't have paypal so the developer's website's direct channel to the plugins is a no go for me :( )

Thanks so much for all your help - I'll report on progress...
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 242
Reputation: 2,308

Post » Fri Feb 19, 2016 10:12 pm

So far, switching to Cranberry's CordovaIAP plugin and using restore purchases hasn't worked.

Glad to finally find a place to put my app key though, as that part is entirely missing from the official plugin.

It shouldn't be this difficult. IAP is the de rigeur for paying for apps.
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 242
Reputation: 2,308

Post » Fri Feb 19, 2016 10:24 pm

Here you go. This is how I've implemented it and it works.

Image
ImageImageImage
B
28
S
16
G
82
Posts: 1,030
Reputation: 45,804

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 52 guests