Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / In App Purchase Process on Android

Author
Message
Arbrakan
13
Years of Service
User Offline
Joined: 10th Oct 2010
Location: Geneva
Posted: 17th Jan 2023 15:52
Hello everyone,It's been a while since I've been here.
I'm working on a card project with AGK.
The development is going well, but I can't finalize the purchase system. (In App Purchase).

The app is crashing, and I don't know if I'm doing things correctly and in the right way.

Can anyone confirm that the process is correct?

Thank you for your answers


On the start of the game :



When the button “buy” is clicked, it run this function :



On the Google Dev Console :



Thanks
Arbrakan
13
Years of Service
User Offline
Joined: 10th Oct 2010
Location: Geneva
Posted: 18th Jan 2023 09:31 Edited at: 18th Jan 2023 10:20
Update :



Now i get a Error message : "Product not recognised by Google Billing Library" when i cast the app via AppGameKit :



And the error when i publish a release on Google Play Console :
"cannot start purchase as IAP setup failed"
SFSW
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 18th Jan 2023 16:46 Edited at: 18th Jan 2023 22:24
Couple of suggestions. I would recommend you use this routine after the 'InAppPurchaseActivate(0)' command:



This will wait until the user completes the IAP process, if available. Then checking the availability again should be done after. The first error you observed is expected. Casting the app to the player through broadcast will not work with IAP's since the product name, keys, and ID will not match (your app will carry different values compared to the AppGameKit player). So the IAP option will only work once you've uploaded the bundle to Google Play.

Then if you are receiving the message about the IAP setup failing, something may not be matching. Verify the following:

- The title you are specifying in 'InAppPurchaseSetTitle()' matches the GooglePlay value exactly (compare your 'getAppName()' result with the app name as it appears in Google Play).
- The 'InAppPurchaseSetKeys()' value matches the string as displayed in GooglePlay exactly.

If those check out, perhaps there is a lingering issue with the IAP list index (or you may be using an older version with the issue). Try adding this line after your first 'InAppPurchaseAddProduct()' line, so it would look like this:



Then upload to Google Play and test again.
Arbrakan
13
Years of Service
User Offline
Joined: 10th Oct 2010
Location: Geneva
Posted: 24th Jan 2023 09:38 Edited at: 24th Jan 2023 09:39
Thank you for your quick response,

I took the time to test your suggestions, thank you, I even created a second app on GooglePlay to retest the entire process. But nothing, I still have the same error "Cannot start purchase as IAP setup failed".

Quote: "So the IAP option will only work once you've uploaded the bundle to Google Play"

Thank you, I wasn't sure, so I put it in case it helps to pinpoint the problem...

Quote: "The title you are specifying in 'InAppPurchaseSetTitle()' matches the GooglePlay value exactly (compare your 'getAppName()' result with the app name as it appears in Google Play)."

I double-checked the name, now it corresponds exactly, but no improvement in the problem.

Quote: "The 'InAppPurchaseSetKeys()' value matches the string as displayed in GooglePlay exactly."

Double-checked this too. it seems ok

Normally I have the latest version, but I still tried this solution, but nothing.


SFSW
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 24th Jan 2023 15:24
In this line:

InAppPurchaseAddProductID("token0",0)

Try using:

InAppPurchaseAddProductID("token_0",0)

Your initial ID call is lacking the underscore contained in the Google Play listing. That will need to match exactly. You included it in your first example, but it's lacking in the last one above.
Arbrakan
13
Years of Service
User Offline
Joined: 10th Oct 2010
Location: Geneva
Posted: 24th Jan 2023 15:37
Thank you, yes indeed, I also tested without underscore by creating a new product on GooglePlay, I thought that maybe the problem comes from there, but it is not that... I should have said so in my last answer.

Thanks for your time, and your help.
SFSW
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 24th Jan 2023 15:51 Edited at: 24th Jan 2023 16:10
Ok, then only other thing I can think of would be the key value not matching. Sometimes it's easy to accidently copy a space character at the end of it or missing a character. It can help to break down the key into smaller line sections in variables:

keyA$="12345678901234567890"
keyB$+"12345678901234567890"
keyC$="12345678901234567890"

And so on until the key is completed, then analyze each character set. Then run the InAppPurchaseSetKeys(keyA$+keyB$+keyC$,"") command. The error message is likely correctly pointing to the problem. Odds are, there is just something that isn't matching and the setup is failing. I'm guessing your test device has an active internet connection and you are signed into your Google account on the device? Another consideration, give the process some time before checking it's status in the game/app, just 5-10 seconds, but enough that the data exchange can take place between the device and Google even if the connection is really slow.
Arbrakan
13
Years of Service
User Offline
Joined: 10th Oct 2010
Location: Geneva
Posted: 24th Jan 2023 20:38 Edited at: 24th Jan 2023 21:11
Ok, it work !

A big thanks to you SFSW ! You help me a lot, to do the right thinks and to undestand how all this work, so thanks !

I was downloading the apk from another link and installing it on my mobile. There is also a share link once the app is published, but it was not working either. It is necessary to use the link provided in the "Testers" tab and not the link provided inthe tabs of the release version of the app.



Now... iOS..
SFSW
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 24th Jan 2023 22:02
Ah yes, good catch! Glad you got it working now.

Login to post a reply

Server time is: 2024-04-19 18:24:28
Your offset time is: 2024-04-19 18:24:28