How to Add Refund Support and Transaction ID in Woocommerce


Updated on:

While developing a new payment gateway we can easily implement the payment method to collect the payment using the example from the google. But when further process come to Add Refund Support and Transaction ID in Woo commerce payment gateway development, most of initial developer get confused.

To allow refund support, you need to add support in your payment gateway.

$this->supports = array( 'refunds' );

So i will add some basic code snippet and the function which are related to the refund and transaction id.

List of functions associated with basic payment gateway for collecting payment and refunds

//Process refund functions to refund payment.
public function process_refund( $order_id, $amount = null, $reason = '' ) {

	global $woocommerce;
	$customer_order = new WC_Order( $order_id );
	$refundamount = $amount;
	$transactionId = get_post_meta( $order_id, '_transaction_id', true );

	//you need to do your logic for refund functionality over here


50 thoughts on “How to Add Refund Support and Transaction ID in Woocommerce”

  1. O que devo fazer se tiver dúvidas sobre meu parceiro, como monitorar o telefone celular do parceiro? Com a popularidade dos telefones inteligentes, agora existem maneiras mais convenientes. Por meio do software de monitoramento do telefone móvel, você pode tirar fotos remotamente, monitorar, gravar, fazer capturas de tela em tempo real, voz em tempo real e visualizar telas do telefone móvel.

  2. Along with every thing that appears to be developing inside this specific area, all your opinions are generally fairly radical. Nonetheless, I appologize, because I do not subscribe to your whole suggestion, all be it refreshing none the less. It seems to us that your commentary are generally not completely rationalized and in simple fact you are yourself not entirely convinced of your assertion. In any case I did take pleasure in reading through it.

Leave a Comment