Checkout 3.0
Payment Method Changed Callback

Payment Method Changed Callback

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

Callback is triggered when a different payment method is selected in Checkout3 by the user.

Registering callback

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

Callback payload

Callback payload is object with properties regarding the selected payment method properties (paymentFee, paymentMethod) as the first parameter and checkoutInstance as the second parameter (it is not necessary to use it). PaymentMethod displays name of the selected payment method as a string value. PaymentFee displays a value of the selected payment method as a number. Below you can see a code example.

  var paymentMethodChangedCallback = function({paymentMethod, paymentFee}, checkoutInstance) {
    console.log("paymentMethod": paymentMethod, "paymentFee": paymentFee);
    // Use data for your business logic