purchases-flutter icon indicating copy to clipboard operation
purchases-flutter copied to clipboard

The second and subsequent purchases did not go well and were not reflected on the dashboard

Open Terurinpic opened this issue 3 years ago • 23 comments

‼️ Required data ‼️

Do not remove any of the steps from the template below. If a step is not applicable to your issue, please leave that step empty.

There are a lot of things that can contribute to things not working. Having a very basic understanding of your environment will help us understand your issue faster!

Environment

  • [x] Output of flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.4, on macOS 13.0 22A380 darwin-arm, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.73.0)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

• No issues found!
  • [x] Version of purchases-flutter
    • 4.5.4
  • [x] Testing device version e.g.: iOS 15.5, Android API 30, etc.
    • iOS 16.0.3
  • [x] How often the issue occurs- every one of your customers is impacted? Only in dev?
    • Only ios16 or higher
    • Often happens on second purchase
  • [x] Debug logs that reproduce the issue
    • first purchase(working fine)
[Purchases] - WARN: 🍎⚠️ StoreKit 2 purchase took longer than expected (30.57 seconds)
[Purchases] - DEBUG: ℹ️ Force refreshing the receipt to get latest transactions from Apple.
[Purchases] - DEBUG: ℹ️ SKReceiptRefreshRequest started
[Purchases] - WARN: ⚠️ The appUserID passed to logIn is the same as the one already cached. No action will be taken.
[Purchases] - DEBUG: ℹ️ Vending CustomerInfo from cache.
[Purchases] - DEBUG: ℹ️ GetOfferingsOperation: Started
[Purchases] - DEBUG: ℹ️ There are no requests currently running, starting request GET subscribers/DXtY6V9dOmTieLJwo1fPBXC0EHD2/offerings
[Purchases] - DEBUG: ℹ️ API request started: GET /v1/subscribers/DXtY6V9dOmTieLJwo1fPBXC0EHD2/offerings
[Purchases] - DEBUG: ℹ️ API request completed: GET /v1/subscribers/DXtY6V9dOmTieLJwo1fPBXC0EHD2/offerings (200)
[Purchases] - DEBUG: ℹ️ Skipping products request for these products because they were already cached: ["dev.gera.fan.premium_ticket.1", "dev.gera.fan.premium_ticket.3", "dev.gera.fan.premium_ticket.30.free.20", "dev.gera.fan.premium_ticket.20.free.12", "dev.gera.fan.premium_ticket.10.free.5", "dev.gera.fan.premium_ticket.50.free.50", "dev.gera.fan.premium_ticket.5.free.2", "gera_dev_099_test"]
[Purchases] - DEBUG: ℹ️ GetOfferingsOperation: Finished
[Purchases] - DEBUG: ℹ️ Serial request done: GET subscribers/DXtY6V9dOmTieLJwo1fPBXC0EHD2/offerings, 0 requests left in the queue
[Purchases] - DEBUG: ℹ️ SKReceiptRefreshRequest finished
[Purchases] - DEBUG: ℹ️ Loaded receipt from url file:///private/var/mobile/Containers/Data/Application/D7D69861-EF24-45E9-B889-D4311FA5F728/StoreKit/sandboxReceipt
[Purchases] - DEBUG: ℹ️ Skipping products request for these products because they were already cached: ["dev.gera.fan.premium_ticket.1"]
[Purchases] - DEBUG: ℹ️ Found 0 unsynced attributes for App User ID: DXtY6V9dOmTieLJwo1fPBXC0EHD2
[Purchases] - DEBUG: ℹ️ PostReceiptDataOperation: Started
[Purchases] - INFO: ℹ️ Receipt parsed successfully
[Purchases] - DEBUG: ℹ️ PostReceiptDataOperation: Posting receipt (note: the contents might not be up-to-date, but it will be refreshed with Apple's servers):
{
  "opaque_value" : "siIZ1WcLpkVQACSIVatZlw==",
  "original_application_version" : "1.0",
  "bundle_id" : "fan.gera.dev",
  "sha1_hash" : "LnbWuFETws5mGv3ThsmyjegSsfA=",
  "application_version" : "827",
  "creation_date" : "2022-12-22T03:56:49Z",
  "in_app_purchases" : [
    {
      "product_id" : "dev.gera.fan.premium_ticket.1",
      "quantity" : 1,
      "transaction_id" : "2000000234083525",
      "is_in_trial_period" : false,
      "web_order_line_item_id" : 0,
      "original_purchase_date" : "2022-12-22T03:56:43Z",
      "original_transaction_id" : "2000000234083525",
      "product_type" : 1,
      "purchase_date" : "2022-12-22T03:56:43Z"
    }
  ]
}
[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: POST /v1/receipts (200)
[Purchases] - DEBUG: ℹ️ PostReceiptDataOperation: Finished
[Purchases] - DEBUG: ℹ️ Serial request done: POST receipts, 0 requests left in the queue
[Purchases] - DEBUG: ℹ️ Sending updated CustomerInfo to delegate.
[Purchases] - INFO: 💰 Finishing transaction '2000000234083525' for product 'dev.gera.fan.premium_ticket.1'
[Purchases] - INFO: 😻💰 Purchased product - 'dev.gera.fan.premium_ticket.1'
  • second purchase(there's problem)
[Purchases] - WARN: ⚠️ The appUserID passed to logIn is the same as the one already cached. No action will be taken.
[Purchases] - DEBUG: ℹ️ Vending CustomerInfo from cache.
[Purchases] - DEBUG: ℹ️ GetOfferingsOperation: Started
[Purchases] - DEBUG: ℹ️ There are no requests currently running, starting request GET subscribers/DXtY6V9dOmTieLJwo1fPBXC0EHD2/offerings
[Purchases] - DEBUG: ℹ️ API request started: GET /v1/subscribers/DXtY6V9dOmTieLJwo1fPBXC0EHD2/offerings
[Purchases] - DEBUG: ℹ️ API request completed: GET /v1/subscribers/DXtY6V9dOmTieLJwo1fPBXC0EHD2/offerings (200)
[Purchases] - DEBUG: ℹ️ Skipping products request for these products because they were already cached: ["dev.gera.fan.premium_ticket.10.free.5", "dev.gera.fan.premium_ticket.30.free.20", "dev.gera.fan.premium_ticket.20.free.12", "gera_dev_099_test", "dev.gera.fan.premium_ticket.50.free.50", "dev.gera.fan.premium_ticket.5.free.2", "dev.gera.fan.premium_ticket.1", "dev.gera.fan.premium_ticket.3"]
[Purchases] - DEBUG: ℹ️ GetOfferingsOperation: Finished
[Purchases] - DEBUG: ℹ️ Serial request done: GET subscribers/DXtY6V9dOmTieLJwo1fPBXC0EHD2/offerings, 0 requests left in the queue
<SKReceiptRefreshRequest: 0x280852340>: Finished refreshing receipt with error: Error Domain=ASDErrorDomain Code=603 "Request throttled" UserInfo={NSLocalizedDescription=Request throttled, NSLocalizedFailureReason=Unified receipt is valid and current}
[Purchases] - DEBUG: ℹ️ SKReceiptRefreshRequest finished
[Purchases] - DEBUG: ℹ️ Loaded receipt from url file:///private/var/mobile/Containers/Data/Application/D7D69861-EF24-45E9-B889-D4311FA5F728/StoreKit/sandboxReceipt
[Purchases] - DEBUG: ℹ️ Skipping products request for these products because they were already cached: ["dev.gera.fan.premium_ticket.1"]
[Purchases] - DEBUG: ℹ️ Found 0 unsynced attributes for App User ID: DXtY6V9dOmTieLJwo1fPBXC0EHD2
[Purchases] - DEBUG: ℹ️ PostReceiptDataOperation: Started
[Purchases] - INFO: ℹ️ Receipt parsed successfully
[Purchases] - DEBUG: ℹ️ PostReceiptDataOperation: Posting receipt (note: the contents might not be up-to-date, but it will be refreshed with Apple's servers):
{
  "opaque_value" : "siIZ1WcLpkVQACSIVatZlw==",
  "original_application_version" : "1.0",
  "bundle_id" : "fan.gera.dev",
  "sha1_hash" : "LnbWuFETws5mGv3ThsmyjegSsfA=",
  "application_version" : "827",
  "creation_date" : "2022-12-22T03:56:49Z",
  "in_app_purchases" : [
    {
      "product_id" : "dev.gera.fan.premium_ticket.1",
      "quantity" : 1,
      "transaction_id" : "2000000234083525",
      "is_in_trial_period" : false,
      "web_order_line_item_id" : 0,
      "original_purchase_date" : "2022-12-22T03:56:43Z",
      "original_transaction_id" : "2000000234083525",
      "product_type" : 1,
      "purchase_date" : "2022-12-22T03:56:43Z"
    }
  ]
}
[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: POST /v1/receipts (200)
[Purchases] - DEBUG: ℹ️ PostReceiptDataOperation: Finished
[Purchases] - DEBUG: ℹ️ Serial request done: POST receipts, 0 requests left in the queue
[Purchases] - INFO: 💰 Finishing transaction '2000000234084002' for product 'dev.gera.fan.premium_ticket.1'
[Purchases] - INFO: 😻💰 Purchased product - 'dev.gera.fan.premium_ticket.1'
  • [x] Steps to reproduce, with a description of expected vs. actual behavior Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)

Describe the bug

I want to make the second and subsequent purchases successful. However, after the second purchase, the following error occurs and the purchase is not reflected on the dashboard.

<SKReceiptRefreshRequest: 0x28250fb40>: Finished refreshing receipt with error: Error Domain=ASDErrorDomain Code=603 "Request throttled" UserInfo={NSLocalizedDescription=Request throttled, NSLocalizedFailureReason=Unified receipt is valid and current}

Additional context

it's working on Android and iOS15

Thank you.

Terurinpic avatar Dec 22 '22 04:12 Terurinpic

👀 SDKONCALL-194 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

RCGitBot avatar Dec 22 '22 04:12 RCGitBot

Is this happening in sandbox? If so, this is likely happening because the user has many purchases in their receipt, which is common in sandbox. You can try making a new sandbox user. Currently our mobile engineers are working on updating the SDK to handle this sandbox case better, but you likely won't see this happen in production.

If this is in production, please let me know!

michaelAtRC avatar Dec 28 '22 17:12 michaelAtRC

@Terurinpic it seems like this ticket is a duplicate of https://github.com/RevenueCat/purchases-flutter/issues/557, would you mind if we close this one out and continue conversation there?

aboedo avatar Dec 28 '22 17:12 aboedo

@michaelAtRC it's happening in sandbox. Create a new account and check it out!

@aboedo This issue cannot purchase the same product. (error dialog is not displayed) But #557 shows an error dialog when purchasing different products. So I think it's another issue.

Terurinpic avatar Dec 30 '22 01:12 Terurinpic

Hey @Terurinpic Happy new year!

Quick question, did creating a new sandbox user and purchasing show you the same problem? Or did it resolve this issue?

michaelAtRC avatar Jan 03 '23 16:01 michaelAtRC

Hello @michaelAtRC Happy New Year to you too!

I tried it, but i have the same problem.

Terurinpic avatar Jan 05 '23 00:01 Terurinpic

Hey @Terurinpic

I have gone ahead and raised this issue to the TRIAGE team. I will keep you updated as I get more information!

michaelAtRC avatar Jan 05 '23 19:01 michaelAtRC

The logs show that the request to refresh the receipt was throttled. That seems to be a new thing in StoreKit, since we only started seeing it like a month or two ago. We recently made updates to try to prevent that, but those updates should be a part of 4.5.4, so perhaps that wasn't enough 😬 cc @NachoSoto

aboedo avatar Jan 11 '23 19:01 aboedo

@Terurinpic question that might be helpful for us when debugging, are these consumables or non-consumables?

aboedo avatar Jan 12 '23 13:01 aboedo

@aboedo consumables!

Terurinpic avatar Jan 12 '23 13:01 Terurinpic

Thanks for the quick turnaround! We're investigating the issue. It seems likely that it's related to the throttling of the refresh receipt request

aboedo avatar Jan 12 '23 13:01 aboedo

@Terurinpic does this reproduce consistently for you? I see a number of purchases for that user in the purchase history for dev.gera.fan.premium_ticket.1, are you checking the "show sandbox data" checkbox?

aboedo avatar Jan 16 '23 18:01 aboedo

@aboedo Reproduce consistently! After launching the app, the first purchase is reflected in the dashboard, but the second purchase is not reflected. I checked "show sandbox data".

Terurinpic avatar Jan 17 '23 03:01 Terurinpic

@Terurinpic do they show in the SDK in customerInfo under nonSubscriptionTransactions?

aboedo avatar Jan 17 '23 14:01 aboedo

I can't seem to reproduce 😬 I just tried buying the same consumable multiple times in the same session I can see all purchases in the dashboard in sandbox data

aboedo avatar Jan 17 '23 14:01 aboedo

@aboedo It seems that the second purchase is not displayed in nonSubscriptionTransactions.(The first purchase is shown.) Oh no... Is there anything that I can do?

Terurinpic avatar Jan 18 '23 01:01 Terurinpic

Hey @Terurinpic could we get appUserIDs that reproduce this and gather logs for it? I tried looking up the appUserID in the logs but it’s already been cycled out.

michaelAtRC avatar Jan 25 '23 19:01 michaelAtRC

@michaelAtRC Should I send the my AppUserId to the URL below? the support section of the Dashboard

Terurinpic avatar Jan 27 '23 00:01 Terurinpic

Hey @Terurinpic That would be great to create a new support ticket!

michaelAtRC avatar Jan 27 '23 21:01 michaelAtRC

@michaelAtRC I sent my AppUserId now!

Terurinpic avatar Jan 30 '23 03:01 Terurinpic

Hey @michaelAtRC @aboedo The project I'm working on didn't have an app-specific shared secret, so I set it up and now it works! (same https://github.com/RevenueCat/purchases-flutter/issues/557) Thanks for investigating! RC is a great service!

Terurinpic avatar Feb 17 '23 08:02 Terurinpic

@Terurinpic do they show in the SDK in customerInfo under nonSubscriptionTransactions?

@aboedo Also running into this issue v8.10.6 on macOS 26 -- have not shipped to PROD yet so not sure if it'll work

But I can confirm nonSubscriptionTransactions doesn't have the new transactions either.

EDIT: using SK2, so confirmed my specific issue is not related to app-specific shared secret. Pretty sure it's configured correctly b/c the first initial transaction is showing up, but not the rest

isaacy13 avatar Jul 17 '25 01:07 isaacy13

If I clear transactions from Xcode > Debug > StoreKit > Transaction Manager > Delete, then I re-purchase, then it'll show up as a new record in the dashboard and in nonSubscriptionTransactions

However, subsequent purchases will not work -- it won't even ask for biometrics, the Purchases.purchasePackage call just returns successfully


FWIW, 1hr ago I switched from in_app_purchase to this package

I found bugs https://github.com/flutter/flutter/issues/172086 & https://github.com/flutter/flutter/issues/172199, the first of which I fixed, but the second one was a head scratcher

I'm starting to think there's a bug on Apple's side that's resurfaced

In the in_app_purchase library, I confirmed transaction.finish() was being called, but it wasn't being reflected in Transaction Manager

It seems the same issue might be occurring in this package. Image

I'm assuming that if the transaction isn't marked as finished, then Apple will return the same transaction (which is why biometrics didn't re-engage), basically trying to get the app to finish that transaction.

However, since the transaction is never able to get finished/completed, it gets stuck on the first transaction

isaacy13 avatar Jul 17 '25 01:07 isaacy13