Question

addPurchaserInfoUpdateListener do not trigger for a purchase on IOS

  • 11 October 2021
  • 2 replies
  • 28 views

Badge

Environment
Version plugin : purchases_flutter: ^3.4.1

Flutter doctor

/Users/bob/development/flutter/bin/flutter doctor --verbose
[✓] Flutter (Channel stable, 2.5.2, on macOS 11.6 20G165 darwin-x64, locale en-FR)
• Flutter version 2.5.2 at /Users/bob/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 3595343e20 (11 days ago), 2021-09-30 12:58:18 -0700
• Engine revision 6ac856380f
• Dart version 2.14.3

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/bob/Library/Android/sdk
• Platform android-31, build-tools 30.0.3
• Java binary at: /Users/bob/Documents/Existing files/Macintosh HD - Data/Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 13.0, Build version 13A233
• CocoaPods version 1.11.2

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] Android Studio (version 2020.3)
• Android Studio at /Users/bob/Documents/Existing files/Macintosh HD - Data/Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] Connected device (2 available)
• iPhone (mobile) • XXXXXXXXXXX. • ios • iOS 14.6 18F72
• Chrome (web) • chrome • web-javascript • Google Chrome 94.0.4606.81

• No issues found!
Process finished with exit code 0

Describe the bug
1- User A buy a non-consumable item with 20 days before it expires
2- User A removed the app
2- The product expires after 20 days passed
3- User A installs the app again and wants to buy again the item.
here comes the issue, User A buys the item, he has a confirmation dialog, but nothing changes in the app.

PROBLEM:
On IOS, addPurchaserInfoUpdateListener is not triggered when a user purchase.....but on launch the addPurchaserInfoUpdateListener is triggered and we receive the PurchaseInfo object.

It confuses me because I can really purchase on the phone as if it was normal. I even have the purchase confirmation dialog.
But on Android Studio, addPurchaserInfoUpdateListener is not triggered at all, and Nothing appears in the RevenueCat Sandbox Overview.

One thing which confuses me is that nothing changed in the code apart from the in-app-review plugins and a little code. I did try to remove this plugin, but it was not the guilty part.

In Android, it works perfectly fine.

Here below is the code on launch and when a user makes a purchase.

I'll appreciate any experience here, It's been 2 days, I tried so many things, I don't have a clue of what is going on here !

LOGS ON LAUNCH

[Purchases] - DEBUG: ℹ️ Debug logging enabled
[Purchases] - DEBUG: ℹ️ SDK Version - 3.12.3
[Purchases] - DEBUG: 👤 Initial App User ID - (null)
[Purchases] - DEBUG: 👤 Identifying App User ID: $RCAnonymousID:XXXXX
[Purchases] - DEBUG: ℹ️ Delegate set
[Purchases] - DEBUG: ℹ️ There are no requests currently running, starting request GET /subscribers/$RCAnonymousID0X0P+0XXXXX
[Purchases] - DEBUG: ℹ️ API request started: GET /v1/subscribers/$RCAnonymousID:XXXXX
[Purchases] - DEBUG: ℹ️ API request started: GET /v1/subscribers/$RCAnonymousID:XXXXX/offerings
[Purchases] - DEBUG: ℹ️ Force refreshing the receipt to get latest transactions from Apple.
[Purchases] - DEBUG: ℹ️ API request completed with status: GET /v1/subscribers/$RCAnonymousID:XXXXX/offerings 200
[Purchases] - DEBUG: ℹ️ API request completed with status: GET /v1/subscribers/$RCAnonymousID:XXXXX 201
[Purchases] - DEBUG: ℹ️ Sending latest PurchaserInfo to delegate.
[Purchases] - DEBUG: ℹ️ Serial request done: GET /subscribers/$RCAnonymousID0X0P+0XXXXX, 0 requests left in the queue
[Purchases] - DEBUG: ℹ️ Loaded receipt from url file:///private/var/mobile/Containers/Data/Application/ZZZZZZ/StoreKit/sandboxReceipt
[Purchases] - INFO: ℹ️ Parsing receipt
[Purchases] - WARN: ⚠️ /Users/bob/Downloads/name_project/ios/Pods/PurchasesCoreSwift/PurchasesCoreSwift/LocalReceiptParsing/ReceiptParser.swift-receiptHasTransactions(receiptData:): Could not parse receipt, conservatively returning true
[Purchases] - DEBUG: ℹ️ Found 0 unsynced attributes for App User ID: $RCAnonymousID:XXXXX
[Purchases] - DEBUG: ℹ️ There are no requests currently running, starting request POST /receipts
[Purchases] - DEBUG: ℹ️ API request started: POST /v1/receipts
[Purchases] - DEBUG: ℹ️ API request completed with status: POST /v1/receipts 200
[Purchases] - DEBUG: ℹ️ Serial request done: POST /receipts, 0 requests left in the queue
[Purchases] - DEBUG: ℹ️ Sending updated PurchaserInfo to delegate.

