Android Question InApp problem (InApp purchase is confirmed but acts like never purchased)

muratkazma

Member
Licensed User
Hello there, I developed a new application for barbers. Currently installed and active on the market. It can be reviewed at https://play.google.com/store/apps/details?id=com.uygarteknoloji.berber. There are 7 different modules and each module has 2 different purchase options. It can be purchased in the form of Inapp and subs. No problem with subs. (Actually, there is another interesting problem there too. Subs did not recognize the type but it works. I gave the error message below) When purchased as a subscription, everything works normally. However, when it is purchased in the form of Inapp, the purchase is complete, but when it closes and opens the app, it wants to buy it again as if it was never purchased. What am I supposed to do? The codes are below:

Starter Servis Modüle :

Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim manager As BillingManager3
Public PhoneEvent1 As PhoneEvents
Private key As String = "BlaBlaBla"

Dim ProductLifeTimeID1 As String = "barber_appointments_lifetime"
Dim ProductSubscriptionID1 As String = "barber_appointments_subscription"
Dim ProductName1 As String = "Appointments"
Dim ProductID1 As String
Dim ProductType1 As String

Dim ProductLifeTimeID2 As String = "barber_employee_lifetime"
Dim ProductSubscriptionID2 As String = "barber_employee_subscription"
Dim ProductName2 As String = "Employees"
Dim ProductID2 As String
Dim ProductType2 As String

Dim ProductLifeTimeID3 As String = "barber_products_lifetime"
Dim ProductSubscriptionID3 As String = "barber_products_subscription"
Dim ProductName3 As String = "Materials"
Dim ProductID3 As String
Dim ProductType3 As String

Dim ProductLifeTimeID4 As String = "barber_incomeexpense_lifetime"
Dim ProductSubscriptionID4 As String = "barber_incomeexpense_subscription"
Dim ProductName4 As String = "IncomeExpense"
Dim ProductID4 As String
Dim ProductType4 As String

Dim ProductLifeTimeID5 As String = "barber_notes_lifetime"
Dim ProductSubscriptionID5 As String = "barber_notes_subscription"
Dim ProductName5 As String = "Notes"
Dim ProductID5 As String
Dim ProductType5 As String

Dim ProductLifeTimeID6 As String = "barber_reports_lifetime"
Dim ProductSubscriptionID6 As String = "barber_reports_subscription"
Dim ProductName6 As String = "Reports"
Dim ProductID6 As String
Dim ProductType6 As String

Dim ProductLifeTimeID7 As String = "barber_cloud_lifetime"
Dim ProductSubscriptionID7 As String = "barber_cloud_subscription"
Dim ProductName7 As String = "Cloud"
Dim ProductID7 As String
Dim ProductType7 As String

Dim ber_ran_tam_surum As String = "H"
Dim ber_ran_abone As String = "H"
Dim ber_per_tam_surum As String = "H"
Dim ber_per_abone As String = "H"
Dim ber_urun_tam_surum As String = "H"
Dim ber_urun_abone As String = "H"
Dim ber_gg_tam_surum As String = "H"
Dim ber_gg_abone As String = "H"
Dim ber_not_tam_surum As String = "H"
Dim ber_not_abone As String = "H"
Dim ber_rap_tam_surum As String = "H"
Dim ber_rap_abone As String = "H"
Dim ber_bul_tam_surum As String = "H"
Dim ber_bul_abone As String = "H"
End Sub

Sub Service_Create
'This is the program entry point.
'This is a good place to load resources that are not specific to a single activity.
manager.Initialize("manager", key)
manager.DebugLogging = True
PhoneEvent1.Initialize("PhoneEvent")
End Sub

Sub Service_Start (StartingIntent As Intent)
Service.StopAutomaticForeground 'Starter service can start in the foreground state in some edge cases.
End Sub

Sub Service_TaskRemoved
'This event will be raised when the user removes the app from the recent apps list.
End Sub

Sub PhoneEvent_ConnectivityChanged(NetworkType As String, State As String, Intent As Intent)
'NetworkType - WIFI or MOBILE.
'State - One of the following values: CONNECTING, CONNECTED, SUSPENDED, DISCONNECTING, DISCONNECTED, UNKNOWN.
If State <> "CONNECTED" Then
genel.Baglanti="Yok"
Else
genel.Baglanti="Var"
End If
End Sub

Sub manager_BillingSupported (Supported As Boolean, Message As String)
Log(Supported & ", " & Message)
Log("Subscriptions supported: " & manager.SubscriptionsSupported)
If Supported Then
manager.GetOwnedProducts
End If
End Sub

