Using inapp billing...

Previous topic - Next topic

MrPlow

Hi

Can anyone help me on getting inapp billing to work.
I updated the manifest and am trying to get an alpha working but it wont allow me to add a SKU despite saying that my new permission is there for billing...

After I hit save the system say still no billing permission enabled???

Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

MrPlow

Also... one of the GLBasic store kit files doesnt contain any code...why is it there??
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

MrPlow

Okay I seem to have sorted the SKU issue just need info on the other bits...

Using the functions... ;-)
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

which platform? The storekit is createed for Ios, Google Play and Ouya. Im got the pm.

There is inapp.gbas, which im have stored so much documentation how the various functions should been used. Also checkout OYUA inapp store document for the first bit (until starting), that needed for all platforms for included files etc.

Also for Google Play you do need to upload a apk first, but DO NOT publish it, before you can adding SKU details on the Google Play.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

Thanks spacefractal...

Its the google play version...

There is a commented
// ?DEFINE ANDROID
in one of the files is that required??
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

Yes, its required, due api calls fir iOS and android is different, and still compile for other os. There is a undef trick for other platform. Look for that trick in sdk 4 thread.

Its due a bug in glbasic not included that automatic, unlike others platforms.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

Are the functions returning 1 for TRUE or 0 for TRUE?....

I was confused with the how to implement...?

Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

It's a hashed value, which is based on the key and main sku used. Uses logcat or print it to screen to checkout the two values it's output. I'm did that to confuse hackers really. It's not 0 and 1 at all.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

Great, thanks

I will try that so...testing is so awkward...
I setup a second gmail account and added it as a alphatester will that work?
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

Hi me again..!

Sorry for this but I am reluctant to commit my app to FREE status (as there is no way reverse it on Googlestore) without knowing whether  in-app billing is going to work for me or not...

Is there a sample code of

Function inapp_purchase()

         what happens on playstore...?
         does the game pause / resume or open a pop up?


end function


function restrictgame()

if not inapp_purchase()
   
     restrict my game

endif

end function
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

you cannot purchase from you own account, but only from a test account. To refund items to those test account, you can uses Google Wallet Merchant Console to do that. You could also add various test inapp purchases to checks the popup does appear or not (and also its might not Work in Android v2.2).

Uses InAppPurchase_isAvailable() for checking if the item have been purcahsed. When you want to activate a purchase, then send a InAppPurchase_Activate().

For setup SKU, insert them in the InAppConfig_SkuNames$() function.

in the IF line, store$="general", here is the internal sku you want to call from the game. You also must add the same general sku to the iID$. Etc something like this:

Code (glbasic) Select

IF iID$="0" OR iID$="com.your.internal.sku" // this might not been required for your game with multiply names. numbers ID is requireed too.

// this is the general SKU, which you want to been called by the various functions.
// This MUST been named the same SKU as the above IF statement. This due
// InAppHelper_Init() uses number ID to search for number as ID, while you call them
// with the name its self.
IF store$="general"            THEN RETURN "com.your.internal.sku"


IF store$="microsoft.windows"  THEN RETURN ""  // not working
IF store$="apple.appstore.ios" THEN RETURN ""  // Should been the samne SKU name set in the iTunes Connect and in Xcode (see the xCode project for a example).

// to get this to work on Android you MUST add this line to the AndroidManifest.xml just under other permissions:
// <uses-permission android:name="com.android.vending.BILLING" />
// Please note, you cant uses same sku for all shops, but all need to been named different. This is due
// that way Java convert and find SKU names.
IF store$="com.ouya.shop"      THEN RETURN ""  // This SKU is Products Identifier from your OUYA Portal.
IF store$="com.google.play"    THEN RETURN "sku.you.setup.on.google.play"  // This is a Managed Product listed in Google Play Console.
ENDIF


Please note InAppPurchase_isAvailable() return a hashed version, not 0/1 (can been somewhere 43954957654 for on/1269834 for off). you can use logcat or print it to screen, what that is unpurchased and which value its returns for a purchased item. Those values is based on the general internal sku.

Also dont forget to put InAppPurchase_Update() in your loop, or nothing will happens. You should do that too in start of your program, so keys and purchases can been init, while loading (the shop is init asyncron).

Also INAPP_ERROR$ variable is very important to been checked in any loops, because its here if users have succes or failed the purchase. if a users have succes, the InAppPurchase_isAvailable() have been updated and you can eventuelly checkout the INAPP_PURCHASE$.

PS. A permission to the AndroidManifest.xml is required, its <uses-permission android:name="com.android.vending.BILLING" />
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/