Transaction Callbacks

Once done with the transaction using the web gateway we close the browser window and call the relevant callback i.e either the failure or success callbacks

Below is how to include them

mobPay.pay(MainActivity.this,// The instance of an activity that will be active until the payment is completed merchant, payment, customer, new TransactionSuccessCallback() { @Override public void onSuccess(TransactionResponse transactionResponse) { // Your code to proceed to after success } }, new TransactionFailureCallback() { @Override public void onError(Throwable error) { // Code to handle failure } });
// Create a transaction succcess callback void transactionSuccessCallback(payload) { { final snackBar = SnackBar( content: Text(payload.toString()), action: SnackBarAction( label: 'Undo', onPressed: () { // Some code to undo the change. },),); // Find the ScaffoldMessenger in the widget tree // and use it to show a SnackBar. ScaffoldMessenger.of(context).showSnackBar(snackBar); } } // Transaction Failure callback void transactionFailureCallback(payload) { { final snackBar = SnackBar( content: Text(payload.toString()), action: SnackBarAction( label: 'Undo', onPressed: () { // Some code to undo the change. },),); // Find the ScaffoldMessenger in the widget tree // and use it to show a SnackBar. ScaffoldMessenger.of(context).showSnackBar(snackBar); } }