reportPurchase method
Reports a finished store purchase: with the store's proof
(signedTransaction on iOS, purchaseToken + productType on Android)
Hatang verifies it and records it for this person; the team also gets an
internal note. false without a session, on an older gateway, or when
the store refuses it.
Implementation
Future<bool> reportPurchase({
required String platform,
required String storeProductId,
String? transactionId,
num? amount,
String? currency,
String? signedTransaction,
String? purchaseToken,
String? productType,
String? kind,
}) async {
await _ensureLoaded();
final token = _token;
if (token == null) return false;
try {
return await _api.postPurchase(
token: token,
platform: platform,
storeProductId: storeProductId,
transactionId: transactionId,
conversationId: _state.conversation?.id,
amount: amount,
currency: currency,
signedTransaction: signedTransaction,
purchaseToken: purchaseToken,
productType: productType,
kind: kind,
);
} on HatangException catch (e) {
_log.warn('purchase report failed: $e');
return false;
}
}