WC_Gateway_Paypal::maybe_onboard_with_transactpublicWC 1.0

Onboard the merchant with the Transact platform.

Method of the class: WC_Gateway_Paypal{}

Hooks from the method

Returns

null. Nothing (null).

Usage

$WC_Gateway_Paypal = new WC_Gateway_Paypal();
$WC_Gateway_Paypal->maybe_onboard_with_transact();

WC_Gateway_Paypal::maybe_onboard_with_transact() code WC 10.6.2

public function maybe_onboard_with_transact() {
	if ( ! is_admin() || ! current_user_can( 'manage_woocommerce' ) ) {
		return;
	}

	// Do not run if PayPal Standard is not enabled.
	if ( 'yes' !== $this->enabled ) {
		return;
	}

	/**
	 * Filters whether the gateway should use Orders v2 API.
	 *
	 * @param bool $use_orders_v2 Whether the gateway should use Orders v2 API.
	 *
	 * @since 10.2.0
	 */
	$use_orders_v2 = apply_filters(
		'woocommerce_paypal_use_orders_v2',
		PayPalHelper::is_orders_v2_migration_eligible()
	);

	// If the conditions are met, but there is an override to not use Orders v2,
	// respect the override. Bail early -- we don't need to onboard if not using Orders v2.
	if ( ! $use_orders_v2 ) {
		return;
	}

	$transact_account_manager = new PayPalTransactAccountManager( $this );
	$transact_account_manager->do_onboarding();
}