Sub manager_OwnedProducts (Success As Boolean, purchases As Map)
Log(Success)
If Success Then
For Each p As Purchase In purchases.Values
Log(p.Productid & ", Purchased? " & (p.PurchaseState = p.STATE_PURCHASED))
If p.DeveloperPayload=ProductName1 Then
If p.PurchaseState = p.STATE_PURCHASED Then
ProductID1 = p.ProductId
ProductType1 = p.ItemType
Else
ProductID1 = ""
ProductType1 = ""
End If
else if p.DeveloperPayload = ProductName2 Then
If p.PurchaseState = p.STATE_PURCHASED Then
ProductID2 = p.ProductId
ProductType2 = p.ItemType
Else
ProductID2 = ""
ProductType2 = ""
End If
else if p.DeveloperPayload = ProductName3 Then
If p.PurchaseState = p.STATE_PURCHASED Then
ProductID3 = p.ProductId
ProductType3 = p.ItemType
Else
ProductID3 = ""
ProductType3 = ""
End If
else if p.DeveloperPayload = ProductName4 Then
If p.PurchaseState = p.STATE_PURCHASED Then
ProductID4 = p.ProductId
ProductType4 = p.ItemType
Else
ProductID4 = ""
ProductType4 = ""

End If
else if p.DeveloperPayload = ProductName5 Then
If p.PurchaseState = p.STATE_PURCHASED Then
ProductID5 = p.ProductId
ProductType5 = p.ItemType
Else
ProductID5 = ""
ProductType5 = ""
End If
else if p.DeveloperPayload = ProductName6 Then
If p.PurchaseState = p.STATE_PURCHASED Then
ProductID6 = p.ProductId
ProductType6 = p.ItemType
Else
ProductID6 = ""
ProductType6 = ""
End If
else if p.DeveloperPayload = ProductName7 Then
If p.PurchaseState = p.STATE_PURCHASED Then
ProductID7 = p.ProductId
ProductType7 = p.ItemType
Else
ProductID7 = ""
ProductType7 = ""
End If
End If
Next

ber_ran_tam_surum = "H"
ber_ran_abone = "H"
ber_per_tam_surum = "H"
ber_per_abone = "H"
ber_urun_tam_surum = "H"
ber_urun_abone = "H"
ber_gg_tam_surum = "H"
ber_gg_abone = "H"
ber_not_tam_surum = "H"
ber_not_abone = "H"
ber_rap_tam_surum = "H"
ber_rap_abone = "H"
ber_bul_tam_surum = "H"
ber_bul_abone = "H"

If ProductID1<>"" Then
If ProductType1 = "inapp" Then
ber_ran_tam_surum = "E"
else If ProductType1 = "subs" Then
ber_ran_abone = "E"
End If
End If

If ProductID2<>"" Then
If ProductType2 = "inapp" Then
ber_per_tam_surum = "E"
else If ProductType2 = "subs" Then
ber_per_abone = "E"
End If
End If

If ProductID3<>"" Then
If ProductType3 = "inapp" Then
ber_urun_tam_surum = "E"
else If ProductType3 = "subs" Then
ber_urun_abone = "E"
End If
End If

If ProductID4<>"" Then
If ProductType4 = "inapp" Then
ber_gg_tam_surum = "E"
else If ProductType4 = "subs" Then
ber_gg_abone = "E"
End If
End If

If ProductID5<>"" Then
If ProductType5 = "inapp" Then
ber_not_tam_surum = "E"
else If ProductType5 = "subs" Then
ber_not_abone = "E"
End If
End If

If ProductID6<>"" Then
If ProductType6 = "inapp" Then
ber_rap_tam_surum = "E"
else If ProductType6 = "subs" Then
ber_rap_abone = "E"
End If
End If

If ProductID7<>"" Then
If ProductType7 = "inapp" Then
ber_bul_tam_surum = "E"
else If ProductType7 = "subs" Then
ber_bul_abone = "E"
End If
End If

End If
End Sub


Purchase Module :


Sub btnLifetime_Click
If kabul.Value=False Then
Msgbox2Async(CRLF & genel.ResourceStrings.Get("LicenseAgreementMessage") & CRLF, genel.ResourceStrings.Get("MainActivityTitle"), "", "", "", Null, True)
Else
Select form
Case 1: Starter.manager.RequestPayment(Starter.ProductLifeTimeID1, "inapp", Starter.ProductName1)
Case 2: Starter.manager.RequestPayment(Starter.ProductLifeTimeID2, "inapp", Starter.ProductName2)
Case 3: Starter.manager.RequestPayment(Starter.ProductLifeTimeID3, "inapp", Starter.ProductName3)
Case 4: Starter.manager.RequestPayment(Starter.ProductLifeTimeID4, "inapp", Starter.ProductName4)
Case 5: Starter.manager.RequestPayment(Starter.ProductLifeTimeID5, "inapp", Starter.ProductName5)
Case 6: Starter.manager.RequestPayment(Starter.ProductLifeTimeID6, "inapp", Starter.ProductName6)
Case 7: Starter.manager.RequestPayment(Starter.ProductLifeTimeID7, "inapp", Starter.ProductName7)
End Select
End If
End Sub

