I’m developing payment gateway for Woo and try to use woocommerce_receipt_ hook for submit custom form and redirect customer to third part web payment service. Any one with idea why hook doesn’t work. Thanks for helping!! Cheers!

This is my payment class code:

class my_vpos extends WC_Payment_Gateway {
  function __construct() {

      // The global ID for this Payment method
      $this->id = "my_vpos";


      $this->method_title = __( "my_vpos", 'my_vpos' );


      $ this->method_description = __( "Payment Gateway Plug-in for 
        WooCommerce", 'my_vpos' );
      $this->title = __( "my_vpos", 'my_vpos' );


      $this->has_fields = false;

      // This basically defines your settings which are then loaded with 
         init_settings()
     $this->init_form_fields();

     $this->title = $this->get_option( 'title' );
     $this->init_settings();


     $this->testurl = 'https://www.exaple-payment.com/pay-gw-t/vpos';
     $this->liveurl = 'https://www.exaple-payment.com/pay-gw-t/vpos';

     // Actions


     add_action( 'woocommerce_receipt_' . $this->id, array( $this, 
     'receipt_page'));
 } // End __construct()


    function receipt_page( $order ){
      echo '<form action="' . $this->testurl . '" method="post" 
      id="submit_payment_form">
            <input type="hidden" name="type" value="PAYLOGIN"/>
            </form>';
    }
}

Read more here: Woocommerce receipt hook don’t work correct


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: