Question

Android SDK - One App User IDs and two different device with different Google Play account

  • 30 June 2023
  • 2 replies
  • 84 views

Badge

 

Hi, 

I have a problem with case: One user with unique App User IDs logged to app on device A (Google Play Account A@gmail.com) and bought subscription. Then user is logging to app on device (B) (Google Play Account B@gmail.com) and see subscription in app → It’s working as expect. 
But app has option to upgrade or downgrade subscription and if user is logged on device (B) it is possible upgrade/downgrade plan and then two Google Play account have subscription. 

This is code to get current subscription ID and  available subscription list for upgrade/downgrade
 

 Purchases.sharedInstance.getCustomerInfoWith({ error ->
onError.invoke(error)
}, { customerInfo ->
val entitlement = customerInfo.entitlements[REVENUECAT_SUBSCRIPTION_ENTITLEMENTS]

Purchases.sharedInstance.getOfferingsWith({ error ->
onError.invoke(error)
}, { offerings ->
onSuccess.invoke(offerings.current?.availablePackages?.filter { it.product.googleProduct?.basePlanId != entitlement?.productPlanIdentifier }
?: listOf())
})
})

 

This is code to get current subscription ID and upgrade/downgrade subscription

 Purchases.sharedInstance.getCustomerInfoWith({ error ->
onError.invoke(error)
}, { customerInfo ->
val entitlement = customerInfo.entitlements[REVENUECAT_SUBSCRIPTION_ENTITLEMENTS]
if (entitlement?.isActive == true) {
Purchases.sharedInstance.purchase(
PurchaseParams.Builder(activity, item)
.oldProductId(entitlement.productIdentifier)
.googleProrationMode(GoogleProrationMode.IMMEDIATE_WITHOUT_PRORATION)
.build(),
object : PurchaseCallback {
override fun onCompleted(
storeTransaction: StoreTransaction,
customerInfo: CustomerInfo
) {
val entitlement =
customerInfo.entitlements[REVENUECAT_SUBSCRIPTION_ENTITLEMENTS]
if (entitlement != null && entitlement.isActive) {
onSuccess.invoke()
}
}

override fun onError(
purchasesError: PurchasesError,
isUserCancel: Boolean
) {
if (isUserCancel) onUserCancel.invoke(purchasesError)
else onError.invoke(purchasesError)
}
}
)
}

Is any option to prevent for this? 


2 replies

Userlevel 3
Badge +8

Hi,

I see I answered this in our support ticket, but for anyone reading this:

 

Scenario —

User A logs into RC Account A on Device A (Google Play Account A@gmail.com) and buys subscription
User B logs into RC Account B on Device B (Google Play Account B@gmail.com) and buys subscription
Then, User B logs out of app and logs into RC Account A. User A (on Device B) upgrades the subscription, which applies to B@gmail.com, and RC user A doesn't have access.

 

Unfortunately, we aren’t able to block a user from making this upgrade, because Google doesn’t expose a user’s Play Store account gmail for us to check prior to offering an upgrade. So, users will need to be logged into their correct Play Store account (most users only have one) to make subscription changes in your app and have them apply to the correct underlying Play Store subscription.

Badge +3

Hi,

I see I answered this in our support ticket, but for anyone reading this:

 

Scenario —

User A logs into RC Account A on Device A (Google Play Account A@gmail.com) and buys subscription
User B logs into RC Account B on Device B (Google Play Account B@gmail.com) and buys subscription
Then, User B logs out of app and logs into RC Account A. User A (on Device B) upgrades the subscription, which applies to B@gmail.com, and RC user A doesn't have access.

 

Unfortunately, we aren’t able to block a user from making this upgrade, because Google doesn’t expose a user’s Play Store account gmail for us to check prior to offering an upgrade. So, users will need to be logged into their correct Play Store account (most users only have one) to make subscription changes in your app and have them apply to the correct underlying Play Store subscription.

Ryan, what is the recommended approach in this case? We are implementing monthly ↔ annual crossgrade option in our app and we definitely expect this to happen, especially if the app account with an existing Google subscription made on the husband’s Google account is shared with the wife, who is on a different device with a different Google account.

The wife could try to change the subscription duration from monthly ↔ yearly and now the app account ends up with 2 different Google subscriptions. I was thinking about showing a message that warns the user to make sure they are on the original Google account associated with the subscription, before showing the crossgrade options. Is this the best option or do you have a better suggestion?

Reply