Detecting refunds in in_app_purchase

I am revisiting my quest for detecting iOS refunds without a server as it is time for me to release my app on iOS. (I have a native iOS version that I am retiring in favor of this new Flutter implementation.)

The in_app_purchase_storekit package v0.4.2 (published Jun 10, 2025) changelog notes:

  • Add jsonRepresentation to SK2PurchaseDetails as localVerificationData for local transaction debugging and verification.

I don’t know about SK2PurchaseDetails, but the jsonRepresentation link takes you to the iOS Transaction object. In Flutter one can access the iOS transactions like so:

import 'package:in_app_purchase_storekit/store_kit_2_wrappers.dart';

if (Platform.isIOS) {
  final inAppPurchase2API = InAppPurchase2API();
  final List<SK2TransactionMessage> transactions = await inAppPurchase2API.transactions();
}

SK2TransactionMessage has a jsonRepresentation property. That JSON will contain two new items after a refund:

  • revocationDate
  • revocationReason

I am thinking this is all I need.

Perhaps this property was added earlier (January 16, 2025):

0.3.20+4

  • Exposes jsonRepresentation field for transactions.