Add authorize.net directpost payment method to a custom checkout page in magento 2

There are 2 ways to add authorize.net direct-post payment method to a custom checkout page.

1 Use template and js model of magento core modules
2 Create new js model and new creditcard form
add authorize.net directpost payment method
add authorize.net directpost payment method

1.Use template and js model of magento core modules.

1 vendor/magento/module-authorizenet/view/frontend/web/template/payment/authorizenet-directpost.html
2 vendor/magento/module-authorizenet/view/frontend/web/js/view/payment/method-renderer/authorizenet-directpost.js

2.Create new js model and new creditcard form:

  • Template file:

  • Js model file functions:

3.Add authorize.net directpost payment method – Note:

  • You have to use an iframe to be shown data response after connect to authorize.net api  

(https://test.authorize.net/gateway/transact.dll) instead of using ajax request.

  • You have to create a temp form by this function and target to this iframe. Please look at sendPaymentRequest function.

 

We also contribute great content of Magento Tutorial for Magento 1.x.

DON'T MISS THE CHANCE!

magento tutorial

How to Create a New Offline Payment Method in Magento 2
How to Add Credit Card Form Using Swipe Card Reader in Magento 2

Leave a Reply

Your email address will not be published. Required fields are marked *