---
title: "Control store messages in Kotlin Multiplatform SDK"
description: "Choose when your Kotlin Multiplatform app shows App Store and Google Play messages about price increases, billing issues, and declined payments, so they don't interrupt a flow or onboarding."
---

> For the complete documentation index, see [llms.txt](https://adapty.io/docs/llms.txt).

> **AI agents**: to search Adapty docs faster and with fewer tokens, install the Adapty skills: `npx adapty skills install --yes`

The App Store and Google Play sometimes need to show your users a message about their subscription:

- **App Store**: A request to consent to a price increase, a billing issue notice, or a win-back offer. By default, StoreKit shows these messages on its own while your app is open.
- **Google Play**: A notice that a subscription payment was declined and the payment method needs an update. Starting from SDK 4.3.0-beta.1, the Adapty SDK requests these messages by default every time an `Activity` of your app starts after `activate`, including when the app returns to the foreground.

Either way, a message can appear on top of a flow, an onboarding, or a checkout. To choose the moment yourself, switch the Adapty SDK to manual message handling, and call `showStoreMessages` when a message won't interrupt the user.

:::warning
In manual mode, the stores don't show messages on their own. If your app never calls `showStoreMessages`, users never see a price increase consent request, a billing issue notice, or a declined payment notice.
:::

## Before you start

You need:

- **Adapty Kotlin Multiplatform SDK 4.3.0-beta.1 or later**: Earlier versions don't have the store messages API.
- **iOS 16 or later** for App Store messages: StoreKit doesn't deliver messages to apps on earlier versions. On iOS 15, `getPendingStoreMessageTypes` and `showStoreMessages` fail with the `AdaptyErrorCode.DECODING_FAILED` error, so if your app supports iOS 15, handle the error in `onError`, as the examples below do.

## Enable manual handling

The Adapty SDK handles store messages in one of two modes, which the `withStoreMessagesHandling` method sets:

- **`AdaptyStoreMessagesHandling.AUTO`**: The default mode. StoreKit shows App Store messages on its own, and the SDK requests Google Play messages every time an `Activity` of your app starts.
- **`AdaptyStoreMessagesHandling.MANUAL`**: The stores show messages only when your app calls `showStoreMessages`.

To switch to manual mode, set `withStoreMessagesHandling` to `AdaptyStoreMessagesHandling.MANUAL` when you [activate the SDK](sdk-installation-kotlin-multiplatform#activate-adapty-sdk):

```kotlin showLineNumbers
import com.adapty.kmp.Adapty
import com.adapty.kmp.models.AdaptyConfig
import com.adapty.kmp.models.AdaptyStoreMessagesHandling

val config = AdaptyConfig
    .Builder("PUBLIC_SDK_KEY")
    .withStoreMessagesHandling(AdaptyStoreMessagesHandling.MANUAL) // AUTO is the default
    .build()

Adapty.activate(configuration = config)
```

On iOS, the SDK then adds each App Store message to a pending list for the current app session. On Android, the SDK stops requesting Google Play messages on its own. With the default `AUTO` value, the SDK doesn't capture App Store messages, so on iOS, `getPendingStoreMessageTypes` and `showStoreMessages` have nothing to return or show.

## Get pending message types

On iOS, to find out whether any App Store messages are waiting, call `getPendingStoreMessageTypes`. It returns the types of the pending messages without showing or removing them:

```kotlin showLineNumbers
import com.adapty.kmp.Adapty
import com.adapty.kmp.models.AdaptyStoreMessageType

Adapty.getPendingStoreMessageTypes()
    .onSuccess { pendingTypes ->
        if (pendingTypes == null) {
            // Android: Google Play decides whether a message applies when you show it
            Adapty.showStoreMessages()
        } else if (AdaptyStoreMessageType.BILLING_ISSUE in pendingTypes) {
            // For example, skip the upsell and show the billing message first
        }
    }
    .onError { error ->
        // On iOS 15, the call fails with AdaptyErrorCode.DECODING_FAILED (2006)
    }
```

On Android, the method returns `null` without calling the native SDK: Google Play doesn't report pending messages, and decides whether a message applies only when your app requests it. An empty list means that there are no pending messages on iOS. Until `activate` completes, the list is always empty.

Each App Store message has one of these types:

| Type | Message |
|:-----|:--------|
| `AdaptyStoreMessageType.GENERIC` | A general App Store message. |
| `AdaptyStoreMessageType.PRICE_INCREASE_CONSENT` | A request to consent to a subscription price increase. |
| `AdaptyStoreMessageType.BILLING_ISSUE` | A notice about a subscription billing issue. Available on iOS 16.4 and later. |
| `AdaptyStoreMessageType.WIN_BACK_OFFER` | An eligible [win-back offer](app-store-offers#win-back-offers). Available on iOS 18 and later. |

New StoreKit message types arrive as an `AdaptyStoreMessageType` with the `value` `storekit_<number>`. Handle any value outside this table as a type the SDK doesn't recognize.

## Show messages

When your app reaches a point where a store message won't interrupt the user — for example, after the user closes a flow or finishes onboarding — call `showStoreMessages`:

```kotlin showLineNumbers
import com.adapty.kmp.Adapty

Adapty.showStoreMessages()
    .onError { error ->
        // handle the error
    }
```

- **iOS**: The SDK shows the pending messages one after another. After StoreKit shows a message, the SDK removes it from the pending list. If StoreKit fails to show a message, the SDK keeps the message for the next call and continues with the other messages.
- **Android**: The Adapty SDK asks Google Play to show its messages over the current `Activity` of your app: the Android component that displays your app's screens. The SDK learns which `Activity` is current from Android's lifecycle callbacks. Google Play decides whether a message applies to the user, so a request doesn't always show a message. The call returns right away without waiting for Google Play, and doesn't report Google Play errors. If the user fixes their payment method from the message, the SDK syncs the user's purchases with Adapty, and your [profile listener](kmp-listen-subscription-changes) receives the updated access level.

### Show messages at launch on Android

In the default `AUTO` mode, the SDK doesn't request messages for an `Activity` that started before the `Adapty.activate` call, so Google Play messages don't appear at launch. To show them at launch, call `showStoreMessages` once after `activate`, on Android only:

```kotlin showLineNumbers
// commonMain
expect val isAndroid: Boolean

// androidMain
actual val isAndroid: Boolean = true

// iosMain
actual val isAndroid: Boolean = false

// commonMain — activate the SDK
import com.adapty.kmp.Adapty
import com.adapty.kmp.models.AdaptyConfig

Adapty.activate(configuration = AdaptyConfig.Builder("PUBLIC_SDK_KEY").build())
    .onSuccess {
        if (isAndroid) {
            Adapty.showStoreMessages()
        }
    }
```

Don't make this call on iOS: in `AUTO` mode, it has nothing to show, and on iOS 15 it fails.

### Show only some message types

To show only some of the pending App Store messages, pass the types in `iosFilter`. The other messages stay pending:

```kotlin showLineNumbers
import com.adapty.kmp.Adapty
import com.adapty.kmp.models.AdaptyStoreMessageType

Adapty.showStoreMessages(
    iosFilter = listOf(
        AdaptyStoreMessageType.BILLING_ISSUE,
        AdaptyStoreMessageType.PRICE_INCREASE_CONSENT
    )
)
```

Without `iosFilter`, the SDK shows all pending messages, including types it doesn't recognize. An empty list shows none. Android ignores `iosFilter` and requests all Google Play messages.

### Errors

On iOS, `showStoreMessages` returns an [`AdaptyError`](kmp-handle-errors) with one of these codes:

| Code | Name | Cause |
|:-----|:-----|:------|
| 2006 | `AdaptyErrorCode.DECODING_FAILED` | The device runs iOS 15 or earlier. Call the method only on iOS 16 and later. |
| 3201 | `AdaptyErrorCode.OPERATION_IN_PROGRESS` | Another `showStoreMessages` call is still showing messages, and this call has messages to show. Wait for the first call to finish, then try again. |
| 3202 | `AdaptyErrorCode.RESOLVER_FAILURE` | The SDK found no foreground-active window scene to show the messages in. Messages shown before the error leave the pending list. Call the method again when your app is in the foreground to show the rest. |