Magento 2 – How Payment Gateway Works

customextensionsmagento2modulepayment-gateway

I want to integrate my own payment gateway in Magento 2. I've read many topics, studied the sample code from the Magento 2 repository and the braintree module.

However I've not found great posts about the used patterns and how they works. I would like to understand what's the process and the functional flow behind this.
Actually I can implement the payment gateway but it's completely useless if I can't understand how it works.. So what I need is some technical logic explanation and what are the different process.

Best Answer

Unfortunately, now Magento has any docs about payment integrations based on Payment Gateway, but docs in progress and should be published in the nearest future.

One exception is - How to add a payment method to checkout page.

But, you can read some start topics:

Also, I've created few sequence diagrams, they describe base flow: Payment Gateway flow And example flow for an authorize payment action Authorization flow

UPD: Magento team has published documentation about payment integrations.