Skip to content

· 11 min read · Nadeera Silva

Payments

Flutter In-App Purchase Stuck on Pending: How to Fix It

A Flutter in-app purchase stuck on pending usually means an unpaid Play order, Ask to Buy or the iOS 27 StoreKit bug. Here is a tested handler for all three.

A hand rests beside a smartphone with a half-filled teal loading ring on a marble café counter, next to a brass hourglass with amber sand still falling, standing for a purchase waiting on payment.

If a Flutter in-app purchase is stuck on pending, your app is usually doing one of three things wrong: it waits on a payment that hasn't happened yet, it never hears back when that payment finishes, or (on iOS 27) the purchase call never returns. I checked each case against Google's and Apple's docs and the current in_app_purchase source on 3 December 2026. Below is a tested handler that deals with all three.

Quick answer

PurchaseStatus.pending means the user started the purchase but hasn't paid yet. On Google Play that can be a cash code, a slow payment method or a family approval. On iOS it is usually Ask to Buy. Show a "waiting for payment" state, don't grant access or call completePurchase, and listen for the update from app start. On Android, also re-check with queryPastPurchases(). If the purchase sheet never returns at all on iOS 27 or iPadOS 27, update in_app_purchase_storekit to 0.4.17 or later.

What this means for your app or business

A stuck purchase costs you twice. The customer may have paid (or is about to), but your app shows a spinner, so they write a one-star review, ask for a refund or buy again. If your app goes the other way and grants access while the payment is still pending, you give away the product, and on Google Play the order can still be cancelled later.

For most apps the fix takes a developer about half a day: one state for "waiting for payment", one listener that starts with the app, and a server check before you grant anything. The iOS 27 case is a one-line dependency update. It matters, though: one team on the Flutter tracker had App Review reject an iPad subscription twice because of it. If your paywall is your revenue, test these paths before the next release, or get help if you don't have time to test both stores.

Why is my in-app purchase stuck on pending?

WhereWhat the user seesReal causeFix
Google Play"Payment pending" after choosing cash, bank transfer or another slow methodPending transaction: the money hasn't arrived yetWait for PURCHASED, then verify, grant and acknowledge
Google PlayPaid at the shop, app still lockedApp only listens while the paywall is openListen from startup and call queryPastPurchases() on launch
Google PlayAccess granted, then revokedApp trusted restored from restorePurchases() while the purchase was PENDINGCheck billingClientPurchase.purchaseState
iOSChild sees "Ask permission", app spins foreverAsk to Buy: Product.PurchaseResult.pendingShow waiting state; the approval arrives later through Transaction.updates
iOS 27 / iPadOS 27Purchase sheet never appears or never returnsPlugin called purchase(options:) without a UI anchorUpdate to in_app_purchase_storekit 0.4.17+
iOS"There is a pending transaction for the same product identifier"An earlier transaction for that product was never finishedFinish it with completePurchase after you deliver
Flowchart of Flutter in_app_purchase states: pending (do not grant or complete), purchased (verify, grant, complete) and canceled or declined (time out the waiting UI)
What to do in each purchase state. Rendered by NX Dev from the Play Billing and StoreKit docs, 3 Dec 2026.

What does PurchaseStatus.pending mean on Google Play?

Google Play supports pending transactions: purchases that need extra steps before the payment is processed. Google's own example is a user who picks a physical store, gets a code, and pays the cashier in cash later. Google's rules are clear:

  • Grant access only when the state is PURCHASED, never while it is PENDING.
  • Don't acknowledge a pending purchase. The three-day acknowledgement window starts when the purchase moves from PENDING to PURCHASED.
  • If the user doesn't pay in time, the purchase is cancelled and your backend gets a ONE_TIME_PRODUCT_CANCELED notification.

The Flutter plugin turns on pending purchases for you. In in_app_purchase_android the BillingClient is always built with enablePendingPurchases(...), so you can't opt out and have to handle the state.

The restorePurchases() trap on Android

