Automattic\WooCommerce\Gateways\PayPal
TransactAccountManager::create_provider_account
Create the provider account with the Transact platform.
Method of the class: TransactAccountManager{}
No Hooks.
Returns
bool. True if the provider account creation was successful, false otherwise.
Usage
// private - for code of main (parent) class only $result = $this->create_provider_account(): bool;
Changelog
| Since 10.5.0 | Introduced. |
TransactAccountManager::create_provider_account() TransactAccountManager::create provider account code WC 11.0.1
private function create_provider_account(): bool {
$site_id = \Jetpack_Options::get_option( 'id' );
if ( ! $site_id ) {
return false;
}
$request_body = array(
'test_mode' => $this->gateway->testmode,
'provider_type' => self::TRANSACT_PROVIDER_TYPE,
);
$response = $this->send_transact_api_request(
'POST',
sprintf( '/sites/%d/transact/account/%s/onboard', $site_id, self::TRANSACT_PROVIDER_TYPE ),
$request_body
);
if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
return false;
}
// Provider account response only returns an empty onboarding link,
// which we do not need.
return true;
}