Sub btnSubscription_Click
If kabul.Value=False Then
Msgbox2Async(CRLF & genel.ResourceStrings.Get("LicenseAgreementMessage") & CRLF, genel.ResourceStrings.Get("MainActivityTitle"), "", "", "", Null, True)
Else
Select form
Case 1: Starter.manager.RequestPayment(Starter.ProductSubscriptionID1, "subs", Starter.ProductName1)
Case 2: Starter.manager.RequestPayment(Starter.ProductSubscriptionID2, "subs", Starter.ProductName2)
Case 3: Starter.manager.RequestPayment(Starter.ProductSubscriptionID3, "subs", Starter.ProductName3)
Case 4: Starter.manager.RequestPayment(Starter.ProductSubscriptionID4, "subs", Starter.ProductName4)
Case 5: Starter.manager.RequestPayment(Starter.ProductSubscriptionID5, "subs", Starter.ProductName5)
Case 6: Starter.manager.RequestPayment(Starter.ProductSubscriptionID6, "subs", Starter.ProductName6)
Case 7: Starter.manager.RequestPayment(Starter.ProductSubscriptionID7, "subs", Starter.ProductName7)
End Select
End If
End Sub

Sub manager_PurchaseCompleted (Success As Boolean, Product As Purchase)
If Success Then
Dim n As Notification
n.Initialize
n.Vibrate = True
n.Icon = "icon"
Starter.manager.ConsumeProduct(Product)
If Product.DeveloperPayload = Starter.ProductName1 Then
Starter.ProductID1 = Product.ProductId
Starter.ProductType1 = Product.ItemType
n.SetInfo(genel.ResourceStrings.Get("Appointments"), genel.ResourceStrings.Get("PurchaseOk"), Main)
n.Notify(1)
StartActivity(randevular)
else If Product.DeveloperPayload = Starter.ProductName2 Then
Starter.ProductID2 = Product.ProductId
Starter.ProductType2 = Product.ItemType
n.SetInfo(genel.ResourceStrings.Get("Employees"), genel.ResourceStrings.Get("PurchaseOk"), Main)
n.Notify(1)
StartActivity(personeller)
else If Product.DeveloperPayload = Starter.ProductName3 Then
Starter.ProductID3 = Product.ProductId
Starter.ProductType3 = Product.ItemType
n.SetInfo(genel.ResourceStrings.Get("Products"), genel.ResourceStrings.Get("PurchaseOk"), Main)
n.Notify(1)
StartActivity(urunler)
else If Product.DeveloperPayload = Starter.ProductName4 Then
Starter.ProductID4 = Product.ProductId
Starter.ProductType4 = Product.ItemType
n.SetInfo(genel.ResourceStrings.Get("IncomeExpense"), genel.ResourceStrings.Get("PurchaseOk"), Main)
n.Notify(1)
StartActivity(gelirgiderler)
else If Product.DeveloperPayload = Starter.ProductName5 Then
Starter.ProductID5 = Product.ProductId
Starter.ProductType5 = Product.ItemType
n.SetInfo(genel.ResourceStrings.Get("Notes"), genel.ResourceStrings.Get("PurchaseOk"), Main)
n.Notify(1)
StartActivity(notlar)
else If Product.DeveloperPayload = Starter.ProductName6 Then
Starter.ProductID6 = Product.ProductId
Starter.ProductType6 = Product.ItemType
n.SetInfo(genel.ResourceStrings.Get("Reports"), genel.ResourceStrings.Get("PurchaseOk"), Main)
n.Notify(1)
StartActivity(raporlar)
else If Product.DeveloperPayload = Starter.ProductName7 Then
Starter.ProductID7 = Product.ProductId
Starter.ProductType7 = Product.ItemType
n.SetInfo(genel.ResourceStrings.Get("Cloud"), genel.ResourceStrings.Get("PurchaseOk"), Main)
n.Notify(1)
StartActivity(bulut)
End If
Activity.Finish
Else
Msgbox2Async(CRLF & genel.ResourceStrings.Get("PurchaseDidntComplete") & CRLF , genel.ResourceStrings.Get("MainActivityTitle"), "", "", "", Null, True)
End If
End Sub

Manifest Editör :

'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetActivityAttribute("main", android:label, "@string/MainActivityTitle")
'End of default text.
'InAppBilling declarations - Start
AddReceiverText(Starter, <intent-filter>
<action android:name="com.android.vending.billing.IN_APP_NOTIFY" />
<action android:name="com.android.vending.billing.RESPONSE_CODE" />
<action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED" />
</intent-filter>)
'InAppBilling declarations - End
CreateResourceFromFile(Macro, GooglePlayBilling.GooglePlayBilling)
SetApplicationAttribute(android:theme, "@style/MyAppTheme")
CreateResource(values, theme.xml,
<resources>
<style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#0098FF</item>
<item name="colorPrimaryDark">#007CF5</item>
<item name="colorAccent">#AAAA00</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowTranslucentNavigation">false</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
</resources>
)

I just added the "AddReceiverText" codes in the manifest editor. I didn't update it on playstore.

Main Module :

#Region Project Attributes
#ApplicationLabel: Barber
#VersionCode: 3
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: True
#AdditionalRes: C:\AndroidSDK\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms
#End Region

