Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders

PaymentGateway::get_onboarding_not_supported_messagepublicWC 1.0

Get the message to show when the payment gateway does not support onboarding.

Method of the class: PaymentGateway{}

No Hooks.

Returns

String|null. The message to show when the payment gateway does not support onboarding, or null if no specific message should be provided.

Usage

$PaymentGateway = new PaymentGateway();
$PaymentGateway->get_onboarding_not_supported_message( $payment_gateway, $country_code ): ?string;
$payment_gateway(WC_Payment_Gateway) (required)
The payment gateway object.
$country_code(string)
The country code for which to check. This should be an ISO 3166-1 alpha-2 country code.
Default: ''

Notes

  • See: self::is_onboarding_supported()

PaymentGateway::get_onboarding_not_supported_message() code WC 10.4.3

public function get_onboarding_not_supported_message( WC_Payment_Gateway $payment_gateway, string $country_code = '' ): ?string {
	try {
		if ( method_exists( $payment_gateway, 'get_onboarding_not_supported_message' ) &&
			is_callable( array( $payment_gateway, 'get_onboarding_not_supported_message' ) ) ) {

			$message = call_user_func( array( $payment_gateway, 'get_onboarding_not_supported_message' ), $country_code, );
			if ( is_string( $message ) && ! empty( $message ) ) {
				return sanitize_textarea_field( trim( $message ) );
			}
		}
	} catch ( Throwable $e ) {
		// Do nothing but log so we can investigate.
		SafeGlobalFunctionProxy::wc_get_logger()->debug(
			'Failed to determine the gateway onboarding not supported message: ' . $e->getMessage(),
			array(
				'gateway'   => $payment_gateway->id,
				'country'   => $country_code,
				'source'    => 'settings-payments',
				'exception' => $e,
			)
		);
	}

	// If we reach here, just assume that no specific message should be provided.
	return null;
}