Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders
PaymentGateway::is_onboarding_completed
Check if the payment gateway has completed the onboarding process.
Method of the class: PaymentGateway{}
No Hooks.
Returns
true|false. True if the payment gateway has completed the onboarding process, false otherwise. If the payment gateway does not provide the information, it will infer it from having a connected account.
Usage
$PaymentGateway = new PaymentGateway(); $PaymentGateway->is_onboarding_completed( $payment_gateway ): bool;
- $payment_gateway(WC_Payment_Gateway) (required)
- The payment gateway object.
PaymentGateway::is_onboarding_completed() PaymentGateway::is onboarding completed code WC 10.6.2
public function is_onboarding_completed( WC_Payment_Gateway $payment_gateway ): bool {
// Sanity check: If the onboarding has not started, it cannot be completed.
if ( ! $this->is_onboarding_started( $payment_gateway ) ) {
return false;
}
try {
if ( method_exists( $payment_gateway, 'is_onboarding_completed' ) && is_callable( array( $payment_gateway, 'is_onboarding_completed' ) ) ) {
return wc_string_to_bool( $payment_gateway->is_onboarding_completed() );
}
// Note: This is what WooPayments provides, but it should become standard.
if ( method_exists( $payment_gateway, 'is_account_partially_onboarded' ) && is_callable( array( $payment_gateway, 'is_account_partially_onboarded' ) ) ) {
return ! wc_string_to_bool( $payment_gateway->is_account_partially_onboarded() );
}
} catch ( Throwable $e ) {
// Do nothing but log so we can investigate.
SafeGlobalFunctionProxy::wc_get_logger()->debug(
'Failed to determine if gateway onboarding is completed: ' . $e->getMessage(),
array(
'gateway' => $payment_gateway->id,
'source' => 'settings-payments',
'exception' => $e,
)
);
}
// Fall back to inferring this from having a connected account.
return $this->is_account_connected( $payment_gateway );
}