Skip to content

It seems that the cached receipt is being used for the second purchase #540

Description

@Terurinpic

‼️ 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

  • 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!
  • Version of purchases-flutter
    • 4.4.3
  • Testing device version e.g.: iOS 15.5, Android API 30, etc.
    • iOS 16.0.3
  • How often the issue occurs- every one of your customers is impacted? Only in dev?
    • Only ios16 or higher
    • Often happens on second purchase
  • Debug logs that reproduce the issue
    • first purchase(working fine)
[Purchases] - DEBUG: ℹ️ Force refreshing the receipt to get latest transactions from Apple.
[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/xpV6fr22RAhJj1wCiAPPrDGLti93/offerings
[Purchases] - DEBUG: ℹ️ API request started: GET /v1/subscribers/xpV6fr22RAhJj1wCiAPPrDGLti93/offerings
[Purchases] - DEBUG: ℹ️ API request completed: GET /v1/subscribers/xpV6fr22RAhJj1wCiAPPrDGLti93/offerings (200)
[Purchases] - DEBUG: ℹ️ Skipping products request for these products because they were already cached: ["staging.gera.fan.premium_ticket.3", "staging.gera.fan.premium_ticket.20.free.12", "staging.gera.fan.premium_ticket.30.free.20", "staging.gera.fan.premium_ticket.10.free.5", "staging.gera.fan.premium_ticket.5.free.2", "staging.gera.fan.premium_ticket.50.free.50", "staging.gera.fan.premium_ticket.1"]
[Purchases] - DEBUG: ℹ️ GetOfferingsOperation: Finished
[Purchases] - DEBUG: ℹ️ Serial request done: GET subscribers/xpV6fr22RAhJj1wCiAPPrDGLti93/offerings, 0 requests left in the queue
[Purchases] - DEBUG: ℹ️ Loaded receipt from url file:///private/var/mobile/Containers/Data/Application/E60204B8-1B24-46ED-8E6C-BA7A0A56403D/StoreKit/sandboxReceipt
[Purchases] - DEBUG: ℹ️ Skipping products request for these products because they were already cached: ["staging.gera.fan.premium_ticket.5.free.2"]
[Purchases] - DEBUG: ℹ️ Found 0 unsynced attributes for App User ID: xpV6fr22RAhJj1wCiAPPrDGLti93
[Purchases] - DEBUG: ℹ️ PostReceiptDataOperation: Started
[Purchases] - INFO: ℹ️ Receipt parsed successfully
[Purchases] - DEBUG: ℹ️ PostReceiptDataOperation: Posting receipt: {
  "opaque_value" : "2zuL7wIHWAIdbR+h1RPMWg==",
  "original_application_version" : "1.0",
  "bundle_id" : "fan.gera.staging",
  "sha1_hash" : "A7rAboe5EBC3VIXYD5kfi29+SOc=",
  "application_version" : "825",
  "creation_date" : "2022-12-07T02:24:23Z",
  "in_app_purchases" : [
    {
      "product_id" : "staging.gera.fan.premium_ticket.5.free.2",
      "quantity" : 1,
      "transaction_id" : "2000000221069226",
      "is_in_trial_period" : false,
      "web_order_line_item_id" : 0,
      "original_purchase_date" : "2022-12-07T02:24:19Z",
      "original_transaction_id" : "2000000221069226",
      "product_type" : 1,
      "purchase_date" : "2022-12-07T02:24:19Z"
    }
  ]
}
[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 '2000000221069226' for product 'staging.gera.fan.premium_ticket.5.free.2'
[Purchases] - INFO: 😻💰 Purchased product - 'staging.gera.fan.premium_ticket.5.free.2'
  • second purchase(there's problem)
[Purchases] - DEBUG: ℹ️ Force refreshing the receipt to get latest transactions from Apple.
[Purchases] - DEBUG: ℹ️ applicationDidBecomeActive
[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/xpV6fr22RAhJj1wCiAPPrDGLti93/offerings
[Purchases] - DEBUG: ℹ️ API request started: GET /v1/subscribers/xpV6fr22RAhJj1wCiAPPrDGLti93/offerings
<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}
[Purchases] - DEBUG: ℹ️ Loaded receipt from url file:///private/var/mobile/Containers/Data/Application/E60204B8-1B24-46ED-8E6C-BA7A0A56403D/StoreKit/sandboxReceipt
[Purchases] - DEBUG: ℹ️ Skipping products request for these products because they were already cached: ["staging.gera.fan.premium_ticket.5.free.2"]
[Purchases] - DEBUG: ℹ️ Found 0 unsynced attributes for App User ID: xpV6fr22RAhJj1wCiAPPrDGLti93
[Purchases] - DEBUG: ℹ️ API request completed: GET /v1/subscribers/xpV6fr22RAhJj1wCiAPPrDGLti93/offerings (200)
[Purchases] - DEBUG: ℹ️ Skipping products request for these products because they were already cached: ["staging.gera.fan.premium_ticket.10.free.5", "staging.gera.fan.premium_ticket.30.free.20", "staging.gera.fan.premium_ticket.20.free.12", "staging.gera.fan.premium_ticket.50.free.50", "staging.gera.fan.premium_ticket.5.free.2", "staging.gera.fan.premium_ticket.1", "staging.gera.fan.premium_ticket.3"]
[Purchases] - DEBUG: ℹ️ GetOfferingsOperation: Finished
[Purchases] - DEBUG: ℹ️ Serial request done: GET subscribers/xpV6fr22RAhJj1wCiAPPrDGLti93/offerings, 0 requests left in the queue
[Purchases] - DEBUG: ℹ️ PostReceiptDataOperation: Started
[Purchases] - INFO: ℹ️ Receipt parsed successfully
[Purchases] - DEBUG: ℹ️ PostReceiptDataOperation: Posting receipt: {
  "opaque_value" : "2zuL7wIHWAIdbR+h1RPMWg==",
  "original_application_version" : "1.0",
  "bundle_id" : "fan.gera.staging",
  "sha1_hash" : "A7rAboe5EBC3VIXYD5kfi29+SOc=",
  "application_version" : "825",
  "creation_date" : "2022-12-07T02:24:23Z",
  "in_app_purchases" : [
    {
      "product_id" : "staging.gera.fan.premium_ticket.5.free.2",
      "quantity" : 1,
      "transaction_id" : "2000000221069226",
      "is_in_trial_period" : false,
      "web_order_line_item_id" : 0,
      "original_purchase_date" : "2022-12-07T02:24:19Z",
      "original_transaction_id" : "2000000221069226",
      "product_type" : 1,
      "purchase_date" : "2022-12-07T02:24:19Z"
    }
  ]
}
[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 '2000000221072269' for product 'staging.gera.fan.premium_ticket.5.free.2'
[Purchases] - INFO: 😻💰 Purchased product - 'staging.gera.fan.premium_ticket.5.free.2'
  • 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.)
    • I want to use a new receipt even for the second and subsequent purchases

Describe the bug

It seems that the cached receipt is being used for the second purchase.
I want to use a new receipt even for the second and subsequent purchases.

Additional context

it's working on Android and iOS15

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions