Magento 2 Checkout – How to Get Selected Payment Details on Next Step

checkoutknockoutjsmagento-2.1magento2

Using knockout js, I have created a custom step, which I have place after payment method. I need to show which payment method was selected by the user.

I am creating a custom step as summary step. I want to display shipping address, shipping method and payment method.

Best Answer

You need to do this things.

  1. In your custom step js file, Include this file

    vendor\magento\module-checkout\view\frontend\web\js\checkout-data.js
    
  2. After inluding file, used object of that file into your code and call the function getSelectedPaymentMethod.

  3. That function give you information which you can used further.