Send Processing Order Email from custom payment plugin


All payment methods are sending email to admin and customer after completed order.
I have custom payment method via plugin with a bank, that is on success returning empty cart, new order in list and everything else works fine, but it doesn’t send emails. Because mail function doesn’t exist inside plugin. On successful payment I need to send exactly the same email from processing order template as with other payment methods. I know when to trigger function, but do not know what function to call.

class My_Class extends WC_Payment_Gateway {


function __construct() {


    if ( is_admin() ) {
        add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );

    if( isset($_POST['oid']) && isset($_POST['Response']) )
        $this->process_respond($_POST['oid'], $_POST['Response']);

public function process_respond($response_order_id, $result){
    global $woocommerce;

    $customer_order = new WC_Order( $response_order_id );

    $error_msg = "Error in transaction";

    if ( $result == "Approved" ) {


        // I need to trigger function here


    } else {


, , Nemanja Datkov 6 months 0 Answers 82 views 0

Leave an answer