flutter / flutter/flutter

[iOS] purchaseStream returns outdated purchases even after clearing account + appAccountToken stays the same

Open
#169,744 8 comments 4 reactions 0 assignees View on GitHub
customer: solaris found in release: 3.32 found in release: 3.33 has reproducible steps p: in_app_purchase P2 package platform-ios team-ios triaged-ios
Dominant language
Dart
Stars
179k
Forks
31.1k
PR merge metrics
PR metrics pending

Description

Hi, I'm facing two possibly related issues using in_app_purchase on iOS (Sandbox environment). This affects our production logic that relies on transaction tokens.

Issue 1: purchaseStream returns old purchase, even after clearing purchases

After calling buyNonConsumable() with a new product ID purchaseStream still returns the previous purchase.
This happens even after clearing all purchases from the Sandbox test account settings.

log example (invoiceToken for applicationUserName)
```
flutter: invoiceToken = 1f0b8c5b-a736-4d6b-9f87-02652b87632b
flutter: productDetails.id = com.kryonvpn.annual
flutter: buyNonConsumable
flutter: Purchase stream update: com.kryonvpn.6months
flutter: Purchase completed: com.kryonvpn.6months

flutter: invoiceToken = a5182144-a4ba-4f3e-9b8a-b193072bcea0
flutter: productDetails.id = com.kryonvpn.monthly
flutter: buyNonConsumable
flutter: Purchase stream update: com.kryonvpn.6months
flutter: Purchase completed: com.kryonvpn.6months
```

Expected
Each call to buyNonConsumable() should result in a fresh purchase returned by the stream.

Issue 2: appAccountToken / appTransactionId remains the same across multiple distinct purchases

On the server, even when a new appAccountToken is passed from the client for each purchase (UUID), Apple keeps returning the same appTransactionId.
This breaks our backend logic which relies on this being a unique transaction identifier.
```
{"time":"2025-05-28T05:31:11Z","msg":"Apple transaction payload","payload":{"appAccountToken":"2d5a0880-f68e-44a7-a414-f51204e63904","appTransactionId":"704464472748013865","productId":"com.kryonvpn.monthly","transactionId":"2000000928154716"}}
{"time":"2025-05-28T09:35:11Z","msg":"Apple transaction payload","payload":{"appAccountToken":"2d5a0880-f68e-44a7-a414-f51204e63904","appTransactionId":"704464472748013865","productId":"com.kryonvpn.monthly","transactionId":"2000000928429780"}}
```

Environment
in_app_purchase 3.2.3
iOS Sandbox account
Purchase method: buyNonConsumable()
Each purchase uses a unique applicationUserName / appAccountToken (UUID)

Thanks for your help!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.