Android Question Help! Help!Help! with In App Billing API

pfillion

Member
Licensed User
Longtime User
Hi,

I am using the in app billing module "InAppBilling3 (version 1.00)" library. I made a lot of tests with my app in dev. Everything seems fine in dev. It check for my product and receive a confirmation that it has been bought. Everything was great until 2 days ago.

I released my application and got like 4 to 5 users who report that my app does not unlock when they donated. I check their order number and it is valid. I sent them a some debug code and the check for product report that they do not own any product.

I bought my own app for real (not as a tester) with another device and got problems... here is my code and the result of the transaction...

Note: The app is free but had an inapp product that can be bought...

Anybody know what I'm doing wrong ? Like you guess I have some angry user who are wondering why it is not working!

Help!!

B4X:
Sub Activity_Create(FirstTime AsBoolean)
...
manager.Initialize("manager", key)
manager.DebugLogging = True   
...

B4X:
Sub manager_OwnedProducts (Success As Boolean, purchases As Map)
      'Log(Success)
    IsDonation = False
   
    If Success Then
        'Log(purchases)
 
        For Each p As Purchase In purchases.Values
            'Log(p.ProductId & ", Purchased? " & (p.PurchaseState = p.STATE_PURCHASED))
            If p.ProductId = "stay_alive_donation" Then
                If p.PurchaseState = p.STATE_PURCHASED Then
                    IsDonation = True
                End If
            End If
        Next
    End If
   
    'Initialize and update the donation status
    UpdateDonationStatus
   
End Sub

B4X:
Sub manager_PurchaseCompleted (Success As Boolean, Product As Purchase)
 
'Log("manager_PurchaseCompleted:" & Success & " - " & Product)
 
 
    If Success = True Then
      IsDonation = True
      ToastMessageShow("Thank you for your donation!",True)
       'Terminate the activity to force to user to go back to the menu with a refresh donation status
      Activity.Finish
    Else
        IsDonation = True
        ToastMessageShow("Please consider donating to support this AD Free application!",True)
        ToastMessageShow("Please wait or reinstall the application if license status is wrong!",True)
    End If 
End Sub

B4X:
...
'Request payment
manager.RequestPayment("stay_alive_donation","inapp","synetics")
...

Here is what I get when I try to buy a valid licence for my in app product

sending message to waiting queue (OnActivityResult)
running waiting messages (1)
Arrived: 1, 1
Ending async operation: launchPurchaseFlow
Successful resultcode from purchase activity.
Purchase data: {"orderId":"12999763169054705758.1340106464462485","packageName":"com.synetics.stay.alive","productId":"stay_alive_donation","purchaseTime":1382540599000,"purchaseState":0,"developerPayload":"synetics","purchaseToken":"infavjgidcnpnjjzfccruvul.AO-J1OyiVewXqwMr9EGajysOOAbz0W9A6USPyrhZC2AYqkO-Zc4E0AcHerF4D92qX0BebI4tfyteUxk9JBMrfRNTZ4kqp2vlrlDZSqEzn1et-Y0UCWHnMQlYemXhrY4PQqLuZVfA1U3S"}
Data signature: a8YuJsTLbJx8D5Oga+i0txhgLKUi+pQXWmUrOIMHw66cjiK0OdhE9xbosi5GTHVtJvRIJn4aWl+S0sPseYQq3PrXRCNIuTWAwGoxjJ5ieVUexKaBKNeCX6lEfVjWZLEeTgT5wwyxWnfao8SJG/synNslcxvkzxVxHyZT4Wi5oumF9YzwrrKY0poTbNPajbL8ktooTAzShKP7BR+KXRbtZuwthVxBPldgqOpJnx1TzLClj3IyT+CQG0diJ+3LnXMnTYo6Tgxnp1Z+BI/nNlWeU0AlQ5yYAc3Wjupubf6s8hN2/ok5c8WBTVyUjnfGeZCTrviXWjngBOlBTZ1KSZUArA==
Extras: Bundle[{INAPP_PURCHASE_DATA={"orderId":"12999763169054705758.1340106464462485","packageName":"com.synetics.stay.alive","productId":"stay_alive_donation","purchaseTime":1382540599000,"purchaseState":0,"developerPayload":"synetics","purchaseToken":"infavjgidcnpnjjzfccruvul.AO-J1OyiVewXqwMr9EGajysOOAbz0W9A6USPyrhZC2AYqkO-Zc4E0AcHerF4D92qX0BebI4tfyteUxk9JBMrfRNTZ4kqp2vlrlDZSqEzn1et-Y0UCWHnMQlYemXhrY4PQqLuZVfA1U3S"}, INAPP_DATA_SIGNATURE=a8YuJsTLbJx8D5Oga+i0txhgLKUi+pQXWmUrOIMHw66cjiK0OdhE9xbosi5GTHVtJvRIJn4aWl+S0sPseYQq3PrXRCNIuTWAwGoxjJ5ieVUexKaBKNeCX6lEfVjWZLEeTgT5wwyxWnfao8SJG/synNslcxvkzxVxHyZT4Wi5oumF9YzwrrKY0poTbNPajbL8ktooTAzShKP7BR+KXRbtZuwthVxBPldgqOpJnx1TzLClj3IyT+CQG0diJ+3LnXMnTYo6Tgxnp1Z+BI/nNlWeU0AlQ5yYAc3Wjupubf6s8hN2/ok5c8WBTVyUjnfGeZCTrviXWjngBOlBTZ1KSZUArA==, RESPONSE_CODE=0}]

