self::get_headers(), ]; $response = wp_remote_get( $url, $args ); $status_code = wp_remote_retrieve_response_code( $response ); if ( $status_code == 200 ) { $body = wp_remote_retrieve_body( $response ); $notification = json_decode( $body ); return $notification; } if ( $status_code == 401 ) { throw new WC_8Pay_Invalid_AccessToken_Exception( 'Missing or invalid access token' ); } if ( $status_code == 404 ) { throw new WC_8Pay_NotFound_Exception( 'Plan not found' ); } throw new Exception( 'Un unkown error occurred' ); } }