Link to manage Play Store subscription
Asked Answered
F

6

37

On iOS, we can use https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/manageSubscriptions, and it will open the native subscription manager.

Is this possible to do this with the Play Store, or is there any other possible way to open the native subscription manager for Google Play Store?

Same as this question, but for Android: Link to app manage subscriptions in app store.

Farrell answered 6/5, 2016 at 22:38 Comment(0)
U
52

I use Action view to open Google Play Store -> Account.

    private fun openPlaystoreAccount() {
        try {
            startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/account?utm_source=google&utm_medium=account&utm_campaign=my-account")));
        } catch (e: ActivityNotFoundException) {
            showToast("Cant open the browser")
            e.printStackTrace()
        } 
    }

Update:

Google released a new deep link, where it will take users directly to your app manage subscription page. You need two things SKU and your app package name.

Example URL:

https://play.google.com/store/account/subscriptions?sku=yoursku&package=com.yourpackagename

Sample Code in Kotlin:

 private val packageName = "com.mydomain.myapp"
 private val sku = "mySku"

 private fun openPlaystoreAccount() {
     try {
         startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/account/subscriptions?sku=$sku&package=$packageName")))
     } catch (e: ActivityNotFoundException) {
         showToast("Cant open the browser")
         e.printStackTrace()
     }
 }
Unlash answered 12/1, 2018 at 15:53 Comment(5)
How would you direct a user if there are numerous SKUs for different subscriptions options? Is there a more general link?Haemorrhage
Is there a way to know whether the user successfully unsubscribed from said this deep link intent? Any return of result from the actions done by user from the deeplink?Atal
For some reason this specific deep link doesn't seem to work anymore in more recent Play Store versions.Q
Google's Doc for this: developer.android.com/google/play/billing/…Carboxylate
launchUrl(Uri.parse("https://play.google.com/store/account/subscriptions?sku=$sku&package=$packageName")); Working in flutter android also Thanks!Involution
G
20

I could not find out how to link to the subscriptions page for a specific app. But the url to go to the subscriptions page is: https://play.google.com/store/account/subscriptions. This url will open in the Play Store app when you're on Android.

Gamophyllous answered 13/2, 2018 at 11:8 Comment(1)
For convenience when testing, one can launch this URL via the command-line with this adb command: adb shell am start -a "android.intent.action.VIEW" -d https://play.google.com/store/account/subscriptionsHeliotrope
P
4

A user can view their subscriptions on the App store page now.

https://developer.android.com/google/play/billing/subscriptions#deep-link

"After users have purchased subscriptions, they can view the subscriptions and cancel them from the My Apps screen in the Play Store app or from the app's product details page in the Play Store app."

market://details?id=YOUR_APP_ID

Presidium answered 5/12, 2016 at 22:57 Comment(0)
T
4

Since this year's IO it is possible to use a deep link to link to your subscriptions:

https://play.google.com/store/account/subscriptions?sku=*yoursku*&package=*com.yourpackagename*

Simply open this URL with a regular intent.

Turner answered 20/5, 2018 at 18:17 Comment(0)
P
4

A more detailed explanation -

1) User already owns a subscription

In this case when you call billingClient.queryPurchases(), which returns a PurchaseResult. This has details such as the purchaseToken and the sku as well as the packagename. This call is made every time the app starts or a MainActivity is Resumed, because if someone buys your IAP offline you also need to acknowledge a purchase (more on this here)

This means you can also let the user "Manage" subscription, so the deeplink to link to is:

https://play.google.com/store/account/subscriptions?sku=skuName&package=packageName

2) User is about to buy a subscription:

The way to do this is capture productId or Sku of the SUBS IAP you created in the Play console. Then you build the flowParams, and then you can call

val flowParams = BillingFlowParams.newBuilder()
            .setSkuDetails(skuDetails)
            .build()

billingClient.launchBillingFlow(activity, flowParams)

If successful, this means you get back two things: BillingResult and MutableList<Purchase>. If the BillingResult is OK, and the list returned is not empty, the purchase was succesful. This object also has the sku and packageName, so you follow the same deeplink as above for the user to Manage their subscription.

3) The user has canceled their subscription, and their subscription has expired but is within any of the Resubscribe period conditions stated here

This is when you show this deeplink:

https://play.google.com/store/account/subscriptions, so they can restore or resubscribe the same Sku they had before.

p.s. One thing to note is the Play Store app supports multiple users. So the deeplink will only work if the Play Store app has the correct user selected.

Tap on the letter avatar on the top right to change accounts

Penmanship answered 16/9, 2020 at 4:13 Comment(0)
B
1

So this is what I did to link directly to a subscription:

val context = LocalContext.current
val packageName =  context.applicationContext.packageName
val subscription_id = "Your subcription ID"
val PLAY_STORE_SUBSCRIPTION_DEEPLINK_URL = "https://play.google.com/store/account/subscriptions?product=%s&package=%s"
val url = String.format(PLAY_STORE_SUBSCRIPTION_DEEPLINK_URL,
        subscription_id, packageName);

  • You can find your subscription_id in the google play console under Monetization -> Subscriptions

Jetpack compose code:

@Composable
fun MyButton(url:String) {
    val uriHandler = LocalUriHandler.current
    Button(onClick = { uriHandler.openUri(url) }){
        Text("Subscriptions")
    }
}

Blackheart answered 22/3, 2023 at 18:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.