Android Question in-app purchase error - Authentication is required.

aaronk

Well-Known Member
Licensed User
Longtime User
Hi,

I am beginning to learn how to use in-app purchases but having an issue.

In my Google Play console I have uploaded a draft app to Google Play, and added an in-app purchase with the product id purchase1.

When I run the code:
B4X:
manager.RequestPayment("purchase1","inapp","aaa")

It pops up with the following error message:



I have tried this on 2 different Android devices, and both have different Google accounts.

I have tried this in debug and even in release mode but still get the same error as above.

Any ideas on what I have done wrong ?
 

Cableguy

Expert
Licensed User
Longtime User
Have you set the wallet in your user Google play account? (I never used it as a dev, and as an user I never set a wallet when (re)configuring the gplay Access)
 
Upvote 0

aaronk

Well-Known Member
Licensed User
Longtime User
Have you set the wallet in your user Google play account? (I never used it as a dev, and as an user I never set a wallet when (re)configuring the gplay Access)
Yes, I have set up Google Wallet.

I have other apps on Google Play and receive payments each month. I have also purchased other apps on Google Play and in-app purchases without any issue (except for my app). I am using the same Google Play account.

On my Nexus5x I used my developer account, and on my Nexus 5 I setup a new user with a different credit card. (both comes up with the same error message)
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Then I see only two possibilities...
Either the app is not (correctly) registered in the in-app billing processor on gplay, or the app credentials to access the in-app billing service are wrong.
 
Upvote 0

aaronk

Well-Known Member
Licensed User
Longtime User
I think I know what my problem is.

I think I can't have it as a draft as a production app. (I uploaded my app as a production app, but saved it as a draft)

I then published the app (even knowing I haven't finished it) so it's a live app, and then it comes up saying something like, you can't purchase from yourself. (different error this time)

I then in-published the app and now it says, 'the item you requested is not available for purchase', when I try to purchase the in-app purchase. (since I no longer have it as a released app on Google Play.)

I will upload it as a beta app in Google Play and will see what happens.
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
The PublichKey is correct? Use InAppBilling3 (rel.1.1) library?
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Sometimes when you create a new product, it is not activated and signed unless you send an APK that reverts to the InAppBilling library.

I usually insert an Apk into Alfa Distribution or Beta distribution. It is then usable.
After you've done the tests you can post a definitive APK release.

But if at first there is not at least one APK (alpha, beta or definitive) that uses InAppBilling Google does not sign your products
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
I would first create a beta release and invite a few "dummy" users just to test things out
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Try a publish Alfa Version and after i think InAppBilling work
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Yeah, that is what I am going to do. Will give it a go tomorrow morning.
But tomorrow is Sunday.... Sunday is not working
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
I like developing on Sundays... normally it's much more quiet and peaceful than weekdays
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
My wife kill me.. If work on sunday
 
Upvote 0

aaronk

Well-Known Member
Licensed User
Longtime User
Worked it out.

Looks like you need to publish the app on Google Play before the app will allow in-app purchases. (can't have the app saved as a draft)

As per Google Play Developer docs: Previously, you could publish a "draft" version of your app for testing. This functionality is no longer supported.
https://developer.android.com/google/play/billing/billing_testing.html

In my case I had uploaded a production app, and then released it and then unpublished the app while I was getting my app ready for the in-app billing. I found that I needed to have the app published in order for it to work with the in-app billing.

Since I had uploaded the app as a production app, if I was to publish the app then users would see this app on Google Play even knowing it's not a released version of my app since I am only getting it ready with the in-app purchases.

I had to get Google Play Developer support to delete my app and then I could re-upload the app again and publish the app. However this time I didn't upload a production app and only uploaded it as a Beta app. Now I can publish the app and no one on Google Play can access it (unless I invite them) until I publish (or move the beta app) the production app.
 
Upvote 0

johndb

Active Member
Licensed User
Longtime User
You can publish your app as alpha or beta versions can you not which will not expose your app to the public.
To quote a line in the Google document "To test in-app billing, you need to publish your app to an alpha or beta channel in Google Play."
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
I wrote to you in post 8 and 10, because I had already done so.
 
Upvote 0

aaronk

Well-Known Member
Licensed User
Longtime User
You can publish your app as alpha or beta versions can you not which will not expose your app to the public.
To quote a line in the Google document "To test in-app billing, you need to publish your app to an alpha or beta channel in Google Play."
You can also use the production app for testing except the customer would get charged. I guess you can always refund the purchase.

From what I can see once you upload a production app on Google Play, then you later to decided to upload a beta app, when you publish the app the production app will still be visible to your users. (you can't disable the production app once you submit one). In my case I uploaded my half finished app as the production app thinking I wouldn't need to make it public just so I could get the API key and to create in app products.

I wrote to you in post 8 and 10, because I had already done so.
In app billing works fine in production, beta and Alpha, except the app needs to be published (not saved as a draft).

The main reason why I gave my feedback in this thread was to let others know that the app needs to be published on Google Play in order for in-app billing to work while testing in B4A, and to also let others to use the beta or Alpha when submitting the app to Google Play for the first time, and not to make the same mistake as me uploading it as a production app otherwise the public will see the app.
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
In app billing works fine in production, beta and Alpha, except the app needs to be published (not saved as a draft).
In fact, I never wrote it as draft but published, in alpha beta or distribution
Try a publish Alfa Version and after i think InAppBilling work
Even if you publish it as distribution, you can withdraw it immediately with the Apply button without contacting the assistance and you already have BillingInApp.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…