On Android, InAppPurchase.instance.restorePurchases() queries Play and sets every result to PurchaseStatus.restored, including purchases that are still PENDING. If your app treats restored as "paid" without a server check, a user can unlock premium by starting a cash purchase and tapping Restore before paying. The underlying billingClientPurchase.purchaseState still says pending, so check that. InAppPurchaseAndroidPlatformAddition.queryPastPurchases() keeps the real state, which is why I use it for the launch check below.

What does pending mean on iOS?

With StoreKit 2, Product.purchase returns `.pending` when the purchase needs action from the customer. The common case is Ask to Buy: a child asks, a parent approves on their own device. The plugin passes this to Dart as PurchaseStatus.pending.

When the parent approves, StoreKit delivers the transaction through `Transaction.updates`, not through the original purchase call. Apple says to listen as soon as the app launches, because unfinished transactions are sent to the listener once, right after launch. In in_app_purchase_storekit, that listener starts when you subscribe to purchaseStream. If you only subscribe on the paywall screen, the approval can arrive while nobody is listening.

If the parent declines, your app gets no transaction at all. So your "waiting" UI needs a timeout or a way to close it, or it will spin forever.

How do I fix a purchase stuck on pending in Flutter?

Step 1: Handle every state explicitly

This handler is what I use as a starting point. It treats Android restored purchases that are still PENDING as pending, never grants or finishes an unpaid purchase, and keeps a purchase unfinished when your server is down so it is delivered again.

import 'package:in_app_purchase/in_app_purchase.dart';
import 'package:in_app_purchase_android/billing_client_wrappers.dart';
import 'package:in_app_purchase_android/in_app_purchase_android.dart';

/// What the paywall should show for a product.
enum PurchaseUi { waitingForPayment, granted, failed, canceled }

/// Result of asking your server to verify a purchase and grant access.
enum GrantResult { granted, rejected, retryLater }

/// The real state of a purchase.
///
/// On Android, restorePurchases() reports every purchase as
/// PurchaseStatus.restored, even one that is still PENDING (not paid yet).
/// The Play Billing purchase state underneath is the source of truth.
PurchaseStatus effectiveStatus(PurchaseDetails p) {
  if (p is GooglePlayPurchaseDetails &&
      p.billingClientPurchase.purchaseState == PurchaseStateWrapper.pending) {
    return PurchaseStatus.pending;
  }
  return p.status;
}

class PurchaseHandler {
  PurchaseHandler({
    required this.verifyAndGrant,
    required this.complete,
    required this.consume,
    required this.isConsumable,
    required this.onUi,
  });

  /// Calls your backend. The backend must check the purchase state with
  /// Google or Apple and only grant when it is PURCHASED.
  final Future<GrantResult> Function(PurchaseDetails p) verifyAndGrant;

  /// InAppPurchase.instance.completePurchase
  final Future<void> Function(PurchaseDetails p) complete;

  /// Android only: InAppPurchaseAndroidPlatformAddition.consumePurchase
  final Future<void> Function(PurchaseDetails p) consume;

  final bool Function(String productId) isConsumable;
  final void Function(String productId, PurchaseUi state) onUi;

  Future<void> handle(List<PurchaseDetails> purchases) async {
    for (final p in purchases) {
      final status = effectiveStatus(p);

      if (status == PurchaseStatus.pending) {
        // Not paid yet (cash code, bank transfer, Ask to Buy, slow card).
        // Do not grant, do not acknowledge, do not finish.
        onUi(p.productID, PurchaseUi.waitingForPayment);
        continue;
      }

      var finish = true;
      switch (status) {
        case PurchaseStatus.purchased:
        case PurchaseStatus.restored:
          final result = await verifyAndGrant(p);
          if (result == GrantResult.retryLater) {
            finish = false; // keep it unfinished so it is delivered again
            onUi(p.productID, PurchaseUi.failed);
          } else {
            onUi(p.productID,
                result == GrantResult.granted ? PurchaseUi.granted : PurchaseUi.failed);
          }
        case PurchaseStatus.canceled:
          onUi(p.productID, PurchaseUi.canceled);
        case PurchaseStatus.error:
        case PurchaseStatus.pending:
          onUi(p.productID, PurchaseUi.failed);
      }

      if (!finish) continue;
      if (p is GooglePlayPurchaseDetails &&
          status == PurchaseStatus.purchased &&
          isConsumable(p.productID)) {
        await consume(p); // consuming also acknowledges on Google Play
      } else if (p.pendingCompletePurchase) {
        await complete(p);
      }
    }
  }
}

