First of all, I would like to understand that the sentence may be strange because it is written using a translator.
I would like to inquire about similar experiences and solutions to the problems that occurred during the process of 'Android In App Billing'.
Among customers who use our products, payments are intermittently refunded without leading to 'consume' and product payment. When I tracked the log I inserted, the callback function I received by calling 'BillingClient.launchBillingFlow' contains the purchase information in 'List. However, the callback function received by calling 'BillingClient.queryPurchasesAsync' has no purchase information in 'List' even though the result of 'BillingResult.getResponseCode' is 'BillingResponseCode.OK'. I understand that 'queryPurchasesAsync' can obtain purchase information that is not 'consume', but I can't find the reason why there is no purchase information. Do you happen to know how to solve this problem? If you do, please help. Thank you.
- Billing Library Version is 7.0.0
BuyListener _buyListener = null;
private void init()
{
_buyListener = new BuyListener();
...
_billingClient = BillingClient.newBuilder(_activity.getApplicationContext())
.enablePendingPurchases(PendingPurchasesParams.newBuilder().enableOneTimeProducts().build())
.setListener(_buyListener)
.build();
}
public void onProductDetailsResponse(BillingResult billingResult, List<ProductDetails> productDetailsList)
{
if(BillingClient.BillingResponseCode.OK == billingResult.getResponseCode())
{
...
BillingResult result = _billingClient.launchBillingFlow(_activity, billingFlowParams);
if(BillingClient.BillingResponseCode.OK != result.getResponseCode())
{
log('A'); // not show
}
}
}
// class BuyListener
public void onPurchasesUpdated(BillingResult billingResult, List<Purchase> purchases)
{
if(BillingClient.BillingResponseCode.OK != billingResult.getResponseCode())
{
log('B'); // not show
return;
}
if(null == list)
{
log('C'); // not show
return;
}
if(1 != list.size())
{
log('D : '+list.size()); // not show
return;
}
log('E:'+list.get(0).getProducts().get()); // show E : products[0]
getReceipts();
}
public void getReceipts()
{
if(null == _billingClient)
{
log('F') // not show
}
int state = _billingClient.getConnectionState();
if(BillingClient.ConnectionState.CONNECTED != state)
{
log('G') // not Show
}
QueryPurchasesParams params = QueryPurchasesParams.newBuilder()
.setProductType(BillingClient.ProductType.INAPP)
.build();
_billingClient.queryPurchaseAsync(params, new GetReceiptsListener());
}
//class GetReceiptsListener
public void onQueryPurchasesResponse(BillingResult billingResult, List<Purchase> purchases)
{
if(BillingClient.BillingResponseCode.OK != billingResult.getResponseCode())
{
log('H'); // not show
return;
}
if(null == list)
{
log('I'); // not show
return;
}
if(1 != list.size())
{
log('J : '+list.size()); // show J : 0
return;
}
}