Expected item type: inapp
Purchase signature verification FAILED for sku stay_alive_donation


Signature verification failed for Product ID stay_alive_donation (response: -1003:purchase signature verification failed)

If I try to buy again...
Starting async operation: launchPurchaseFlow
Constructing buy intent for stay_alive_donation, item type: inapp
Unable to buy item, Error response: 7:Item Already Owned
Unable to buy item (response: 7:Item Already Owned)
Ending async operation: launchPurchaseFlow

If I try licence check when I restart app... it fails...
Billing service connected.
Checking for in-app billing 3 support.
In-app billing version 3 supported for com.synetics.stay.alive
Subscriptions AVAILABLE.
Starting async operation: refresh inventory
Querying owned items, item type: inapp
Package name: com.synetics.stay.alive
Calling getPurchases with continuation token: null
Owned items response: 0
Purchase signature verification **FAILED**. Not adding item.
Purchase data: {"orderId":"12999763169054705758.1340106464462485","packageName":"com.synetics.stay.alive","productId":"stay_alive_donation","purchaseTime":1382540599000,"purchaseState":0,"developerPayload":"synetics","purchaseToken":"infavjgidcnpnjjzfccruvul.AO-J1OyiVewXqwMr9EGajysOOAbz0W9A6USPyrhZC2AYqkO-Zc4E0AcHerF4D92qX0BebI4tfyteUxk9JBMrfRNTZ4kqp2vlrlDZSqEzn1et-Y0UCWHnMQlYemXhrY4PQqLuZVfA1U3S"}
Signature: a8YuJsTLbJx8D5Oga+i0txhgLKUi+pQXWmUrOIMHw66cjiK0OdhE9xbosi5GTHVtJvRIJn4aWl+S0sPseYQq3PrXRCNIuTWAwGoxjJ5ieVUexKaBKNeCX6lEfVjWZLEeTgT5wwyxWnfao8SJG/synNslcxvkzxVxHyZT4Wi5oumF9YzwrrKY0poTbNPajbL8ktooTAzShKP7BR+KXRbtZuwthVxBPldgqOpJnx1TzLClj3IyT+CQG0diJ+3LnXMnTYo6Tgxnp1Z+BI/nNlWeU0AlQ5yYAc3Wjupubf6s8hN2/ok5c8WBTVyUjnfGeZCTrviXWjngBOlBTZ1KSZUArA==
Consuming sku: stay_alive_donation, token: infavjgidcnpnjjzfccruvul.AO-J1OyiVewXqwMr9EGajysOOAbz0W9A6USPyrhZC2AYqkO-Zc4E0AcHerF4D92qX0BebI4tfyteUxk9JBMrfRNTZ4kqp2vlrlDZSqEzn1et-Y0UCWHnMQlYemXhrY4PQqLuZVfA1U3S
Error consuming consuming sku stay_alive_donation. 6:Error
Ending async operation: refresh inventory

I was wondering what is wrong with my code because this test worked with success on my dev device...
Billing service connected.
Checking for in-app billing 3 support.
In-app billing version 3 supported for com.synetics.stay.alive
Subscriptions AVAILABLE.
Starting async operation: refresh inventory
Querying owned items, item type: inapp
Package name: com.synetics.stay.alive
Calling getPurchases with continuation token: null
Owned items response: 0
Sku is owned: stay_alive_donation
Continuation token: null
Querying SKU details.
Got sku details:
SkuDetails:{"title":"Stay Alive! Donation (Stay Alive! Keep screen awake)","price":"$1.45","type":"inapp","description":"Please support this add free application.\nUnlock your donator gold medal!","price_amount_micros":1450000,"price_currency_code":"CAD","productId":"stay_alive_donation"}
Querying owned items, item type: subs
Package name: com.synetics.stay.alive
Calling getPurchases with continuation token: null
Owned items response: 0
Continuation token: null

Querying SKU details.
queryPrices: nothing to do because there are no SKUs.
Ending async operation: refresh inventory
$???? DONATION2:true
 

pfillion

Member
Licensed User
Longtime User
Ok I found my problem.

I don't know why as I only open 1 developer account with Google... My public key was wrong. I don't know how come it has changed...

Now my purchase and verification checks work. I'm just not sure why users got charged anyway... and don't know if the current purchase will be detected with the new key or if I will have to refund and ask them to purchase again...



Anyone know how much time it takes when you cancel an order and verify the inapp purchase for it to actually be cancelled.

I bought an inapp product to test with another account on another device. Canceled the purchase, got my cancellation email from Google but app still see the inapp product as valid...
 
Upvote 0
Top