#Region Activity Attributes
#FullScreen: True
#IncludeTitle: False
#End Region

#Extends: android.support.v7.app.AppCompatActivity


Likewise, I just added the "AdditionalRes" code and it is not up to date in the play store yet. There was also something that caught my attention. After purchasing with subscription, it says "Items of type 'subs' can't be consumed. (Response: -1010: Invalid consumption attempt)". (When I watch it in B4A log) but it works.

Logs :

Günlükçü şuna bağlandı: F7AZFG00P635
--------- beginning of system
--------- beginning of main
** Activity (satinal) Resume **
Starting async operation: launchPurchaseFlow
Constructing buy intent for barber_appointments_lifetime, item type: inapp
requestCode = 1
** Activity (satinal) Pause, UserClosed = false **
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":"GPA.3399-9063-9803-25594","packageName":"com.uygarteknoloji.berber","productId":"barber_appointments_lifetime","purchaseTime":1591056748991,"purchaseState":0,"developerPayload":"Appointments","purchaseToken":"npaoehmlnkdphfhocdpakbgh.AO-J1OyhEZf-JsaaCEuG9H-vvh1NtL5VQFvGRMalYS93WtHmjbGVBvmYekmOxUgBsGtHHSRP8iNpbCjb7mcPO35ujedi-1IkWVctp8awgWGdNweC0tvBcZ7bD5uacMrt2aGvB6fDWb7t8APhwf8mgHdKEERZzMDgiQ"}
Data signature: KDGIFHyZfvB9AViMvzEdMlaJ7u2Uu0s6156DAZDM3KuffBPwnwopHSe9xm4zTL0Z55RHvrlPo5mvyNhTb7oRijsrg+8kxW3FxUIexEEsLEKpvjwxf4BfLlmoEgh1VEgB1U48BUKmYFDjvEqKIVrWUXvIu85nDSmJJjZ/lYvEGvuVs0IwfdsE/IK/gMzUBcOFV90b5kwNuBrY+Pk7AtXUjBMmyAC5MVLk2ZvSFfgpoZE0QfRBluRDfrJgzSFR3Pp7rU5PsyOQ8r4Lpun04e4mgsnXft2p0w1B363mvyreci5/owqFMSWjNO8jZoiL2aV9i6/Pcx+qTV3tQsXP6cdxDg==
Extras: Bundle[{INAPP_PURCHASE_DATA={"orderId":"GPA.3399-9063-9803-25594","packageName":"com.uygarteknoloji.berber","productId":"barber_appointments_lifetime","purchaseTime":1591056748991,"purchaseState":0,"developerPayload":"Appointments","purchaseToken":"npaoehmlnkdphfhocdpakbgh.AO-J1OyhEZf-JsaaCEuG9H-vvh1NtL5VQFvGRMalYS93WtHmjbGVBvmYekmOxUgBsGtHHSRP8iNpbCjb7mcPO35ujedi-1IkWVctp8awgWGdNweC0tvBcZ7bD5uacMrt2aGvB6fDWb7t8APhwf8mgHdKEERZzMDgiQ"}, INAPP_DATA_SIGNATURE=KDGIFHyZfvB9AViMvzEdMlaJ7u2Uu0s6156DAZDM3KuffBPwnwopHSe9xm4zTL0Z55RHvrlPo5mvyNhTb7oRijsrg+8kxW3FxUIexEEsLEKpvjwxf4BfLlmoEgh1VEgB1U48BUKmYFDjvEqKIVrWUXvIu85nDSmJJjZ/lYvEGvuVs0IwfdsE/IK/gMzUBcOFV90b5kwNuBrY+Pk7AtXUjBMmyAC5MVLk2ZvSFfgpoZE0QfRBluRDfrJgzSFR3Pp7rU5PsyOQ8r4Lpun04e4mgsnXft2p0w1B363mvyreci5/owqFMSWjNO8jZoiL2aV9i6/Pcx+qTV3tQsXP6cdxDg==, RESPONSE_CODE=0}]
Expected item type: inapp
Purchase signature successfully verified.
Starting async operation: consume
Consuming sku: barber_appointments_lifetime, token: npaoehmlnkdphfhocdpakbgh.AO-J1OyhEZf-JsaaCEuG9H-vvh1NtL5VQFvGRMalYS93WtHmjbGVBvmYekmOxUgBsGtHHSRP8iNpbCjb7mcPO35ujedi-1IkWVctp8awgWGdNweC0tvBcZ7bD5uacMrt2aGvB6fDWb7t8APhwf8mgHdKEERZzMDgiQ
** Activity (satinal) Resume **
** Activity (satinal) Pause, UserClosed = true **
** Activity (randevular) Create, isFirst = true **
** Activity (randevular) Resume **
Successfully consumed sku: barber_appointments_lifetime
Ending async operation: consume

Items of type 'subs' can't be consumed. (response: -1010:Invalid consumption attempt)

