transactionWithReceipt method

void transactionWithReceipt({
  1. required String productId,
  2. required String currencyCode,
  3. required double unitPrice,
  4. required int quantity,
  5. String? androidPurchaseData,
  6. String? androidDataSignature,
  7. String? iosReceipt,
  8. String? iosTransactionId,
})

Implementation

void transactionWithReceipt({
  required String productId,
  required String currencyCode,
  required double unitPrice,
  required int quantity,
  String? androidPurchaseData,
  String? androidDataSignature,
  String? iosReceipt,
  String? iosTransactionId,
}) {
  bool isValidIOS =
      Platform.isIOS && iosReceipt != null && iosTransactionId != null;
  bool isValidAndroid = Platform.isAndroid &&
      androidPurchaseData != null &&
      androidDataSignature != null;
  if (isValidIOS || isValidAndroid) {
    _channel.invokeMethod('transactionWithReceipt', {
      'productId': productId,
      'purchaseData': androidPurchaseData,
      'dataSignature': androidDataSignature,
      'currencyCode': currencyCode,
      'unitPrice': unitPrice,
      'quantity': quantity,
      'receipt': iosReceipt,
      'transactionId': iosTransactionId,
    });
  } else {
    print('TenjinSDK.instance transaction is missing data');
  }
}