Android Question In-App Billing v3 - cancel transaction

Shay

Well-Known Member
Licensed User
Longtime User
I read this:
https://www.b4x.com/android/forum/threads/inapp-billing-v3.31791/

My issue:
I made order, then cancel it from google play, it was 24hr ago
I do send:
B4X:
If BillManager.SubscriptionsSupported = True Then
    BillManager.GetOwnedProducts
   End If

and on:
B4X:
Sub BillManager_OwnedProducts (Success As Boolean, purchases As Map)
   Log(Success)
   If Success Then
      Log(purchases)
      For Each p As Purchase In purchases.Values
         Log(p.ProductId & ", Purchased? " & (p.PurchaseState))
          '0 - purchased, 1 - canceled, 2 - refunded
         If p.PurchaseState = p.STATE_PURCHASED Then
          Trial_Button.Visible = False
         Else
          Trial_Button.Visible = True
         End If
      Next
     End If
End Sub

but I am always getting "0" as purchased

this is from logcat:
true
(MyMap) {standard_user_1year=Purchase(type:subs): standard_user_1year, state = 0}
standard_user_1year, Purchased? 0


what is wrong?
 

Shay

Well-Known Member
Licensed User
Longtime User
Can it be related to this, which I don't see in the library option to: "getPurchases"

Local Caching
Because the Google Play client now caches In-app Billing information locally on the device, you can use the Version 3 API to query for this information more frequently, for example through a getPurchases call. Unlike with previous versions of the API, many Version 3 API calls will be serviced through cache lookups instead of through a network connection to Google Play, which significantly speeds up the API's response time.
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
I'm seeing this issue too in a game where a user can purchase packs of x number of bonuses that can then be consumed one by one. The problem is that if I cancel an order at a user's request & there's a delay in seeing the cancellation in my code in the app, they could use all the bonuses before I can deduct them from their stash. I suppose at least I have some control over this, because users have to ask me to cancel the order (ie: with In-App Billing they can't request an automatic refund like they can with app purchases) - so if a user tries to exploit this issue, I can just refuse to cancel their order. Not ideal though & it would be good to see this library implement all the In-App Billing 3 API functionality.

- Colin.
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
The problem is not in the library. You can call GetOwnedProducts to get the current known purchases.

The problem is that it takes a long time for the data to be updated.
Thanks Erel - I realize that the delay in the cancellation processing is on Google's end, so I guess we just have to live with it - although seeing how many developers seem to be having issues with it, I'm surprised they haven't done something to fix it.

I should have written the last part of my post more clearly - what I meant to say was that apart from the cancellation delay issue, it would be great to see all the API functionality implemented. There is a getSkuDetails method in the API that doesn't appear to be implemented in the library. One instance where I can see this would be useful to have would be if I was to have a bunch of IAP items that I want to roll out gradually without having to release an update every time. I could put all the relevant code in my app & have it conditional upon certain product IDs being available, then add those IDs to my IAP list in the Developer Console at a later date. Having the getSkuDetails implemented would allow the app to check what products are available & show them to the user dynamically as they are added in the back-end.

Anyway, for now I have successfully implemented some In-App Billing in one of my games, so thanks for providing the library in its current form.

- Colin.
 
Upvote 0
Top