Skip to content

in_app_purchase_storekit date format does not match in_app_purchase_platform_interface PurchaseDetails.transactionDate format #175072

Closed
flutter/packages
#11717

Description

@qeepcologne

Steps to reproduce

from in_app_purchase_platform_interface
PurchaseDetails.transactionDate api documentation:

  /// The timestamp of the transaction.
  ///
  /// Milliseconds since epoch.
  ///
  /// The value is `null` if [status] is not [PurchaseStatus.purchased].
  final String? transactionDate;

but in case of SK2PurchaseDetails, field transactionDate contains date String like 2025-09-08 16:48:37
instead of millisecondsSinceEpoch.

Expected results

PurchaseDetails.transactionDate always return millisecondsSinceEpoch (for both GooglePlayPurchaseDetails and SK2PurchaseDetails).

Actual results

see above, sometimes holds number, somtimes String.
I think this confusion is added, because field contains String?, it should be changed to int?, this cannot happen.

Code sample

i need to add a hack like

  static int? parsePurchaseTime(String? transactionDate) {
    if (transactionDate == null) {
      return null;
    } else if (isNumeric(transactionDate)) {
      return int.parse(transactionDate);
    } else {
      return DateTime.parse(transactionDate).millisecondsSinceEpoch;
    }
  }

Flutter Doctor output

Doctor output [✓] Flutter (Channel stable, 3.35.3, on Ubuntu Questing Quokka (development branch) 6.15.11-061511-generic, locale en_DE.UTF-8) [✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [✓] Chrome - develop for the web [✓] Android Studio (version 2025.1.4) [✓] Connected device (3 available) [✓] Network resources

Activity

  1. darshankawar commented on Sep 9, 2025

    @darshankawar
    Member
  2. added
    packageflutter/packages repository. See also p: labels.
    platform-iosiOS applications specifically
    team-iosOwned by iOS platform team
    and removed
    in triagePresently being triaged by the triage team
    on Sep 9, 2025
  3. jmagman commented on Sep 18, 2025

    @jmagman
    Member

    Added to #157558

    @LouiseHsu any idea why this is a String? instead of an int??

  4. added
    P2Important issues not at the top of the work list
    triaged-iosTriaged by iOS platform team
    on Sep 18, 2025
  5. absar commented on May 13, 2026

    @absar

    Hi @jmagman @LouiseHsu it is worse than the OPs example, the returned dates are in a format 2026-05-13 PM 11:14:03 which cannot even be parsed by DateTime.parse since the formatter does not use 24H format instead using PM/AM probably based on device locale, which is not a good idea for an API.

    The issue is in StoreKit2Translators.swift extension Transaction which is using a magic hardcoded formatter dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" instead of Milliseconds since epoch.
    Which is not complying with PurchaseDetails.transactionDate public API contract.

    Note it is impacting both SK2Transaction.purchaseDate and SK2Transaction.expirationDate and ultimately PurchaseDetails.transactionDate

  6. 3 remaining items

  7. github-actions commented on Aug 6, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  8. locked as resolved and limited conversation to collaborators on Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listp: in_app_purchasePlugin for in-app purchasepackageflutter/packages repository. See also p: labels.platform-iosiOS applications specificallyteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions