WordPress at a glance
function is not described

WC_Order::set_payment_method() public WC 1.0

Set the payment method.

{} It's a method of the class: WC_Order{}

No Hooks.

Return

Null. Nothing.

Usage

$WC_Order = new WC_Order();
$WC_Order->set_payment_method( $payment_method );
$payment_method(string)
Supports WC_Payment_Gateway for bw compatibility with < 3.0.

Code of WC_Order::set_payment_method() WC 5.0.0

<?php
public function set_payment_method( $payment_method = '' ) {
	if ( is_object( $payment_method ) ) {
		$this->set_payment_method( $payment_method->id );
		$this->set_payment_method_title( $payment_method->get_title() );
	} elseif ( '' === $payment_method ) {
		$this->set_prop( 'payment_method', '' );
		$this->set_prop( 'payment_method_title', '' );
	} else {
		$this->set_prop( 'payment_method', $payment_method );
	}
}