initialize method

  1. @override
Future<bool> initialize({
  1. String? apiKey,
  2. String? appId,
  3. String? clientId,
  4. String? baseUrl,
})
override

Implementation

@override
Future<bool> initialize({
  String? apiKey,
  String? appId,
  String? clientId,
  String? baseUrl,
}) async {
  try {
    final packageName = await WalletconnectPayUtils.getPackageName();
    final sdkConfig = SdkConfig(
      baseUrl: WalletconnectPayUtils.getBaseUrl(),
      sdkName: WalletconnectPayUtils.getSdkName(),
      sdkVersion: WalletconnectPayUtils.getSdkVersion(),
      sdkPlatform: WalletconnectPayUtils.getPlatform(),
      apiKey: apiKey,
      projectId: appId,
      appId: appId,
      bundleId: packageName,
      clientId: clientId,
    );
    final result = await methodChannel.invokeMethod<bool>(
      'initialize',
      sdkConfig.toJsonString(),
    );
    return result!;
  } on PlatformException catch (e) {
    debugPrint('[$runtimeType] ❌ initialize: $e');
    throw PayInitializeError(
      code: e.code,
      message: e.message?.replaceFirst('v1=', ''),
      details: e.details,
      stacktrace: e.stacktrace,
    );
  }
}