purchase method

  1. @override
Future<void> purchase({
  1. required String productId,
})
override

购买产品

Implementation

@override
Future<void> purchase({required String productId}) async {
  safeLog('📤 [MethodChannel] 调用 purchase, productId: $productId');
  try {
    await methodChannel.invokeMethod('purchase', {'productId': productId});
    safeLog('✅ [MethodChannel] purchase 调用成功');
  } catch (e, stackTrace) {
    safeLog(
      '❌ [MethodChannel] purchase 失败: $e',
      error: e,
      stackTrace: stackTrace,
    );
    rethrow;
  }
}