Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders

WooPayments::needs_setuppublicWC 1.0

Check if the payment gateway needs setup.

Method of the class: WooPayments{}

No Hooks.

Returns

true|false. True if the payment gateway needs setup, false otherwise.

Usage

$WooPayments = new WooPayments();
$WooPayments->needs_setup( $payment_gateway ): bool;
$payment_gateway(WC_Payment_Gateway) (required)
The payment gateway object.

WooPayments::needs_setup() code WC 10.6.2

public function needs_setup( WC_Payment_Gateway $payment_gateway ): bool {
	// No account means we need setup.
	if ( ! $this->is_account_connected( $payment_gateway ) ) {
		return true;
	}

	// Test-drive accounts don't need setup.
	if ( $this->has_test_account() ) {
		return false;
	}

	return parent::needs_setup( $payment_gateway );
}