Checkout 3.0
Mode changed callback

Mode changed callback

Optional callback that allows a partner to get information about the changes to the currently selected mode inside Checkout3.

Callback is triggered when a different mode is selected in Checkout3 by the user

Registering callback

To use this optional callback, a partner has to pass an additional flag modeChangedCallback to avardaCheckoutInit. Please refer to Showing the checkout form for additional info about Checkout 3 Form initialisation.

Callback payload

Callback payload is object with currentMode property as the first parameter and checkoutInstance as the second parameter (it is not necessary to use it). Possible values for currentMode are "B2C" or "B2B". Below you can see a code example.

<script>
  var modeChangedCallback = function ({ currentMode }, checkoutInstance) {
    console.log('Current Mode: ', currentMode);
 
    // Use data for your business logic
  };
</script>