verifyAndGrant should call your backend. The backend should load the purchase from Google (purchases.productsv2.getproductpurchasev2) or Apple and only grant when the state is PURCHASED. Google recommends doing this processing on the server. If you don't have a server yet, my Real-time Developer Notifications guide shows how to receive Play's purchase events.

Step 2: Listen from app start and re-check on launch

import 'dart:async';
import 'dart:io' show Platform;

import 'package:in_app_purchase/in_app_purchase.dart';
import 'package:in_app_purchase_android/in_app_purchase_android.dart';

import 'purchase_handler.dart';

StreamSubscription<List<PurchaseDetails>>? _purchaseSub;

/// Call once at startup (for example in main() after runApp),
/// not only when the paywall opens.
Future<void> startPurchaseListener(PurchaseHandler handler) async {
  final iap = InAppPurchase.instance;

  // iOS: listening starts StoreKit 2 Transaction.updates, which delivers
  // unfinished transactions (such as an approved Ask to Buy) after launch.
  _purchaseSub ??= iap.purchaseStream.listen(handler.handle);

  // Android: pick up purchases that were paid while the app was closed.
  // queryPastPurchases keeps the real PENDING or PURCHASED state.
  if (Platform.isAndroid) {
    final android = iap.getPlatformAddition<InAppPurchaseAndroidPlatformAddition>();
    final response = await android.queryPastPurchases();
    if (response.error == null) {
      await handler.handle(response.pastPurchases);
    }
  }
}

This catches the two "paid later" cases: a cash payment made while the app was closed (Android) and an approved Ask to Buy (iOS).

Step 3: Update in_app_purchase_storekit for iOS 27

In in_app_purchase_storekit 0.4.16 and earlier, StoreKit 2 purchases used Product.purchase(options:) without a view or scene. On iOS 27 and iPadOS 27 StoreKit can't find where to show the payment sheet ("Could not find a UI anchor"), and the call never returns. PR #13410 switched to purchase(confirmIn:options:) and shipped in 0.4.17. It fixes issue #194373, where App Review rejected an iPad subscription under Guideline 2.1(b).

flutter pub upgrade in_app_purchase in_app_purchase_storekit
grep -A4 "in_app_purchase_storekit:" pubspec.lock   # expect version "0.4.17" or later

Step 4: Finish old transactions on iOS

Since 0.4.10 the plugin refuses a new StoreKit 2 purchase when the same product has an unfinished transaction. It returns storekit_duplicate_product_object with the message "There is a pending transaction for the same product identifier". The cause is almost always a missing completePurchase after delivery. With the handler above, every purchased, restored, failed or cancelled transaction is finished, and the next launch clears the backlog.

How do I test pending purchases?

Google Play gives license testers two slow test cards: "Slow test card, approves after a few minutes" and "Slow test card, declines after a few minutes".

  1. Buy with the declining card, restart the app, and confirm nothing was granted.
  2. Buy with the approving card, close the app, wait a few minutes, reopen it and confirm access was granted and acknowledged.
  3. Tap Restore while a slow-card purchase is still pending and confirm the app still shows "waiting".

For iOS, enable Ask to Buy in your StoreKit configuration file (Configuration Settings, Purchase Options). Buy, choose Ask, then approve or decline it in Xcode's transaction manager. Test on an iOS 27 or iPadOS 27 device or simulator too.

The handler's unit tests run against the real plugin classes (in_app_purchase 3.3.1, in_app_purchase_android 0.5.5):

