SheikCode
SheikCode

Reputation: 579

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.

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

Upvotes: 6

Views: 1634

Answers (1)

SheikCode
SheikCode

Reputation: 579

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!

Upvotes: 2

Related Questions