I am trying to find the correct method to create the afterPlugin for. I need to collect and send the invoice data after it is created and saved, I tried with both afterRegister and afterPay but both works before the invoice is saved, please advise which method should be used to capture a newly created invoice after it is saved. So it would have incrementID, createdAt, etc...

I would prefer a plugin rather than an observer

Note: I am trying to do this function when the user hit submit button and its only for newly created invoices, not edited ones (if that is possible)

Magento 2.2.0

  • You said you preffer a plugin, but if you change your mind... magento.stackexchange.com/questions/192968/… Jan 16, 2018 at 9:05
  • thank you for the quick response, i checked this one before, if you mean sales_order_invoice_pay then as far as I understand it is the event called with pay() method and I tried the plugin for afterPay() but still, invoice is not saved in DB so no ID or date is present
    – Sherbieny
    Jan 16, 2018 at 9:13


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.