I am creating a new custom plugin in WooCommerce. I have to upload a file using ajax from front end so I added following code in my payment gateway class. I want to create a new ajax endpoint in class.
I added following line in constructor.
add_action( 'wc_ajax_wc_upload_payment_receipt', array( $this, 'wc_ajax_upload_payment_receipt'));
And create following function in class
public function wc_ajax_upload_payment_receipt(){
echo "hi";
print_r($_REQUEST);
}
Now when I call my ajax request using WC_AJAX::get_endpoint( 'wc_ajax_upload_payment_receipt' )
it is returning nothing.
Why is it not going inside my created function?