00:00 +0: plugin marks a PENDING Play purchase as needing completion
00:00 +1: pending purchase is not granted, acknowledged or finished
00:00 +2: restorePurchases-style "restored" that is still PENDING stays pending
00:00 +3: completed non-consumable is verified then acknowledged
00:00 +4: completed consumable is consumed, not just acknowledged
00:00 +5: server outage leaves the purchase unfinished for a retry
00:00 +6: already acknowledged restored purchase is not acknowledged again
00:00 +7: All tests passed!

How do I stop this from happening again?

  • Subscribe to purchaseStream in main(), not inside the paywall widget.
  • Treat pending as a normal state with its own UI and copy ("We'll unlock this as soon as your payment clears").
  • Grant only from your server, after it reads PURCHASED from Google or Apple.
  • Never call completePurchase for a pending purchase, and don't trust restored on Android without checking purchaseState.
  • Keep in_app_purchase_storekit current and test every release on the newest iOS and iPadOS.
  • Add the slow test cards and Ask to Buy to your release checklist, next to the acknowledgement check that prevents 3-day refunds.

Frequently asked questions

Why is my in-app purchase still pending?

The payment has not been completed yet. On Google Play this happens with cash codes, bank transfers, slow payment methods or family approval, and on iOS it is usually Ask to Buy waiting for a parent.

What does PurchaseStatus.pending mean in Flutter?

It means the user started the purchase but the store has not confirmed payment. Show a waiting state and do not grant access or call completePurchase until the status becomes purchased.

Should I call completePurchase for a pending purchase?

No. On Android, Google says not to acknowledge a pending purchase, and the three-day acknowledgement window only starts once it becomes PURCHASED. In in_app_purchase_android 0.5.5 pendingCompletePurchase is already true for pending purchases, so check the status first.

How long can a Google Play purchase stay pending?

It depends on the payment method. If the user does not pay within the required time, Google cancels the purchase and sends a ONE_TIME_PRODUCT_CANCELED notification to your backend.

Why does my iOS purchase never complete on iOS 27?

in_app_purchase_storekit 0.4.16 and earlier called the StoreKit 2 purchase API without a UI anchor, which never returns on iOS 27 and iPadOS 27. Version 0.4.17 uses purchase(confirmIn:options:) and fixes it.

What does There is a pending transaction for the same product identifier mean?

It is the storekit_duplicate_product_object error from in_app_purchase_storekit 0.4.10 and later. An earlier transaction for the same product was never finished, so deliver it and call completePurchase.

How do I test pending purchases on Google Play?

Use a license tester account and pick Slow test card, approves after a few minutes or Slow test card, declines after a few minutes in the purchase dialog.

How do I test Ask to Buy in Xcode?

Enable Ask to Buy under Purchase Options in your StoreKit configuration file, choose Ask during the purchase, then approve or decline it in the Xcode transaction manager.

Sources

  1. Integrate the Google Play Billing Library: handle pending transactions (Android Developers)
  2. One-time purchase lifecycle (Android Developers)
  3. Test your Google Play Billing Library integration: test pending purchases (Android Developers)
  4. Product.PurchaseResult.pending (Apple Developer)
  5. Transaction.updates (Apple Developer)
  6. Testing Ask to Buy in Xcode (Apple Developer)
  7. purchase(confirmIn:options:) (Apple Developer)
  8. in_app_purchase changelog (3.3.1) (pub.dev)
  9. in_app_purchase_android changelog (0.5.5) (pub.dev)
  10. in_app_purchase_storekit changelog (0.4.17) (pub.dev)
  11. [in_app_purchase_storekit] Use purchase(confirmIn:) for StoreKit 2 purchases (PR 13410) (flutter/packages on GitHub, 2026-11-04)
  12. StoreKit 2 purchase without a scene; App Review rejected iPad subscription purchases (issue 194373) (GitHub, 2026-10-14)
  13. GooglePlayPurchaseDetails source (pendingCompletePurchase) (flutter/packages on GitHub)
  14. InAppPurchaseAndroidPlatform source (restorePurchases, auto-consume) (flutter/packages on GitHub)
SharePost on XLinkedIn

Comments

Share a question or note about this article.

Loading comments…