Android Question Google subscription with multiple base plans

Cristian Achim

Member
Licensed User
Longtime User
Hi,

I have three types of subscriptions, each with two base plans. For example subscription Gold with two plans, 12-gold and 6-gold.
If both subscriptions are active, LaunchBillingFlow(GooglePay.Billing, SkuDetails.Get(0), "") only shows me the 6-gold plan.
How can I specify which plan I want to refer to?

Thank you!

B4X:
Wait For (GooglePay.Billing.ConnectIfNeeded) Billing_Connected (Result As BillingResult)
            If Result.IsSuccess Then
                Dim SF As Object = GooglePay.Billing.QuerySkuDetails("subs", Array(GooglePay.ADS_SDK_ID))
                Wait For (SF) Billing_SkuQueryCompleted (Result As BillingResult, SkuDetails As List)
                If Result.IsSuccess And SkuDetails.Size = 1 Then
                    Result = LaunchBillingFlow(GooglePay.Billing, SkuDetails.Get(0), "")
                    Log(SkuDetails.Get(0))
                    If Result.IsSuccess Then Return
                End If
            End If
            ToastMessageShow("Error starting billing process", True)
 

Attachments

  • 1710926276547.png
    1710926276547.png
    73.8 KB · Views: 89

Cristian Achim

Member
Licensed User
Longtime User
What is the output of:
B4X:
Log(SkuDetails)

Hi, Erel!

(ArrayList) [ProductDetails{jsonString='{"productId":"gold_app","type":"subs","title":"Gold (RTOrder)","name":"Gold","description":"The subscription can be chosen for 6 or 12 months","localizedIn":["en-US","ro"],"skuDetailsToken":"AEuhp4KGVh4BjySD5BE6X9pTVO1ggOEy02MROSuXS715QnM4_e1fechhUX33273X3Ig1","subscriptionOfferDetails":[{"offerIdToken":"AUj\/YhhTqeuNiICODgdAjvinqaOfSO0OtqL4dv4X5Di24EmEv7RYODnxKZFhK9x2hm+Xcs4WJ5CafHyc4Pux03QU4GJN7qOGzaiwIAD4AvBusRw=","basePlanId":"6-gold","pricingPhases":[{"priceAmountMicros":104990000,"priceCurrencyCode":"RON","formattedPrice":"RON 104.99","billingPeriod":"P6M","recurrenceMode":1}],"offerTags":[]},{"offerIdToken":"AUj\/YhhVf3fh0iJbuTuaJECK1KEnf03Rx+V3P2RG9MKesrPJsPo0Fv3FI7yFwXogqzpVjGgfqWtI5L2JOVQ6nuSLWf3Z3AR7N8mi0Gq55W1kaZ4ZTrET","basePlanId":"12-gold","pricingPhases":[{"priceAmountMicros":179990000,"priceCurrencyCode":"RON","formattedPrice":"RON 179.99","billingPeriod":"P1Y","recurrenceMode":1}],"offerTags":[]}]}', parsedJson={"productId":"gold_app","type":"subs","title":"Gold (RTOrder)","name":"Gold","description":"The subscription can be chosen for 6 or 12 months","localizedIn":["en-US","ro"],"skuDetailsToken":"AEuhp4KGVh4BjySD5BE6X9pTVO1ggOEy02MROSuXS715QnM4_e1fechhUX33273X3Ig1","subscriptionOfferDetails":[{"offerIdToken":"AUj\/YhhTqeuNiICODgdAjvinqaOfSO0OtqL4dv4X5Di24EmEv7RYODnxKZFhK9x2hm+Xcs4WJ5CafHyc4Pux03QU4GJN7qOGzaiwIAD4AvBusRw=","basePlanId":"6-gold","pricingPhases":[{"priceAmountMicros":104990000,"priceCurrencyCode":"RON","formattedPrice":"RON 104.99","billingPeriod":"P6M","recurrenceMode":1}],"offerTags":[]},{"offerIdToken":"AUj\/YhhVf3fh0iJbuTuaJECK1KEnf03Rx+V3P2RG9MKesrPJsPo0Fv3FI7yFwXogqzpVjGgfqWtI5L2JOVQ6nuSLWf3Z3AR7N8mi0Gq55W1kaZ4ZTrET","basePlanId":"12-gold","pricingPhases":[{"priceAmountMicros":179990000,"priceCurrencyCode":"RON","formattedPrice":"RON 179.99","billingPeriod":"P1Y","recurrenceMode":1}],"offerTags":[]}]}, productId='gold_app', productType='subs', title='Gold (RTOrder)', productDetailsToken='AEuhp4KGVh4BjySD5BE6X9pTVO1ggOEy02MROSuXS715QnM4_e1fechhUX33273X3Ig1', subscriptionOfferDetails=[com.android.billingclient.api.ProductDetails$SubscriptionOfferDetails@6b32bf1, com.android.billingclient.api.ProductDetails$SubscriptionOfferDetails@f1353d6]}]

Thank you!
 
Upvote 0

Cristian Achim

Member
Licensed User
Longtime User
i can see in the output.



and

I have two different basePlanId in Google Play, but Billing_SkuQueryCompleted (Result As BillingResult, SkuDetails As List) gives me SkuDetails.Size = 1.
The question was how can I select 12-gold or 6-gold, because if both are activated, it gives me 6-gold by default.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Solution

Cristian Achim

Member
Licensed User
Longtime User
Upvote 0
Top