Purchase data: {"orderId":"GPA.3315-7319-1611-69547","packageName":"com.uygarteknoloji.berber","productId":"barber_appointments_subscription","purchaseTime":1591029088588,"purchaseState":0,"developerPayload":"Appointments","purchaseToken":"pbjohjpppndfhpnmhhjfmehn.AO-J1Ow860UQgA_E5klA6jIbHFKu7jZqaavDBmeK5QcwqEAzJ8Sd4Hmt3iP8oojAeawZzh_XIYf2ZKCAh1297IBCKkuuqD_4wmsWy0Ec4AAEsL3vwplVjU_zkYzmMJCsNXgqugRMA4MZ9rDNdJL4JnmEDz6NeOTw4w","autoRenewing":true}

Extras: Bundle[{INAPP_PURCHASE_DATA={"orderId":"GPA.3315-7319-1611-69547","packageName":"com.uygarteknoloji.berber","productId":"barber_appointments_subscription","purchaseTime":1591029088588,"purchaseState":0,"developerPayload":"Appointments","purchaseToken":"pbjohjpppndfhpnmhhjfmehn.AO-J1Ow860UQgA_E5klA6jIbHFKu7jZqaavDBmeK5QcwqEAzJ8Sd4Hmt3iP8oojAeawZzh_XIYf2ZKCAh1297IBCKkuuqD_4wmsWy0Ec4AAEsL3vwplVjU_zkYzmMJCsNXgqugRMA4MZ9rDNdJL4JnmEDz6NeOTw4w","autoRenewing":true}, INAPP_DATA_SIGNATURE=XSVMGf1sPXD4/wdUHUR8evUWbMioBPznx/dSPfF370c2L4HBeZit6nr9TjdVuhAQ2LuqPAgBsm1QPqHtETiy6eebM6bI2415VNerg16VAE+TlrB58i7g7ww9mKLq6SrZ3PDfrbyh8RE5VsE4WV0fqNm3iRXIcbOWB1RYrFSJ4C35BMwlwpWHqVyG86zSZ7mc7BnYp7MHOBR1x2LpLei6s2vtgznYP6jYWCFET1sqD/S22hjoAwYcF6PIqaRm+EKtOT9G6yGgIJs4lCcd4eTxNTxVps2Wn+oIsBDOCvIfWZtcVSvCkWEss5vB0YBlizIVohHpOA8tz6pc2ACWox7Qew==, RESPONSE_CODE=0}]

Expected item type: subs

Got sku details: SkuDetails:{"skuDetailsToken":"AEuhp4JwU_0387s5PEXp8YKKgBuCayLA-6ACLdOxUN6YXIRdELOdBtBoHFOtxTfcx3tF","productId":"barber_appointments_subscription","type":"subs","price":"₺9,99","price_amount_micros":9990000,"price_currency_code":"TRY","subscriptionPeriod":"P1M","title":"Randevular (Berber)","description":"Randevular Servisi Aylık Abonelik"}

Purchase data: {"orderId":"GPA.3354-4187-7878-82011","packageName":"com.uygarteknoloji.berber","productId":"barber_appointments_lifetime","purchaseTime":1591031322200,"purchaseState":0,"developerPayload":"Appointments","purchaseToken":"edbhjbipjkjbnkjofedlibgp.AO-J1Oz4pyRQybCOCWf4XY34dGh7CLlVqlojZVRHhCX_1Xa4AjxKx_XDGKvhwtvX8fJ7JXdUpqU3VQABvoS44H-uFBfyKozDo4WzOSlnU5hIbIPsY4gaZiwkggKHN2irgE42YMMqG6rMvj24RyAiasiGEgLYNHt01A"}

Data signature: d7VKggIIGIUTBLzQQxgTF9w0A3pbFuRWvamDh+wRYLCF0GVwYwOsAbwI5ITv//v+AGx8vOU+16l3dQ5IFLCh8Soc0p2hLqAyXBPvRuj8dz3BBLE2EqTRIGVeE0U+q7kuAH3RJcBle77NVeI3BR9YXz8hX5SYTaReMDAWXRE6BMJOOaJy11O3XpYE40iFsPsU0VYN0ywb1NyZGTW8Z8CA+9irXBd2rVH+RJgpksQSZeG30zoBG/ex1vQYgClIZmggnPmKtDc1TS//OKdVAvn4i0T5GO15TjaJozEjE9ZwzKOZ8jyMZexot8YilRgWVAwoHGfqLkRI/QfyDkv0j1f1Rw==

