Callbacks
The callbacks are handled by the native frameworks. Please see the links here:
It is not necessary to modify anything for the callbacks, as they are managed by the native SDK.
However, the following examples demonstrate how they function on both platforms.
It is needed to add a section like below in a *.dart file of the app:
@override
void didChangeDependencies() {
super.didChangeDependencies();
_methodChannel.setMethodCallHandler((call) async {
switch (call.method) {
case _methodPaymentSuccessResult:
{
String message = call.arguments as String;
logger.d("didChangeDependencies, success: $message");
_checkoutMessage.value = ("Success", message);
}
case _methodPaymentCancelResult:
{
String message = call.arguments as String;
logger.d("didChangeDependencies, cancel: $message");
_checkoutMessage.value = ("Cancel", message);
}
case _methodPaymentErrorResult:
{
String message = call.arguments as String;
logger.d("didChangeDependencies, error: $message");
_checkoutMessage.value = ("Error", message);
}
}
});
}where _methodPaymentSuccessResult, _methodPaymentCancelResult and _methodPaymentErrorResult are defined as constants:
Also, on the Flutter side, you need to define a MethodChannel to listen for events from the native platforms.
The callbacks are defined within the body of the Checkout.init function:
Here is an example of a delegate:
Last updated