Automattic\WooCommerce\Gateways\PayPal
TransactAccountManager::send_transact_api_request
Send a request to the Transact platform.
Method of the class: TransactAccountManager{}
No Hooks.
Returns
Array|\WP_Error. The API response body, or null if the request fails.
Usage
// private - for code of main (parent) class only $result = $this->send_transact_api_request( $method, $endpoint, $request_body );
- $method(string) (required)
- The HTTP method to use.
- $endpoint(string) (required)
- The endpoint to request.
- $request_body(array) (required)
- The request body.
Changelog
| Since 10.5.0 | Introduced. |
TransactAccountManager::send_transact_api_request() TransactAccountManager::send transact api request code WC 10.9.4
private function send_transact_api_request( string $method, string $endpoint, array $request_body ) {
if ( 'GET' === $method ) {
$endpoint .= '?' . http_build_query( $request_body );
}
$response = Jetpack_Connection_Client::wpcom_json_api_request_as_blog(
$endpoint,
(string) self::WPCOM_PROXY_ENDPOINT_API_VERSION,
array(
'headers' => array( 'Content-Type' => 'application/json' ),
'method' => $method,
'timeout' => PayPalConstants::WPCOM_PROXY_REQUEST_TIMEOUT,
),
'GET' === $method ? null : wp_json_encode( $request_body ),
'wpcom'
);
return $response;
}