cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Payment Extension

SOLVED

Re: Custom Payment Extension

Thanks again! Got everything working... Now I want to catch the case when the order status is changed from the admin panel. Are there any good examples I can look into? Also, is it possible to display the payment URL somewhere on the order page?

Re: Custom Payment Extension

Hello @emil_kostadinov

 

Why do you need to change order status from admin?

 

Magento 2 itself will do that.

 

When you generate invoice it will go processing, and after creating the shipment, it will complete order.

 

Do you want to any other customization for that?

 

If it will help you then mark as solution 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Custom Payment Extension

The main case is when the order is canceled. The system has to cancel the external payment invoice - just want to create a simple handler that will send an API request to the payment service to cancel the invoice. 

Re: Custom Payment Extension

Hello,

 

I think it should be on credit memo generation, not when canceling the order.

 

https://github.com/Inchoo/magento2-Inchoo_Stripe/blob/master/Model/Payment.php

 

Please check Magento 2 provide function refund to do that when you generate credit memo.

 

Hope it will clear your question.

 

If it will work then mark as solution.


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Custom Payment Extension

What I did was to register a new observer on the order_cancel_after event. And now it cancels and the external payment. Another thing that I want to catch is when the invoice is set to On Hold. Searched for some other events like order_status_onhold but I couldn't find such. How can I execute a function when the order status is changed?