WC_Payment_Gateway::get_transaction_url PHP Method

get_transaction_url() public method

Get a link to the transaction on the 3rd party gateway size (if applicable).
public get_transaction_url ( WC_Order $order ) : string
$order WC_Order the order object.
return string transaction URL, or empty string.
    public function get_transaction_url($order)
    {
        $return_url = '';
        $transaction_id = $order->get_transaction_id();
        if (!empty($this->view_transaction_url) && !empty($transaction_id)) {
            $return_url = sprintf($this->view_transaction_url, $transaction_id);
        }
        return apply_filters('woocommerce_get_transaction_url', $return_url, $order, $this);
    }

Usage Example

 /**
  * Get the transaction URL.
  *
  * @param  WC_Order $order
  *
  * @return string
  */
 public function get_transaction_url($order)
 {
     if ($this->testmode) {
         $this->view_transaction_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_view-a-trans&id=%s';
     } else {
         $this->view_transaction_url = 'https://www.paypal.com/cgi-bin/webscr?cmd=_view-a-trans&id=%s';
     }
     return parent::get_transaction_url($order);
 }
All Usage Examples Of WC_Payment_Gateway::get_transaction_url