LOGS WHEN USER MAKE PURCHASE

[Purchases] - DEBUG: ℹ️ Requesting products from the store with identifiers: {("myapp_non_consumable_3.99")}
[Purchases] - DEBUG: ℹ️ Products request finished.
[Purchases] - DEBUG: 💰 Retrieved SKProducts:
[Purchases] - DEBUG: 💰 myapp_non_consumable_3.99 - <SKProduct: 0x2839ee600>
[Purchases] - DEBUG: ℹ️ 1 completion handlers waiting on products
[Purchases] - DEBUG: ℹ️ makePurchase
[Purchases] - DEBUG: 💰 Purchasing product - myapp_non_consumable_3.99
[Purchases] - DEBUG: ℹ️ PaymentQueue updatedTransaction: myapp_non_consumable_3.99 (null) ((null)) (null) - 0
[Purchases] - DEBUG: ℹ️ applicationDidBecomeActive
[Purchases] - DEBUG: ℹ️ applicationDidBecomeActive
[Purchases] - DEBUG: ℹ️ PaymentQueue updatedTransaction: myapp_non_consumable_3.99 1000000890890699 ((null)) 1000000861236246 - 1
[Purchases] - DEBUG: ℹ️ Loaded receipt from url file:///private/var/mobile/Containers/Data/Application/ZZZZZZ/StoreKit/sandboxReceipt
[Purchases] - DEBUG: ℹ️ Found 0 unsynced attributes for App User ID: $RCAnonymousID:XXXXX
[Purchases] - DEBUG: ℹ️ There are no requests currently running, starting request POST /receipts
[Purchases] - DEBUG: ℹ️ API request started: POST /v1/receipts
[Purchases] - DEBUG: ℹ️ applicationDidBecomeActive
[Purchases] - DEBUG: ℹ️ API request completed with status: POST /v1/receipts 200
[Purchases] - DEBUG: ℹ️ Serial request done: POST /receipts, 0 requests left in the queue
[Purchases] - DEBUG: 💰 Finishing transaction myapp_non_consumable_3.99 1000000890699 (1000000236246)
[Purchases] - DEBUG: ℹ️ PaymentQueue removedTransaction: myapp_non_consumable_3.99 1000000890699 (1000000236246 (null)) (null) - 1

2 replies

Userlevel 2
Badge +6

Hey @krems ,

I created a zendesk ticket to handle this request so we can get some sensitive information from you ( App name, app user id ect. ) One of our support engineers will help solve this issue!

Badge

Hi, 

 

I might found the issue:

I have been selling the same non-consumable many times. Somehow, Apple changed something because it worked before. Then I tried to sell consumable IAP, it went through and now it works like a charm.

I should have used consumables from the start as my product expires...guilty !!

What it's strange is that it use to work until recently. I don't what happened, but it stopped working suddenly.

Now, with consumable products, it works.

For people here reading this, you just need to:

  • go on your Apple Connect
  • In the sidebar under In-App Purchases, click Manage.
  • Click the "+" sign to create an IAP
  • Select "Consumable" and create your new IAP
  • take your new IAP id to your RevenueCat account in the "Products" settings

And then you will be ready to use it in your code. It is important to note that RevenueCat keeps consumable sales in database if you need to restore purchase in the future.

It works now for me, but it's still a mystery of why it stopped working suddenly !!

Reply