I'm upgrading Google Billing to v5, which is required by Google, and after reading all the relate information, the purchase totken issue is still confusing me.
I got the code below from this post: Source: https://www.b4x.com/android/forum/t...-due-to-google-restriction.142524/post-903185
In my app, there is only a single in-app product for purchase which is a subscription. Can I just pass an empty string as the OfferToken? If no, how to get it?
TIA
I got the code below from this post: Source: https://www.b4x.com/android/forum/t...-due-to-google-restriction.142524/post-903185
B4X:
Private Sub LaunchBillingFlow (Client As BillingClient, Sku As SkuDetails, OfferToken As String) As BillingResult
Dim ctxt As JavaObject
ctxt.InitializeContext
Dim ProductDetailsParamsBuilder As JavaObject
ProductDetailsParamsBuilder = ProductDetailsParamsBuilder.InitializeStatic("com.android.billingclient.api.BillingFlowParams.ProductDetailsParams").RunMethod("newBuilder", Null)
ProductDetailsParamsBuilder.RunMethod("setProductDetails", Array(Sku))
ProductDetailsParamsBuilder.RunMethod("setOfferToken", Array(OfferToken))
Dim ProductDetails As List = Array(ProductDetailsParamsBuilder.RunMethod("build", Null))
Dim BillingFlowParamsBuilder As JavaObject
BillingFlowParamsBuilder = BillingFlowParamsBuilder.InitializeStatic("com.android.billingclient.api.BillingFlowParams").RunMethod("newBuilder", Null)
BillingFlowParamsBuilder.RunMethod("setProductDetailsParamsList", Array(ProductDetails))
Return Client.As(JavaObject).GetFieldJO("client").RunMethod("launchBillingFlow", Array(ctxt, BillingFlowParamsBuilder.RunMethod("build", Null)))
End Sub
In my app, there is only a single in-app product for purchase which is a subscription. Can I just pass an empty string as the OfferToken? If no, how to get it?
TIA