initTapPay method
Initialize TapPay payment SDK
appId
is the App ID assigned by TapPay
appKey
is the App Key assigned by TapPay
isSandbox
is a boolean value to indicate whether to use sandbox mode
return TapPayInitResult with value success
as true
if success
return TapPayInitResult with value success
as false
if fail
return TapPayInitResult with value message
as String if fail
return null
if the initialization is incomplete
Implementation
@override
Future<TapPayInitResult?> initTapPay({
required int appId,
required String appKey,
bool isSandbox = false,
}) async {
var initResult = await methodChannel.invokeMethod<Map<Object?, Object?>>(
'initPayment',
<String, dynamic>{
'appId': appId,
'appKey': appKey,
'isSandbox': isSandbox,
},
);
if (initResult == null) {
return TapPayInitResult(
success: false,
message:
"Encountered an unknown error when initializing TapPay payment instance.");
} else {
return TapPayInitResult.fromMap(Map<String, dynamic>.from(initResult));
}
}