Extras: Bundle[{INAPP_PURCHASE_DATA={"orderId":"GPA.3354-4187-7878-82011","packageName":"com.uygarteknoloji.berber","productId":"barber_appointments_lifetime","purchaseTime":1591031322200,"purchaseState":0,"developerPayload":"Appointments","purchaseToken":"edbhjbipjkjbnkjofedlibgp.AO-J1Oz4pyRQybCOCWf4XY34dGh7CLlVqlojZVRHhCX_1Xa4AjxKx_XDGKvhwtvX8fJ7JXdUpqU3VQABvoS44H-uFBfyKozDo4WzOSlnU5hIbIPsY4gaZiwkggKHN2irgE42YMMqG6rMvj24RyAiasiGEgLYNHt01A"}, INAPP_DATA_SIGNATURE=d7VKggIIGIUTBLzQQxgTF9w0A3pbFuRWvamDh+wRYLCF0GVwYwOsAbwI5ITv//v+AGx8vOU+16l3dQ5IFLCh8Soc0p2hLqAyXBPvRuj8dz3BBLE2EqTRIGVeE0U+q7kuAH3RJcBle77NVeI3BR9YXz8hX5SYTaReMDAWXRE6BMJOOaJy11O3XpYE40iFsPsU0VYN0ywb1NyZGTW8Z8CA+9irXBd2rVH+RJgpksQSZeG30zoBG/ex1vQYgClIZmggnPmKtDc1TS//OKdVAvn4i0T5GO15TjaJozEjE9ZwzKOZ8jyMZexot8YilRgWVAwoHGfqLkRI/QfyDkv0j1f1Rw==, RESPONSE_CODE=0}]

Expected item type: inapp

Consuming sku: barber_appointments_lifetime, token: edbhjbipjkjbnkjofedlibgp.AO-J1Oz4pyRQybCOCWf4XY34dGh7CLlVqlojZVRHhCX_1Xa4AjxKx_XDGKvhwtvX8fJ7JXdUpqU3VQABvoS44H-uFBfyKozDo4WzOSlnU5hIbIPsY4gaZiwkggKHN2irgE42YMMqG6rMvj24RyAiasiGEgLYNHt01A

Successfully consumed sku: barber_appointments_lifetime
 

DonManfred

Expert
Licensed User
Longtime User
Please use code tags when posting Code
 
Upvote 0

muratkazma

Member
Licensed User
Hello, I developed a new application for barbers. Currently installed and active on the market. It can be reviewed at https://play.google.com/store/apps/details?id=com.uygarteknoloji.berber. There are 7 different modules and each module has 2 different purchase options. It can be purchased in the form of Inapp and subs. No problem with subs. (Actually, there is another interesting problem there too. Subs did not recognize the type but it works. I gave the error message below) When purchased as a subscription, everything works normally. However, when it is purchased in the form of Inapp, the purchase is complete, but when it closes and opens the app, it wants to buy it again as if it was never purchased. What am I supposed to do?

Logs are below :

Puchase Logs :

Starting async operation: launchPurchaseFlow
Constructing buy intent for barber_appointments_lifetime, item type: inapp
requestCode = 2
** Activity (satinal) Pause, UserClosed = false **
sending message to waiting queue (OnActivityResult)
running waiting messages (1)
Arrived: 2, 2
Ending async operation: launchPurchaseFlow
Successful resultcode from purchase activity.
Purchase data: {"orderId":"GPA.3363-3575-9819-52231","packageName":"com.uygarteknoloji.berber","productId":"barber_appointments_lifetime","purchaseTime":1591096171595,"purchaseState":0,"developerPayload":"Appointments","purchaseToken":"hagekihmfigefjmhjlhgdpnk.AO-J1Oy37kR4ebh_h1aVNzcgxIWUbHQSQZzqEi66kkq0mgBKtK5aZK3cfAYqwdTOKaY3q93UzCWkVDj-KISSl2XMskhe6OCnZj7AciKScsOq8gRsMGLv4Fhp-rRBibOMtGt6Z-oKQQPCsdtUymMs7zs13RXXZ_Asmw"}
Data signature: h9efWkzZTrlTLQ657n8zfMc+7Httz38VsSmBBgLW+aeFnFQGAGDRKAqnzpHaKsUqjwsbA5iAdW3ePa1XcvfwikBFdECKO0VeLcP0bo1VVmoiA97PeVYNNqfBwQI3Yo+pA7R+MNJFN3aEIRR8n5V2Tremkta2LwhdFErcKmRwmIc9Ld0oGJWPb35MNz6By75Mnwinj8hW5tgqowsDYBlv5rxF7LTowxswd+cuWMJqO4deZpjlPMdv07U6oJb9+tztQ42hqGK+5dWD//faxbawr7ArJSUrHtixLR/njsMq0FQ/sqYeCafdo1LI5a1lKfXkr62+AMEIEExZebbR7kAchg==
Extras: Bundle[{INAPP_PURCHASE_DATA={"orderId":"GPA.3363-3575-9819-52231","packageName":"com.uygarteknoloji.berber","productId":"barber_appointments_lifetime","purchaseTime":1591096171595,"purchaseState":0,"developerPayload":"Appointments","purchaseToken":"hagekihmfigefjmhjlhgdpnk.AO-J1Oy37kR4ebh_h1aVNzcgxIWUbHQSQZzqEi66kkq0mgBKtK5aZK3cfAYqwdTOKaY3q93UzCWkVDj-KISSl2XMskhe6OCnZj7AciKScsOq8gRsMGLv4Fhp-rRBibOMtGt6Z-oKQQPCsdtUymMs7zs13RXXZ_Asmw"}, INAPP_DATA_SIGNATURE=h9efWkzZTrlTLQ657n8zfMc+7Httz38VsSmBBgLW+aeFnFQGAGDRKAqnzpHaKsUqjwsbA5iAdW3ePa1XcvfwikBFdECKO0VeLcP0bo1VVmoiA97PeVYNNqfBwQI3Yo+pA7R+MNJFN3aEIRR8n5V2Tremkta2LwhdFErcKmRwmIc9Ld0oGJWPb35MNz6By75Mnwinj8hW5tgqowsDYBlv5rxF7LTowxswd+cuWMJqO4deZpjlPMdv07U6oJb9+tztQ42hqGK+5dWD//faxbawr7ArJSUrHtixLR/njsMq0FQ/sqYeCafdo1LI5a1lKfXkr62+AMEIEExZebbR7kAchg==, RESPONSE_CODE=0}]
Expected item type: inapp
Purchase signature successfully verified.
Starting async operation: consume
Consuming sku: barber_appointments_lifetime, token: hagekihmfigefjmhjlhgdpnk.AO-J1Oy37kR4ebh_h1aVNzcgxIWUbHQSQZzqEi66kkq0mgBKtK5aZK3cfAYqwdTOKaY3q93UzCWkVDj-KISSl2XMskhe6OCnZj7AciKScsOq8gRsMGLv4Fhp-rRBibOMtGt6Z-oKQQPCsdtUymMs7zs13RXXZ_Asmw
** Activity (satinal) Resume **
** Activity (satinal) Pause, UserClosed = true **
** Activity (randevular) Create, isFirst = true **
** Activity (randevular) Resume **
Successfully consumed sku: barber_appointments_lifetime
Ending async operation: consume

After Program Restart :


*** Service (starter) Create ***
** Service (starter) Start **
Billing service connected.
Checking for in-app billing 3 support.
In-app billing version 3 supported for com.uygarteknoloji.berber
Subscriptions AVAILABLE.
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
true, Setup successful. (response: 0:OK)
Subscriptions supported: true
Starting async operation: refresh inventory
Querying owned items, item type: inapp
Package name: com.uygarteknoloji.berber
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.
Querying owned items, item type: subs
Package name: com.uygarteknoloji.berber
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
true


Starter:
Sub Service_Create
    'This is the program entry point.
    'This is a good place to load resources that are not specific to a single activity.
    manager.Initialize("manager", key)
    manager.DebugLogging = True
End Sub

Sub manager_BillingSupported (Supported As Boolean, Message As String)
    Log(Supported & ", " & Message)
    Log("Subscriptions supported: " & manager.SubscriptionsSupported)
    If Supported Then
        manager.GetOwnedProducts
    End If
End Sub

Sub manager_OwnedProducts (Success As Boolean, purchases As Map)
    Log(Success)
    If Success Then
        For Each p As Purchase In purchases.Values
            Log(p.Productid & ", Purchased? " & (p.PurchaseState = p.STATE_PURCHASED))
        Next
    End If
End Sub

Puchase:
Sub btnLifetime_Click
    If kabul.Value=False Then
        Msgbox2Async(CRLF & genel.ResourceStrings.Get("LicenseAgreementMessage") & CRLF, genel.ResourceStrings.Get("MainActivityTitle"), "", "", "", Null, True)
    Else
        Select form
            Case 1: Starter.manager.RequestPayment(Starter.ProductLifeTimeID1, "inapp", Starter.ProductName1)
            Case 2: Starter.manager.RequestPayment(Starter.ProductLifeTimeID2, "inapp", Starter.ProductName2)
            Case 3: Starter.manager.RequestPayment(Starter.ProductLifeTimeID3, "inapp", Starter.ProductName3)
            Case 4: Starter.manager.RequestPayment(Starter.ProductLifeTimeID4, "inapp", Starter.ProductName4)
            Case 5: Starter.manager.RequestPayment(Starter.ProductLifeTimeID5, "inapp", Starter.ProductName5)
            Case 6: Starter.manager.RequestPayment(Starter.ProductLifeTimeID6, "inapp", Starter.ProductName6)
            Case 7: Starter.manager.RequestPayment(Starter.ProductLifeTimeID7, "inapp", Starter.ProductName7)
        End Select
    End If
End Sub

Sub btnSubscription_Click
    If kabul.Value=False Then
        Msgbox2Async(CRLF & genel.ResourceStrings.Get("LicenseAgreementMessage") & CRLF, genel.ResourceStrings.Get("MainActivityTitle"), "", "", "", Null, True)
    Else
        Select form
            Case 1: Starter.manager.RequestPayment(Starter.ProductSubscriptionID1, "subs", Starter.ProductName1)
            Case 2: Starter.manager.RequestPayment(Starter.ProductSubscriptionID2, "subs", Starter.ProductName2)
            Case 3: Starter.manager.RequestPayment(Starter.ProductSubscriptionID3, "subs", Starter.ProductName3)
            Case 4: Starter.manager.RequestPayment(Starter.ProductSubscriptionID4, "subs", Starter.ProductName4)
            Case 5: Starter.manager.RequestPayment(Starter.ProductSubscriptionID5, "subs", Starter.ProductName5)
            Case 6: Starter.manager.RequestPayment(Starter.ProductSubscriptionID6, "subs", Starter.ProductName6)
            Case 7: Starter.manager.RequestPayment(Starter.ProductSubscriptionID7, "subs", Starter.ProductName7)
        End Select
    End If
End Sub

Sub manager_PurchaseCompleted (Success As Boolean, Product As Purchase)
    If Success Then
        Dim n As Notification
        n.Initialize
        n.Vibrate = True
        n.Icon = "icon"
        Starter.manager.ConsumeProduct(Product)
        If Product.DeveloperPayload = Starter.ProductName1 Then
            Starter.ProductID1 = Product.ProductId
            Starter.ProductType1 = Product.ItemType
            n.SetInfo(genel.ResourceStrings.Get("Appointments"), genel.ResourceStrings.Get("PurchaseOk"), Main)
            n.Notify(1)
            StartActivity(randevular)
        else If Product.DeveloperPayload = Starter.ProductName2 Then
            Starter.ProductID2 = Product.ProductId
            Starter.ProductType2 = Product.ItemType
            n.SetInfo(genel.ResourceStrings.Get("Employees"), genel.ResourceStrings.Get("PurchaseOk"), Main)
            n.Notify(1)
            StartActivity(personeller)
        else If Product.DeveloperPayload = Starter.ProductName3 Then
            Starter.ProductID3 = Product.ProductId
            Starter.ProductType3 = Product.ItemType
            n.SetInfo(genel.ResourceStrings.Get("Products"), genel.ResourceStrings.Get("PurchaseOk"), Main)
            n.Notify(1)
            StartActivity(urunler)
        else If Product.DeveloperPayload = Starter.ProductName4 Then
            Starter.ProductID4 = Product.ProductId
            Starter.ProductType4 = Product.ItemType
            n.SetInfo(genel.ResourceStrings.Get("IncomeExpense"), genel.ResourceStrings.Get("PurchaseOk"), Main)
            n.Notify(1)
            StartActivity(gelirgiderler)
        else If Product.DeveloperPayload = Starter.ProductName5 Then
            Starter.ProductID5 = Product.ProductId
            Starter.ProductType5 = Product.ItemType
            n.SetInfo(genel.ResourceStrings.Get("Notes"), genel.ResourceStrings.Get("PurchaseOk"), Main)
            n.Notify(1)
            StartActivity(notlar)
        else If Product.DeveloperPayload = Starter.ProductName6 Then
            Starter.ProductID6 = Product.ProductId
            Starter.ProductType6 = Product.ItemType
            n.SetInfo(genel.ResourceStrings.Get("Reports"), genel.ResourceStrings.Get("PurchaseOk"), Main)
            n.Notify(1)
            StartActivity(raporlar)
        else If Product.DeveloperPayload = Starter.ProductName7 Then
            Starter.ProductID7 = Product.ProductId
            Starter.ProductType7 = Product.ItemType
            n.SetInfo(genel.ResourceStrings.Get("Cloud"), genel.ResourceStrings.Get("PurchaseOk"), Main)
            n.Notify(1)
            StartActivity(bulut)
        End If
        Activity.Finish
    Else
        Msgbox2Async(CRLF & genel.ResourceStrings.Get("PurchaseDidntComplete") & CRLF , genel.ResourceStrings.Get("MainActivityTitle"), "", "", "", Null, True)
    End If
End Sub

Manifest Editor:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetActivityAttribute("main", android:label, "@string/MainActivityTitle")
'End of default text.
'InAppBilling declarations - Start
AddReceiverText(Starter,  <intent-filter>
                <action android:name="com.android.vending.billing.IN_APP_NOTIFY" />
                <action android:name="com.android.vending.billing.RESPONSE_CODE" />
                <action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED" />
            </intent-filter>)
'InAppBilling declarations - End
CreateResourceFromFile(Macro, GooglePlayBilling.GooglePlayBilling)
SetApplicationAttribute(android:theme, "@style/MyAppTheme")
CreateResource(values, theme.xml,
<resources>
    <style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">#0098FF</item>
        <item name="colorPrimaryDark">#007CF5</item>
        <item name="colorAccent">#AAAA00</item>
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="android:windowTranslucentNavigation">false</item>
         <item name="android:windowTranslucentStatus">true</item>
    </style>
</resources>
)

Main:
#Region  Project Attributes
    #ApplicationLabel: Barber
    #VersionCode: 5
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: True
    #AdditionalRes: C:\AndroidSDK\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms
#End Region

#Region  Activity Attributes
    #FullScreen: True
    #IncludeTitle: False
#End Region

#Extends: android.support.v7.app.AppCompatActivity
 
Last edited:
Upvote 0
Top