Android Question BillingClient - IsAcknowledged always true

Robert Valentino

Well-Known Member
Licensed User
Longtime User
My Query_Buy below is working

B4X:
#Region Query_Buy
Public  Sub Query_Buy(PurchaseFrom As String, ProductID As String) As ResumableSub
   
           Wait For(Starter.gBillingClient.ConnectIfNeeded) Billing_Client_Connected (Result As BillingResult)
   
           If    Result.IsSuccess Then   'get the sku details   
               Dim sf As Object = Starter.gBillingClient.QuerySkuDetails(PurchaseFrom, Array(ProductID))
                           
               Wait For(sf) Billing_Client_SkuQueryCompleted(Result As BillingResult, SkuDetails As List)
                           
               If  Result.IsSuccess And SkuDetails.Size = 1 Then   'start the billing process. The PurchasesUpdated event will be raised in the starter service
                   Result = Starter.gBillingClient.LaunchBillingFlow(SkuDetails.Get(0))
                   
                   If  Result.IsSuccess Then
                       Return True
                   End If
               End If
           End If
           
           Return False   
End Sub
#end Region

After doing a Query_Buy my PurchasesUpdated is called but p.IsAcknowledged is always true so I cannot set my Developer Payload. I tried doing the AcknowledgePurchase anyway just to see what would happen and I get back "Google Play In-app Billing API version is less than 9" error message


B4X:
Public  Sub Billing_Client_PurchasesUpdated(Result As BillingResult, Purchases As List)
           '-------------------------------------------------------------------------------------------------------------------------
           '   This event will be raised when the status of one or more of the purchases has changed.           
           '   It will usually happen as a result of calling LaunchBillingFlow however it can be called in other cases as well.
           '-------------------------------------------------------------------------------------------------------------------------
           
           If    Result.IsSuccess Then
               For Each p As Purchase In Purchases
                   If  p.PurchaseState = p.STATE_PURCHASED Then
                       '--------------------------------------------------------------------------
                       '   Verify the purchase signature.
                       '--------------------------------------------------------------------------       
#if Debug                       
                       Log("BKey:" &gBMK &CRLF &"DKey:" &Debug_gBillingManagerKey)
#end if
                                       
                       If  gBillingClient.VerifyPurchase(p, gBMK) Then
                           '----------------------------------------------------------------------
                           '  Was Purchase is Acknowledged???
                           '----------------------------------------------------------------------
                           If  p.IsAcknowledged = False Then
   
                               '------------------------------------------------------------------
                               '   we either acknowledge the product or consume it.
                               '------------------------------------------------------------------                               
                               Wait For(gBillingClient.AcknowledgePurchase(p.PurchaseToken, gSubscriptions.SubscriptionToString(BillingSubscription, True))) Billing_Client_AcknowledgeCompleted(Result As BillingResult)
                               
                               If  Result.IsSuccess Then                       
                                   Log("Starter::Billing_Client_PurchasesUpdated  -  Acknowledged: " & Result.IsSuccess)
                               end if
                           end if
                      end if
                end if
            next
    end if

Google Play In-app Billing API version is less than 9


How do I set the Developer Payload the only place that seems to do this is AcknowledgePurchase but I never can call it
 

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I've done that at least 15 times.

I'm not using the test I'd, I'm using my email (setup as a tester where credit card is always acknowledged but not billed)

Maybe I'll try a real transaction this afternoon
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I used the billing example exactly as it is (well I replaced the billing key with mine)

And something strange happen when I clicked the buy option.

It asked me if I wanted to require that all purchases be validated - I said yes always (should have taken a snapshot of the screen) and it is now requiring Acknowledgement of orders. I have never seen that with my App (tried clearing data and uninstalling) but message doesn't appear again - I wonder if I said no to that question would it never require Acknowledgement?

HOW do I get that option set for my App or forced on. Because it appears to me without acknowledgement there is no way to set the developer payload

But still have same problem with everything being acknowledged when ordered.


JUST Realized that all my purchases are for "subs"
 
Last edited:
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
OK, tried inapp and subs with a real id and real credit card and all works fine.

I think google has a bug that when you are using a tester email (which brings up the fake credit card that is always accepted) that it is acknowledging the purchase right away and you don't get a chance to set the developer payload. I could be wrong but that seems to be happening on my devices.

Sorry for all the questions
 
Upvote 0
Top