In-app billing of sample application is failing with payment error - android

Executed the following steps for running the sample application, but the application is failing with payment error.
Downloaded the sample application from android SDK
Added Google Play public key to the sample application code.
Changed the package name of the sample application.
Built the sample application in release mode and sign it.
Created a product list for the sample application.
Published the items of product list (sword_001 and potion_001) for the draft version of sample application.
Test account registered under the Google Play publisher account.
Verified that device is running a supported version of the Google Play application.
Installed the same signed application onto the device.
10.My test account is the primary account on my device.
11.Ran the application and purchased the sword.
When I try to do a purchase getting the following error while the order is being authorized ('authorize payment' is displayed), this usually happens about 30 seconds after the order has been placed (i.e. 'accept & buy' has been tapped).
"Your payment could not be processed. sign in to your google wallet account to request support"
Does anyone experiencing the same error ?
Thanks in advance.

Getting in-app billing is challenging. Its not easy to read thru and get it integrated. I have a project created which works like a hello world, I suggest you download and use that. There are just too many variables. I have documented the integration steps here.

Problem got fixed when I changed the API version number inside makeRequestBundle() method of BillingService.Java:
request.putInt(Consts.BILLING_REQUEST_API_VERSION, 1);
to
request.putInt(Consts.BILLING_REQUEST_API_VERSION, 2);

Related

IAP is not working after published in to play store in alpha release

I am developing the flutter app which has In-app-Purchases feature, I have created the non-consumable product (one time) in the developer console. And I am using the official flutter package to implement IAP in the app - https://pub.dev/packages/in_app_purchase.
IAP product is in active state in the play console
I uploaded the right version and version code of the APK
My app is in published state
I have added the license testers under account settings to test IAP.
my androidManifest.xml file updated with right user permission for BILLING.
when I test the IAP in local it works well, I am able to test the IAP properly.
but after I published the same (generated App bundle) in to play store under Alpha release, it does not works. If I check the logs using the abd logcat, then I just getting the below line related to billing
BillingClient: Client is already in the process of connecting to billing service.
I am not sure, should I specifically do any app signing before generates the app bundle after added the IAP. I am just using the existing key information which I have used for previous releases to do the app signing.
Kindly let me know if anybody can help on this problem and I can share if anyother information is required
Now the IAP feature is working in my flutter APP (in Alpha, beta, Production), the problem was in the code. when we try to connect to the store we have this code to check the store availability.
final bool available = await InAppPurchaseConnection.instance.isAvailable();
I was just checking one time and if store available I further coded the premium features logic. But this works always in local, but the published alpha/beta versions never works.
so I just changed my code like below.
if(!available)
{
//try to connect again
await InAppPurchaseConnection.instance.isAvailable();
}
Here I am just trying to connect the store again, If first time fails. so at first we dont get always the response properly, trying multiple times to connect with store helps to work IAP. I put the logic to check the connection 3 times. Hope this helps!

How to test Android In App Billings--I've tried "everything" but no luck

I am trying to get a list of Android In App Billings (IAB) in my app--subscriptions specifically. While debugging on device (NOT EMULATOR) When it makes the call to get the products I get this error error occurred while loading products: Error: IAP not prepared. Check if Google Play service is available. Here are the things that I've done:
The apk is uploaded to the Google Play Console as an alpha release.
Hours (days!) have passed and the release is available (I can see it in Play Store).
I added the in app purchases in the Google Play Console.
I added a gmail account as a tester in the Google Play Console in both the general settings area and the list of testers for a release.
I installed the apk that has the same version number AND version name as the apk that is in alpha in Play Store
I am using a real device (not an emulator)
I am signed in as the tester email account.
My AndroidManifest.xml has the BILLING property set
It should be noted that I am using react-native and this package for in app billing https://github.com/dooboolab/react-native-iap although I think the issue here is I have missed one of the general steps necessary to set up in app billings for Android. Any ideas or guidance would be appreciated--I've been fighting this for days now!
Can you please provide code you are using?
According to this issue answer: https://github.com/dooboolab/react-native-iap/issues/301 please make sure you are initializing IAB using initConnection not prepare.

How to test Google Play in app purchase?

From what I understand reading This link. It appears to me that the only way to test in app purchase is to write the complete code for in app purchase. And then do a proper build. Upload it to beta release. And then download the app via the opt in link.
But how do I develop it in the first place? Am I expected to write some lines of code and then do a build and upload it? That is a huge turn around time. Is there no way for me to have some test account that I can sign in go google play (on phone) with and then just make purchases?
Currently, my code already handles the products
android.test.purchased and android.test.canceled. How do I make it so that I can test my own products Ids? Currently it just says the product you are requesting is not available.
Google allowed to test your in app purchase in for dummy products like you mentioned android.test.purchased. To test real products you must have to deploy application in beta release at least. Following article will help you in detail :
An Android Studio Google Play In-app Billing Tutorial
Hope it will help.
You need to publish your application in beta version in play store to review the application. Without reviewing your application, you cannot test app purchases. After the review you can test your application without redeploying it to play store.

Resolve "please first complete your account by adding a payment method" in Android

My phone (Galaxy s3, OS v4.1) is having two Google accounts. One is added when I purchased my phone, and other I have added now.
Now I have installed my application for testing and it's having in-app purchase. When I tried to purchase, every time I get message like please first complete your account by adding a payment method.
I have installed signed app which is drafted on Play.
I have configured test account on Google developer console.
The Google account, configured in my phone, is having admin access to Google developer console. That is why I want to test in app product with my other Google account but when I am redirected to Google play market, It shows my first account every time. How can I test with my other account configured in my phone?
Is there any system like, this is primary account or this is secondary account?
I know this has been answered, but I had a different experience with the same message.
(please first complete your account by adding a payment method)
My eclipse adt and sdk were out of date. Updating those also updated the Trivial drive project which then had more detailed information in the readme file about how to properly setup and run the app.
Delete the google account from your phone with which you don't want to test.
This is the bug filed here.

Android billing testing - how do I test with the test user?

I set up test users so that I can test that in-app billing works, but I am a bit confused by the process.
I am following the android developer billing test guide here: http://developer.android.com/guide/google/play/billing/billing_testing.html
It has a few confusing points. It says not to publish your app, but somehow I need to get the app on my phone. So how can I get an un-published app on my phone?
Also, am I supposed to make an area on the app with the 4 product ids that google reserves and try to buy those, and then once I see it works, just get rid of those buttons to buy those test products? Is that how this is meant to be done?
Thanks!!
It says not to publish your app, but somehow I need to get the app on
my phone. So how can I get an un-published app on my phone?
There's no need to publish your app to get it installed. Create a signed build (See http://developer.android.com/tools/publishing/app-signing.html). Then install it on your phone using adb install <apk name> The SAME build you must upload to your playstore dashboard. After uploading, you will see 2 options:
PUBLISH
SAVE
Click on 'SAVE'. After saving your uploaded app, you will be able to add InApp products for that app. You MUST save and publish your inapp products in order to test them.
You should upload the apk to your developer account and fill in the mandatory fields and save it without publishing it and then you can create in-app products for the application and publish it. please note that the in-app products must be published before testing billing. But you don't require to publish the application to test billing.
Try the MoVend library for Android. it supports google play in-app billing, paypal and many more.
http://www.movend.com/
How to sign an android apk file
To install it you can use adb or you can send this file by mail. Then download in the device and install it.
Check that Settings > Applications > Unknown sources is checked in the Device.
If you are having problems implementing in-app purchase I recommend you the library AndroidBillingLibrary.

Categories

Resources