How would I implement this exact logic in M2 with the new gateway API? https://github.com/ergopalpatel/Magento_Payment_Gateway_Skeleton
Steps
- Customer selects a custom payment method
- When 'Place Order' is clicked, customer is redirected to the external payment page with some additional POST data
- Payment page redirects on success/failure back to a specified magento controller, which processes the result
I had a look around and found that \Magento\Payment\Model\Method\Cc is deprecated and that you should use the gateway api. I read the articles by Max Pronko and https://www.maxpronko.com/blog/magento-2-payment-gateway-api and tried to analyze the sample magento module and Braintree module, but I just can't wrap my head around those, either too much or too little going on.
Where do I even start if I want to implement this flow with redirects? Is there a comprehensive documentation somewhere or a module implemented on the gateway API that does exactly what I need?
EDIT
I dug into the Magento_Payment code and it seems like this kind flow is not supported at all, classes implementing the Magento\Payment\Gateway\Http\ClientInterface, which handle the requests and responses, seems to be only working with synchronous requests against a webapi.
So what are the options then? Use deprecated components?
EDIT
Seems like using the Magento\Payment\Model\MethodInterface (which has an @api annotation, so I'm hoping it won't get deprecated anytime soon) and implementing your own logic for redirects/validations etc is the way to go as of now.