initialize method
Future<bool>
initialize({
- required TappaErrorCallback errorCallback,
- TappaLoyaltyCardCallback? loyaltyCardCallback,
- bool isSandBoxMode = true,
Initializes the Tappa SDK.
This must be called before any other methods.
errorCallback will be invoked when errors occur in the SDK.
loyaltyCardCallback will be invoked when loyalty card data is received.
isSandBoxMode sets the payment environment - true for sandbox (default), false for production.
Returns true if initialization was successful, false otherwise.
Implementation
Future<bool> initialize({
required TappaErrorCallback errorCallback,
TappaLoyaltyCardCallback? loyaltyCardCallback,
bool isSandBoxMode = true,
}) async {
_errorCallback = errorCallback;
_loyaltyCardCallback = loyaltyCardCallback;
try {
final bool result = await _channel.invokeMethod('initialize', {
'isSandBoxMode': isSandBoxMode,
});
return result;
} on PlatformException catch (e) {
debugPrint('Error initializing Tappa: ${e.message}');
return false;
}
}